- Drag&Drop a connection where source or target system is an Abyss system, should switch connection type to "abyss"

- fixed js bug in "route finder" module
- fixed UI z-Index glitch where systems "overlap" context menu
This commit is contained in:
Mark Friedrich
2018-06-04 21:37:40 +02:00
parent d59fe133e2
commit e30f8a754c
9 changed files with 62 additions and 27 deletions

View File

@@ -899,7 +899,7 @@ class Map extends Controller\AccessController {
/**
*
* add new map connection based on current $character location
* @param Model\CharacterModel $character
* @param Model\MapModel $map
* @return Model\MapModel
@@ -949,7 +949,7 @@ class Map extends Controller\AccessController {
$targetSystem = $map->getSystemByCCPId( $targetSystemId, ['active' => 1]);
}
// if systems don´t already exists on map -> get "blank" systems
// if systems don´t already exists on map -> get "blank" system
// -> required for system type check (e.g. wormhole, k-space)
if(
!$sourceSystem &&

View File

@@ -172,21 +172,30 @@ class ConnectionModel extends AbstractMapTrackingModel {
/**
* set default connection type by search route between endpoints
* @throws \Exception\PathfinderException
*/
public function setDefaultTypeData(){
if(
is_object($this->source) &&
is_object($this->target)
){
$routeController = new Route();
$route = $routeController->searchRoute($this->source->systemId, $this->target->systemId, 1);
if($route['routePossible']){
$this->scope = 'stargate';
$this->type = ['stargate'];
if(
$this->source->isAbyss() ||
$this->target->isAbyss()
){
$this->scope = 'abyssal';
$this->type = ['abyssal'];
}else{
$this->scope = 'wh';
$this->type = ['wh_fresh'];
$routeController = new Route();
$route = $routeController->searchRoute($this->source->systemId, $this->target->systemId, 1);
if($route['routePossible']){
$this->scope = 'stargate';
$this->type = ['stargate'];
}else{
$this->scope = 'wh';
$this->type = ['wh_fresh'];
}
}
}
}
@@ -222,18 +231,19 @@ class ConnectionModel extends AbstractMapTrackingModel {
}
/**
* Event "Hook" function
* Event "Hook" function
* can be overwritten
* return false will stop any further action
* @param ConnectionModel $self
* @param BasicModel $self
* @param $pkeys
* @return bool
* @throws \Exception\DatabaseException
* @throws \Exception\PathfinderException
*/
public function beforeInsertEvent($self, $pkeys){
// check for "default" connection type and add them if missing
// -> get() with "true" returns RAW data! important for JSON table column check!
$types = (array)json_decode( $this->get('type', true) );
$types = (array)json_decode($this->get('type', true));
if(
!$this->scope ||
empty($types)
@@ -411,6 +421,7 @@ class ConnectionModel extends AbstractMapTrackingModel {
* @param null $table
* @param null $fields
* @return bool
* @throws \Exception
*/
public static function setup($db=null, $table=null, $fields=null){
$status = parent::setup($db,$table,$fields);

View File

@@ -554,18 +554,26 @@ class SystemModel extends AbstractMapTrackingModel {
* check whether this system is a wormhole
* @return bool
*/
public function isWormhole(){
public function isWormhole() : bool {
return ($this->typeId->id === 1);
}
/**
* check whether this syste is a shattered wormhole
* check whether this system is a shattered wormhole
* @return bool
*/
public function isShatteredWormhole(){
public function isShatteredWormhole() : bool {
return ($this->isWormhole() && $this->security === 'SH');
}
/**
* check whether this system is an Abyss system
* @return bool
*/
public function isAbyss() : bool {
return ($this->typeId->id === 3 && $this->security === 'A');
}
/**
* send rally point poke to various "APIs"
* -> send to a Slack channel

View File

@@ -1831,7 +1831,6 @@ define([
dataType: 'json',
context: connections
}).done(function(data){
// remove connections from map
removeConnections(this);
@@ -1839,7 +1838,6 @@ define([
if(callback){
callback();
}
}).fail(function( jqXHR, status, error) {
let reason = status + ' ' + error;
Util.showNotify({title: jqXHR.status + ': deleteSystem', text: reason, type: 'warning'});
@@ -2509,6 +2507,11 @@ define([
return false;
}
// switch connection type to "abyss" in case source OR target system belongs to "a-space"
if(sourceSystem.data('typeId') === 3 || targetSystem.data('typeId') === 3){
setConnectionScope(connection, 'abyssal');
}
// set "default" connection status only for NEW connections
if(!connection.suspendedElement){
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );

View File

@@ -92,10 +92,15 @@ define([
* get a unique cache key name for "source"/"target"-name
* @param sourceName
* @param targetName
* @returns {string}
* @returns {*}
*/
let getConnectionDataCacheKey = (sourceName, targetName) => {
return [sourceName.toLowerCase(), targetName.toLowerCase()].sort().join('###');
let key = false;
if(sourceName && targetName){
// names can be "undefined" in case system is currently on drag/drop
key = [sourceName.toLowerCase(), targetName.toLowerCase()].sort().join('###');
}
return key;
};
/**

File diff suppressed because one or more lines are too long

View File

@@ -1831,7 +1831,6 @@ define([
dataType: 'json',
context: connections
}).done(function(data){
// remove connections from map
removeConnections(this);
@@ -1839,7 +1838,6 @@ define([
if(callback){
callback();
}
}).fail(function( jqXHR, status, error) {
let reason = status + ' ' + error;
Util.showNotify({title: jqXHR.status + ': deleteSystem', text: reason, type: 'warning'});
@@ -2509,6 +2507,11 @@ define([
return false;
}
// switch connection type to "abyss" in case source OR target system belongs to "a-space"
if(sourceSystem.data('typeId') === 3 || targetSystem.data('typeId') === 3){
setConnectionScope(connection, 'abyssal');
}
// set "default" connection status only for NEW connections
if(!connection.suspendedElement){
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );

View File

@@ -92,10 +92,15 @@ define([
* get a unique cache key name for "source"/"target"-name
* @param sourceName
* @param targetName
* @returns {string}
* @returns {*}
*/
let getConnectionDataCacheKey = (sourceName, targetName) => {
return [sourceName.toLowerCase(), targetName.toLowerCase()].sort().join('###');
let key = false;
if(sourceName && targetName){
// names can be "undefined" in case system is currently on drag/drop
key = [sourceName.toLowerCase(), targetName.toLowerCase()].sort().join('###');
}
return key;
};
/**

View File

@@ -308,7 +308,7 @@ $mapWrapperMaxWidth: $mapWidth + 35px;
@include transform( translate3d(0, -1px, 0) !important);
&:not(.jsPlumb_dragged){
z-index: 2040 !important; // should overlap connection endpoint overlays,not for dragged elements -> prevent "show/hide flickering" of overlays
z-index: 1040 !important; // should overlap connection endpoint overlays,not for dragged elements -> prevent "show/hide flickering" of overlays
}
}
@@ -741,7 +741,7 @@ $mapWrapperMaxWidth: $mapWidth + 35px;
// context menu =======================================================================================================
.dropdown-menu{
font-family: $font-family-bold;
z-index: 1020; // over tooltips
z-index: 1050; // over tooltips
will-change: opacity, top, left, transform;
a{