- fixed some "rubber banding" problems with system position (new "update queue" system for maps, JS)
- Decreased mapData cache 120s -> 60s - Increased default "lifetime" for "private" maps 14d -> 30d - UI tweaks for "connection <-> signature" linked labels, #290 - fixed some "drag&drop" problems with connections - Updated "jQuery" 3.0.0 => 3.1.1 - PHP7.1 fixes (routes.ini), closed #410 - fixed a bug where "mapAccess" data is not properly send through webSocket
This commit is contained in:
@@ -1119,7 +1119,7 @@ final class Base extends Prefab implements ArrayAccess {
|
||||
$time=microtime(TRUE);
|
||||
header_remove('Pragma');
|
||||
header('Cache-Control: max-age='.(int)$secs);
|
||||
header('Expires: '.gmdate('r',$time+(int)$secs));
|
||||
header('Expires: '.gmdate('r',$time+$secs));
|
||||
header('Last-Modified: '.gmdate('r'));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -577,23 +577,17 @@ class Map extends Controller\AccessController {
|
||||
* -> if characters with map access found -> broadcast mapData to them
|
||||
* @param Model\MapModel $map
|
||||
* @param array $characterIds
|
||||
* @return int
|
||||
*/
|
||||
protected function broadcastMapAccess($map, $characterIds){
|
||||
$connectionCount = 0;
|
||||
|
||||
$mapAccess = [
|
||||
'id' => $map->_id,
|
||||
'characterIds' => $characterIds
|
||||
];
|
||||
$charCount = (int)(new Socket( Config::getSocketUri() ))->sendData('mapAccess', $mapAccess);
|
||||
|
||||
if($charCount > 0){
|
||||
// map has active connections that should receive map Data
|
||||
$connectionCount = $this->broadcastMapData($map);
|
||||
}
|
||||
(new Socket( Config::getSocketUri() ))->sendData('mapAccess', $mapAccess);
|
||||
|
||||
return $connectionCount;
|
||||
// map has (probably) active connections that should receive map Data
|
||||
$this->broadcastMapData($map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,11 @@ class MapModel extends BasicModel {
|
||||
*/
|
||||
const DATA_CACHE_KEY_CHARACTER = 'CHARACTERS';
|
||||
|
||||
/**
|
||||
* default TTL for getData(); cache
|
||||
*/
|
||||
const DEFAULT_CACHE_TTL = 60;
|
||||
|
||||
protected $fieldConf = [
|
||||
'active' => [
|
||||
'type' => Schema::DT_BOOL,
|
||||
@@ -205,7 +210,7 @@ class MapModel extends BasicModel {
|
||||
// max caching time for a map
|
||||
// the cached date has to be cleared manually on any change
|
||||
// this includes system, connection,... changes (all dependencies)
|
||||
$this->updateCacheData($mapDataAll);
|
||||
$this->updateCacheData($mapDataAll, '', self::DEFAULT_CACHE_TTL);
|
||||
}
|
||||
|
||||
return $mapDataAll;
|
||||
|
||||
@@ -60,7 +60,7 @@ LOGIN = templates/view/login.html
|
||||
; - Whether user activity should be logged for a map type
|
||||
; - E.g. create/update/delete of systems/connections/signatures
|
||||
[PATHFINDER.MAP.PRIVATE]
|
||||
LIFETIME = 14
|
||||
LIFETIME = 30
|
||||
MAX_COUNT = 3
|
||||
MAX_SHARED = 10
|
||||
MAX_SYSTEMS = 50
|
||||
@@ -100,28 +100,28 @@ RALLY_SET =
|
||||
|
||||
; TIMER ===========================================================================================
|
||||
[PATHFINDER.TIMER]
|
||||
; login time (minutes)
|
||||
LOGGED = 240
|
||||
; double click timer (ms)
|
||||
; login time (minutes) (default: 480)
|
||||
LOGGED = 480
|
||||
; double click timer (milliseconds) (default: 250)
|
||||
DBL_CLICK = 250
|
||||
; time for status change visibility in header (ms)
|
||||
; time for status change visibility in header (milliseconds) (default: 5000)
|
||||
PROGRAM_STATUS_VISIBLE = 5000
|
||||
|
||||
; main map update ping (ajax) (ms)
|
||||
; main map update ping (ajax) (milliseconds)
|
||||
[PATHFINDER.TIMER.UPDATE_SERVER_MAP]
|
||||
DELAY = 5000
|
||||
EXECUTION_LIMIT = 200
|
||||
|
||||
; update client map data (ms)
|
||||
; update client map data (milliseconds)
|
||||
[PATHFINDER.TIMER.UPDATE_CLIENT_MAP]
|
||||
EXECUTION_LIMIT = 50
|
||||
|
||||
; map user update ping (ajax) (ms)
|
||||
; map user update ping (ajax) (milliseconds)
|
||||
[PATHFINDER.TIMER.UPDATE_SERVER_USER_DATA]
|
||||
DELAY = 5000
|
||||
EXECUTION_LIMIT = 500
|
||||
|
||||
; update client user data (ms)
|
||||
; update client user data (milliseconds)
|
||||
[PATHFINDER.TIMER.UPDATE_CLIENT_USER_DATA]
|
||||
EXECUTION_LIMIT = 50
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ GET @sso: /sso/@action [sync] = Controller\Ccp\Sso->
|
||||
GET @map: /map [sync] = Controller\MapController->init
|
||||
|
||||
; ajax wildcard APIs (throttled)
|
||||
GET|POST /api/@controller/@action [ajax] = Controller\Api\@controller->@action, , 512
|
||||
GET|POST /api/@controller/@action/@arg1 [ajax] = Controller\Api\@controller->@action, , 512
|
||||
GET|POST /api/@controller/@action/@arg1/@arg2 [ajax] = Controller\Api\@controller->@action, , 512
|
||||
GET|POST /api/@controller/@action [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
GET|POST /api/@controller/@action/@arg1 [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
GET|POST /api/@controller/@action/@arg1/@arg2 [ajax] = Controller\Api\@controller->@action, 0, 512
|
||||
|
||||
@@ -21,7 +21,7 @@ requirejs.config({
|
||||
mappage: './app/mappage', // initial start "map page" view
|
||||
setup: './app/setup', // initial start "setup page" view
|
||||
|
||||
jquery: 'lib/jquery-3.0.0.min', // v3.0.0 jQuery
|
||||
jquery: 'lib/jquery-3.1.1.min', // v3.1.1 jQuery
|
||||
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
|
||||
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
|
||||
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
|
||||
|
||||
@@ -15,7 +15,7 @@ define(['jquery'], function($) {
|
||||
|
||||
|
||||
// NullSec Relic sites, which can also spawn in C1, C2, C3 wormholes
|
||||
var nullSecRelicSites = {
|
||||
let nullSecRelicSites = {
|
||||
10: 'Ruined Angel Crystal Quarry',
|
||||
11: 'Ruined Angel Monument Site',
|
||||
12: 'Ruined Angel Science Outpost',
|
||||
@@ -39,7 +39,7 @@ define(['jquery'], function($) {
|
||||
};
|
||||
|
||||
// NulSec Data sites, which can also spawn in C1, C2, C3 wormholes
|
||||
var nullSecDataSites = {
|
||||
let nullSecDataSites = {
|
||||
10: 'Abandoned Research Complex DA005',
|
||||
11: 'Abandoned Research Complex DA015',
|
||||
12: 'Abandoned Research Complex DC007',
|
||||
@@ -70,7 +70,7 @@ define(['jquery'], function($) {
|
||||
|
||||
|
||||
// signature types
|
||||
var signatureTypes = {
|
||||
let signatureTypes = {
|
||||
1: { // system type (wh)
|
||||
1: { // C1 (area id)
|
||||
1: { // Combat
|
||||
|
||||
@@ -9,7 +9,7 @@ define([], function() {
|
||||
'use strict';
|
||||
|
||||
// system effects
|
||||
var systemEffects = {
|
||||
let systemEffects = {
|
||||
wh: {
|
||||
magnetar: {
|
||||
1: [
|
||||
|
||||
@@ -15,15 +15,15 @@ define([
|
||||
* Cached current "Magnetizer" object
|
||||
* @type {Magnetizer}
|
||||
*/
|
||||
var m8 = null;
|
||||
let m8 = null;
|
||||
|
||||
/**
|
||||
* init a jsPlumb (map) Element for "magnetised" function.
|
||||
* this is optional and prevents systems from being overlapped
|
||||
*/
|
||||
$.fn.initMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
var systems = mapContainer.getSystems();
|
||||
let mapContainer = this;
|
||||
let systems = mapContainer.getSystems();
|
||||
|
||||
/**
|
||||
* helper function
|
||||
@@ -32,10 +32,10 @@ define([
|
||||
* @returns {{left, top}}
|
||||
* @private
|
||||
*/
|
||||
var _offset = function(system) {
|
||||
let _offset = function(system) {
|
||||
|
||||
var _ = function(p) {
|
||||
var v = system.style[p];
|
||||
let _ = function(p) {
|
||||
let v = system.style[p];
|
||||
return parseInt(v.substring(0, v.length - 2));
|
||||
};
|
||||
|
||||
@@ -52,8 +52,8 @@ define([
|
||||
* @param o
|
||||
* @private
|
||||
*/
|
||||
var _setOffset = function(system, o) {
|
||||
var markAsUpdated = false;
|
||||
let _setOffset = function(system, o) {
|
||||
let markAsUpdated = false;
|
||||
|
||||
// new position must be within parent container
|
||||
// no negative offset!
|
||||
@@ -85,11 +85,11 @@ define([
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
var _dragFilter = function(id) {
|
||||
let _dragFilter = function(id) {
|
||||
return !$('#' + id).is('.jsPlumb_dragged, .pf-system-locked');
|
||||
};
|
||||
|
||||
var gridConstrain = function(gridX, gridY) {
|
||||
let gridConstrain = function(gridX, gridY) {
|
||||
return function(id, current, delta) {
|
||||
if( mapContainer.hasClass(MapUtil.config.mapGridClass) ){
|
||||
// active grid
|
||||
@@ -126,7 +126,7 @@ define([
|
||||
};
|
||||
|
||||
$.fn.destroyMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
let mapContainer = this;
|
||||
|
||||
// remove cached "magnetizer" instance
|
||||
m8 = null;
|
||||
@@ -137,7 +137,7 @@ define([
|
||||
* @param map
|
||||
* @param e
|
||||
*/
|
||||
var executeAtEvent = function(map, e){
|
||||
let executeAtEvent = function(map, e){
|
||||
if(m8 !== null && e ){
|
||||
m8.executeAtEvent(e);
|
||||
map.repaintEverything();
|
||||
@@ -149,7 +149,7 @@ define([
|
||||
* needs "magnetization" to be active
|
||||
* @param map
|
||||
*/
|
||||
var executeAtCenter = function(map){
|
||||
let executeAtCenter = function(map){
|
||||
if(m8 !== null){
|
||||
m8.executeAtCenter();
|
||||
map.repaintEverything();
|
||||
@@ -161,10 +161,10 @@ define([
|
||||
* -> (e.g. new systems was added)
|
||||
* @param map
|
||||
*/
|
||||
var setElements = function(map){
|
||||
let setElements = function(map){
|
||||
if(m8 !== null){
|
||||
var mapContainer = $(map.getContainer());
|
||||
var systems = mapContainer.getSystems();
|
||||
let mapContainer = $(map.getContainer());
|
||||
let systems = mapContainer.getSystems();
|
||||
m8.setElements(systems);
|
||||
|
||||
// re-arrange systems
|
||||
|
||||
@@ -78,6 +78,10 @@ define([
|
||||
// active connections per map (cache object)
|
||||
let connectionCache = {};
|
||||
|
||||
// mapIds that receive updates while they are "locked" (active timer)
|
||||
// -> those maps queue their updates until "pf:unlocked" event
|
||||
let mapUpdateQueue = [];
|
||||
|
||||
// jsPlumb config
|
||||
let globalMapConfig = {
|
||||
source: {
|
||||
@@ -456,17 +460,10 @@ define([
|
||||
|
||||
// check if system already exists
|
||||
let system = document.getElementById( systemId );
|
||||
|
||||
// just update data if system is new OR "updated" timestamp vary
|
||||
let updateSystemData = false;
|
||||
|
||||
let updated = parseInt(data.updated.updated);
|
||||
let newPosX = data.position.x + 'px';
|
||||
let newPosY = data.position.y + 'px';
|
||||
|
||||
if(!system){
|
||||
updateSystemData = true;
|
||||
|
||||
// set system name or alias
|
||||
let systemName = data.name;
|
||||
|
||||
@@ -534,87 +531,81 @@ define([
|
||||
}else{
|
||||
system = $(system);
|
||||
|
||||
if( system.data('updated') !== updated){
|
||||
// system Data has changed
|
||||
updateSystemData = true;
|
||||
// set system position
|
||||
let currentPosX = system.css('left');
|
||||
let currentPosY = system.css('top');
|
||||
|
||||
// set system position
|
||||
let currentPosX = system.css('left');
|
||||
let currentPosY = system.css('top');
|
||||
if(
|
||||
newPosX !== currentPosX ||
|
||||
newPosY !== currentPosY
|
||||
){
|
||||
// change position with animation
|
||||
system.velocity(
|
||||
{
|
||||
left: newPosX,
|
||||
top: newPosY
|
||||
},{
|
||||
easing: 'linear',
|
||||
duration: Init.animationSpeed.mapMoveSystem,
|
||||
begin: function(system){
|
||||
// hide system tooltip
|
||||
$(system).toggleSystemTooltip('hide', {});
|
||||
|
||||
if(
|
||||
newPosX !== currentPosX ||
|
||||
newPosY !== currentPosY
|
||||
){
|
||||
// change position with animation
|
||||
system.velocity(
|
||||
{
|
||||
left: newPosX,
|
||||
top: newPosY
|
||||
},{
|
||||
easing: 'linear',
|
||||
duration: Init.animationSpeed.mapMoveSystem,
|
||||
begin: function(system){
|
||||
// hide system tooltip
|
||||
$(system).toggleSystemTooltip('hide', {});
|
||||
// move them to the "top"
|
||||
$(system).updateSystemZIndex();
|
||||
},
|
||||
progress: function(){
|
||||
map.revalidate( systemId );
|
||||
},
|
||||
complete: function(system){
|
||||
// show tooltip
|
||||
$(system).toggleSystemTooltip('show', {show: true});
|
||||
|
||||
// move them to the "top"
|
||||
$(system).updateSystemZIndex();
|
||||
},
|
||||
progress: function(){
|
||||
map.revalidate( systemId );
|
||||
},
|
||||
complete: function(system){
|
||||
// show tooltip
|
||||
$(system).toggleSystemTooltip('show', {show: true});
|
||||
|
||||
map.revalidate( systemId );
|
||||
}
|
||||
map.revalidate( systemId );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// set system alias
|
||||
let alias = system.getSystemInfo(['alias']);
|
||||
// set system alias
|
||||
let alias = system.getSystemInfo(['alias']);
|
||||
|
||||
if(alias !== data.alias){
|
||||
// alias changed
|
||||
system.find('.' + config.systemHeadNameClass).editable('setValue', data.alias);
|
||||
}
|
||||
if(alias !== data.alias){
|
||||
// alias changed
|
||||
system.find('.' + config.systemHeadNameClass).editable('setValue', data.alias);
|
||||
}
|
||||
}
|
||||
|
||||
if(updateSystemData){
|
||||
// set system status
|
||||
system.setSystemStatus(data.status.name);
|
||||
system.data('id', parseInt(data.id));
|
||||
system.data('systemId', parseInt(data.systemId));
|
||||
system.data('name', data.name);
|
||||
system.data('typeId', parseInt(data.type.id));
|
||||
system.data('effect', data.effect);
|
||||
system.data('security', data.security);
|
||||
system.data('trueSec', parseFloat(data.trueSec));
|
||||
system.data('regionId', parseInt(data.region.id));
|
||||
system.data('region', data.region.name);
|
||||
system.data('constellationId', parseInt(data.constellation.id));
|
||||
system.data('constellation', data.constellation.name);
|
||||
system.data('statics', data.statics);
|
||||
system.data('updated', parseInt(data.updated.updated));
|
||||
system.attr('data-mapid', parseInt(mapContainer.data('id')));
|
||||
// set system status
|
||||
system.setSystemStatus(data.status.name);
|
||||
system.data('id', parseInt(data.id));
|
||||
system.data('systemId', parseInt(data.systemId));
|
||||
system.data('name', data.name);
|
||||
system.data('typeId', parseInt(data.type.id));
|
||||
system.data('effect', data.effect);
|
||||
system.data('security', data.security);
|
||||
system.data('trueSec', parseFloat(data.trueSec));
|
||||
system.data('regionId', parseInt(data.region.id));
|
||||
system.data('region', data.region.name);
|
||||
system.data('constellationId', parseInt(data.constellation.id));
|
||||
system.data('constellation', data.constellation.name);
|
||||
system.data('statics', data.statics);
|
||||
system.data('updated', parseInt(data.updated.updated));
|
||||
system.data('changed', false);
|
||||
system.attr('data-mapid', parseInt(mapContainer.data('id')));
|
||||
|
||||
// locked system
|
||||
if( Boolean( system.data( 'locked') ) !== data.locked ){
|
||||
system.toggleLockSystem(false, {hideNotification: true, hideCounter: true, map: map});
|
||||
}
|
||||
|
||||
// rally system
|
||||
system.setSystemRally(data.rallyUpdated, {
|
||||
poke: data.rallyPoke || false,
|
||||
hideNotification: true,
|
||||
hideCounter: true,
|
||||
});
|
||||
// locked system
|
||||
if( Boolean( system.data( 'locked') ) !== data.locked ){
|
||||
system.toggleLockSystem(false, {hideNotification: true, hideCounter: true, map: map});
|
||||
}
|
||||
|
||||
// rally system
|
||||
system.setSystemRally(data.rallyUpdated, {
|
||||
poke: data.rallyPoke || false,
|
||||
hideNotification: true,
|
||||
hideCounter: true,
|
||||
});
|
||||
|
||||
return system;
|
||||
};
|
||||
|
||||
@@ -891,51 +882,58 @@ define([
|
||||
connection.setParameter('created', newConnectionData.created);
|
||||
connection.setParameter('updated', newConnectionData.updated);
|
||||
connection.setParameter('eolUpdated', newConnectionData.eolUpdated);
|
||||
connection.setParameter('changed', false);
|
||||
|
||||
return connection;
|
||||
};
|
||||
|
||||
/**
|
||||
* draw a new map or update an existing map with all its systems and connections
|
||||
* get a mapMapElement
|
||||
* @param parentElement
|
||||
* @param mapConfig
|
||||
* @returns {*}
|
||||
*/
|
||||
let updateMap = function(parentElement, mapConfig){
|
||||
let newMapElement = (parentElement, mapConfig) => {
|
||||
let mapId = mapConfig.config.id;
|
||||
|
||||
// create map wrapper
|
||||
let mapWrapper = $('<div>', {
|
||||
class: config.mapWrapperClass
|
||||
});
|
||||
|
||||
// create new map container
|
||||
let mapContainer = $('<div>', {
|
||||
id: config.mapIdPrefix + mapId,
|
||||
class: [config.mapClass].join(' ')
|
||||
});
|
||||
|
||||
// add additional information
|
||||
mapContainer.data('id', mapId);
|
||||
|
||||
mapWrapper.append(mapContainer);
|
||||
|
||||
// append mapWrapper to parent element (at the top)
|
||||
$(parentElement).prepend(mapWrapper);
|
||||
|
||||
// set main Container for current map -> the container exists now in DOM !! very important
|
||||
mapConfig.map.setContainer( config.mapIdPrefix + mapId );
|
||||
|
||||
// set map observer
|
||||
setMapObserver(mapConfig.map);
|
||||
|
||||
return mapConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* draw a new map or update an existing map with all its systems and connections
|
||||
* @param mapConfig
|
||||
* @returns {*}
|
||||
*/
|
||||
let updateMap = function(mapConfig){
|
||||
let mapContainer = mapConfig.map.getContainer();
|
||||
|
||||
let mapId = mapConfig.config.id;
|
||||
let newSystems = 0;
|
||||
|
||||
if(mapContainer === undefined){
|
||||
// add new map
|
||||
|
||||
// create map wrapper
|
||||
let mapWrapper = $('<div>', {
|
||||
class: config.mapWrapperClass
|
||||
});
|
||||
|
||||
// create new map container
|
||||
mapContainer = $('<div>', {
|
||||
id: config.mapIdPrefix + mapConfig.config.id,
|
||||
class: [config.mapClass].join(' ')
|
||||
});
|
||||
|
||||
// add additional information
|
||||
mapContainer.data('id', mapConfig.config.id);
|
||||
|
||||
mapWrapper.append(mapContainer);
|
||||
|
||||
// append mapWrapper to parent element (at the top)
|
||||
$(parentElement).prepend(mapWrapper);
|
||||
|
||||
// set main Container for current map -> the container exists now in DOM !! very important
|
||||
mapConfig.map.setContainer( config.mapIdPrefix + mapConfig.config.id );
|
||||
|
||||
// set map observer
|
||||
setMapObserver(mapConfig.map);
|
||||
}
|
||||
|
||||
mapContainer = $(mapContainer);
|
||||
|
||||
// add additional information for this map
|
||||
@@ -949,7 +947,6 @@ define([
|
||||
mapContainer.data('updated', mapConfig.config.updated);
|
||||
}
|
||||
|
||||
|
||||
// get map data
|
||||
let mapData = mapContainer.getMapDataFromClient({forceData: false});
|
||||
|
||||
@@ -1081,6 +1078,11 @@ define([
|
||||
if(newSystems > 0){
|
||||
MagnetizerWrapper.setElements(mapConfig.map);
|
||||
}
|
||||
}else{
|
||||
// map is currently logged -> queue update for this map until unlock
|
||||
if( mapUpdateQueue.indexOf(mapId) === -1 ){
|
||||
mapUpdateQueue.push(mapId);
|
||||
}
|
||||
}
|
||||
|
||||
return mapContainer;
|
||||
@@ -1607,7 +1609,6 @@ define([
|
||||
* load context menu template for map
|
||||
*/
|
||||
let initMapContextMenu = function(){
|
||||
|
||||
let moduleConfig = {
|
||||
name: 'modules/contextmenu',
|
||||
position: $('#' + config.dynamicElementWrapperId)
|
||||
@@ -1636,7 +1637,6 @@ define([
|
||||
* load contextmenu template for connections
|
||||
*/
|
||||
let initConnectionContextMenu = function(){
|
||||
|
||||
let moduleConfig = {
|
||||
name: 'modules/contextmenu',
|
||||
position: $('#' + config.dynamicElementWrapperId)
|
||||
@@ -1674,8 +1674,8 @@ define([
|
||||
* load contextmenu template for systems
|
||||
*/
|
||||
let initSystemContextMenu = function(){
|
||||
|
||||
let systemStatus = [];
|
||||
|
||||
$.each(Init.systemStatus, function(status, statusData){
|
||||
let tempStatus = {
|
||||
subIcon: 'fa-tag',
|
||||
@@ -1719,7 +1719,6 @@ define([
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getHiddenContextMenuOptions = function(component){
|
||||
|
||||
let hiddenOptions = [];
|
||||
|
||||
if(component instanceof jsPlumb.Connection){
|
||||
@@ -1758,7 +1757,6 @@ define([
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getActiveContextMenuOptions = function(component){
|
||||
|
||||
let activeOptions = [];
|
||||
|
||||
if(component instanceof jsPlumb.Connection){
|
||||
@@ -2304,10 +2302,10 @@ define([
|
||||
|
||||
if( element.hasClass(config.systemClass) ){
|
||||
// system element
|
||||
element.data('updated', 0);
|
||||
element.data('changed', true);
|
||||
}else{
|
||||
// connection element
|
||||
this.setParameter('updated', 0);
|
||||
this.setParameter('changed', true);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -2322,10 +2320,10 @@ define([
|
||||
|
||||
if( element.hasClass(config.systemClass) ){
|
||||
// system element
|
||||
changed = (element.data('updated') === 0);
|
||||
changed = element.data('changed') || false;
|
||||
}else{
|
||||
// connection element
|
||||
changed = (this[0].getParameter('updated') === 0);
|
||||
changed = this[0].getParameter('changed') || false;
|
||||
}
|
||||
|
||||
return changed;
|
||||
@@ -2486,11 +2484,14 @@ define([
|
||||
// event after DragStop a connection or new connection ------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeDrop', function(info) {
|
||||
let connection = info.connection;
|
||||
let dropEndpoint = info.dropEndpoint;
|
||||
let sourceId = info.sourceId;
|
||||
let targetId = info.targetId;
|
||||
|
||||
// lock the target system for "click" events
|
||||
// to prevent loading system information
|
||||
let sourceSystem = $('#' + info.sourceId);
|
||||
let targetSystem = $('#' + info.targetId);
|
||||
let sourceSystem = $('#' + sourceId);
|
||||
let targetSystem = $('#' + targetId);
|
||||
sourceSystem.addClass('no-click');
|
||||
targetSystem.addClass('no-click');
|
||||
setTimeout(function(){
|
||||
@@ -2498,14 +2499,25 @@ define([
|
||||
targetSystem.removeClass('no-click');
|
||||
}, Init.timer.DBL_CLICK + 50);
|
||||
|
||||
// loop connection not allowed
|
||||
if(sourceId === targetId){
|
||||
console.warn('Source/Target systems are identical');
|
||||
return false;
|
||||
}
|
||||
|
||||
// connection can not be dropped on an endpoint that already has other connections on it
|
||||
if(dropEndpoint.connections.length > 0){
|
||||
console.warn('Endpoint already occupied');
|
||||
return false;
|
||||
}
|
||||
|
||||
// set "default" connection status only for NEW connections
|
||||
if(!connection.suspendedElement){
|
||||
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );
|
||||
}
|
||||
|
||||
// prevent multiple connections between same systems
|
||||
let connections = MapUtil.checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
|
||||
|
||||
let connections = MapUtil.checkForConnection(newJsPlumbInstance, sourceId, targetId);
|
||||
if(connections.length > 1){
|
||||
bootbox.confirm('Connection already exists. Do you really want to add an additional one?', function(result) {
|
||||
if(!result){
|
||||
@@ -2520,7 +2532,12 @@ define([
|
||||
return true;
|
||||
});
|
||||
|
||||
// event before Detach connection ---------------------------------------------------------------
|
||||
// event before detach (existing connection) ----------------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeStartDetach', function(info) {
|
||||
return true;
|
||||
});
|
||||
|
||||
// event before detach connection ---------------------------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeDetach', function(info) {
|
||||
return true;
|
||||
});
|
||||
@@ -2532,10 +2549,12 @@ define([
|
||||
});
|
||||
|
||||
newJsPlumbInstance.bind('checkDropAllowed', function(params){
|
||||
// connections can not be attached to foreign endpoints
|
||||
// the only endpoint available is endpoint from where the connection was dragged away (re-attach)
|
||||
let sourceEndpoint = params.sourceEndpoint;
|
||||
let targetEndpoint = params.targetEndpoint;
|
||||
|
||||
return true;
|
||||
// connections can not be attached to foreign endpoints
|
||||
// the only endpoint available is the endpoint from where the connection was dragged away (re-attach)
|
||||
return (targetEndpoint.connections.length === 0);
|
||||
});
|
||||
|
||||
activeInstances[mapId] = newJsPlumbInstance;
|
||||
@@ -2549,11 +2568,10 @@ define([
|
||||
* @param map
|
||||
*/
|
||||
let setMapObserver = function(map){
|
||||
|
||||
// get map container
|
||||
let mapContainer = map.getContainer();
|
||||
let mapContainer = $( map.getContainer() );
|
||||
|
||||
$(mapContainer).bind('contextmenu', function(e){
|
||||
mapContainer.bind('contextmenu', function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -2571,7 +2589,7 @@ define([
|
||||
return false;
|
||||
});
|
||||
|
||||
$(mapContainer).contextMenu({
|
||||
mapContainer.contextMenu({
|
||||
menuSelector: '#' + config.mapContextMenuId,
|
||||
menuSelected: function (params) {
|
||||
|
||||
@@ -2674,11 +2692,11 @@ define([
|
||||
});
|
||||
|
||||
// init drag-frame selection
|
||||
$(mapContainer).dragToSelect({
|
||||
mapContainer.dragToSelect({
|
||||
selectOnMove: true,
|
||||
selectables: '.' + config.systemClass,
|
||||
onHide: function (selectBox, deselectedSystems) {
|
||||
let selectedSystems = $(mapContainer).getSelectedSystems();
|
||||
let selectedSystems = mapContainer.getSelectedSystems();
|
||||
|
||||
if(selectedSystems.length > 0){
|
||||
// make all selected systems draggable
|
||||
@@ -2702,10 +2720,10 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
// catch events =========================================================
|
||||
// catch events =====================================================================================
|
||||
|
||||
// toggle global map option (e.g. "grid snap", "magnetization")
|
||||
$(mapContainer).on('pf:menuMapOption', function(e, mapOption){
|
||||
mapContainer.on('pf:menuMapOption', function(e, mapOption){
|
||||
let mapElement = $(this);
|
||||
|
||||
// get map menu config options
|
||||
@@ -2780,11 +2798,12 @@ define([
|
||||
|
||||
// delete system event
|
||||
// triggered from "map info" dialog scope
|
||||
$(mapContainer).on('pf:deleteSystems', function(e, data){
|
||||
mapContainer.on('pf:deleteSystems', function(e, data){
|
||||
System.deleteSystems(map, data.systems, data.callback);
|
||||
});
|
||||
|
||||
$(mapContainer).on('pf:menuSelectSystem', function(e, data){
|
||||
// triggered from "header" link (if user is active in one of the systems)
|
||||
mapContainer.on('pf:menuSelectSystem', function(e, data){
|
||||
let tempMapContainer = $(this);
|
||||
let systemId = MapUtil.getSystemId(tempMapContainer.data('id'), data.systemId);
|
||||
let system = $(this).find('#' + systemId);
|
||||
@@ -2798,6 +2817,27 @@ define([
|
||||
system.showSystemInfo(map);
|
||||
}
|
||||
});
|
||||
|
||||
// triggered when map lock timer (interval) was cleared
|
||||
mapContainer.on('pf:unlocked', function(){
|
||||
let mapElement = $(this);
|
||||
let mapId = mapElement.data('id');
|
||||
|
||||
// check if there was a mapUpdate during map was locked
|
||||
let mapQueueIndex = mapUpdateQueue.indexOf(mapId);
|
||||
if(mapQueueIndex !== -1){
|
||||
// get current mapConfig
|
||||
let mapConfig = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(mapConfig){
|
||||
// map data is available => update map
|
||||
updateMap(mapConfig);
|
||||
}
|
||||
|
||||
// update done -> clear mapId from mapUpdateQueue
|
||||
mapUpdateQueue.splice(mapQueueIndex, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3020,16 +3060,11 @@ define([
|
||||
*/
|
||||
$.fn.getMapDataFromClient = function(options){
|
||||
let mapElement = $(this);
|
||||
|
||||
let map = getMapInstance( mapElement.data('id') );
|
||||
|
||||
let mapData = {};
|
||||
|
||||
// check if there is an active map counter that prevents collecting map data
|
||||
let overlay = mapElement.getMapOverlay('timer');
|
||||
let counterChart = overlay.getMapCounter();
|
||||
|
||||
let interval = counterChart.data('interval');
|
||||
// check if there is an active map counter that prevents collecting map data (locked map)
|
||||
let interval = mapElement.getMapOverlayInterval();
|
||||
|
||||
if(
|
||||
! interval ||
|
||||
@@ -3188,7 +3223,6 @@ define([
|
||||
* @param options
|
||||
*/
|
||||
$.fn.loadMap = function(mapConfig, options){
|
||||
|
||||
// parent element where the map will be loaded
|
||||
let parentElement = $(this);
|
||||
|
||||
@@ -3197,9 +3231,6 @@ define([
|
||||
initConnectionContextMenu();
|
||||
initSystemContextMenu();
|
||||
|
||||
// new map init
|
||||
let newMap = false;
|
||||
|
||||
// init jsPlumb
|
||||
jsPlumb.ready(function() {
|
||||
// get new map instance or load existing
|
||||
@@ -3208,13 +3239,8 @@ define([
|
||||
// check for map Container -> first time initialization
|
||||
if(mapConfig.map.getContainer() === undefined){
|
||||
// new map instance
|
||||
newMap = true;
|
||||
}
|
||||
mapConfig = newMapElement(parentElement, mapConfig);
|
||||
|
||||
// draw/update map initial map and set container
|
||||
let mapContainer = updateMap(parentElement, mapConfig);
|
||||
|
||||
if(newMap){
|
||||
// init custom scrollbars and add overlay
|
||||
parentElement.initMapScrollbar();
|
||||
|
||||
@@ -3226,6 +3252,9 @@ define([
|
||||
mapOverlay.updateOverlayIcon('connectionEol', 'show');
|
||||
}
|
||||
|
||||
// draw/update map initial map and set container
|
||||
let mapContainer = updateMap(mapConfig);
|
||||
|
||||
// callback function after tab switch
|
||||
function switchTabCallback( mapName, mapContainer ){
|
||||
Util.showNotify({title: 'Map initialized', text: mapName + ' - loaded', type: 'success'});
|
||||
|
||||
@@ -91,7 +91,10 @@ define([
|
||||
if(label.length > 0){
|
||||
newLabel = label;
|
||||
|
||||
if( !label.includes('K162') ){
|
||||
// check if multiple labels found => conflict
|
||||
if( label.includes(', ') ){
|
||||
colorClass = 'txt-color-orangeLight';
|
||||
}else if( !label.includes('K162') ){
|
||||
colorClass = 'txt-color-yellow';
|
||||
}
|
||||
}else{
|
||||
@@ -570,14 +573,15 @@ define([
|
||||
};
|
||||
|
||||
/**
|
||||
* get the map counter chart by an overlay
|
||||
* @returns {*}
|
||||
* get the map counter chart from overlay
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getMapCounter = function(){
|
||||
return $(this).find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
};
|
||||
|
||||
let mapOverlayTimer = $(this);
|
||||
|
||||
return mapOverlayTimer.find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
$.fn.getMapOverlayInterval = function(){
|
||||
return $(this).getMapOverlay('timer').getMapCounter().data('interval');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -622,6 +626,7 @@ define([
|
||||
duration: Init.animationSpeed.mapOverlay,
|
||||
complete: function(){
|
||||
counterChart.data('interval', false);
|
||||
getMapElementFromOverlay(mapOverlayTimer).trigger('pf:unlocked');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ define([
|
||||
$.fn.initCustomScrollbar = function(config){
|
||||
|
||||
// default config -------------------------------------------------------------------------
|
||||
var defaultConfig = {
|
||||
let defaultConfig = {
|
||||
axis: 'x',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 300,
|
||||
@@ -52,7 +52,7 @@ define([
|
||||
config = $.extend(true, {}, defaultConfig, config);
|
||||
|
||||
return this.each(function(){
|
||||
var scrollableElement = $(this);
|
||||
let scrollableElement = $(this);
|
||||
|
||||
// prevent multiple initialization
|
||||
scrollableElement.mCustomScrollbar('destroy');
|
||||
|
||||
@@ -56,16 +56,14 @@ define([
|
||||
};
|
||||
|
||||
/**
|
||||
* get the current active map for
|
||||
* @returns {*}
|
||||
* get the current active mapElement
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getActiveMap = function(){
|
||||
let map = $(this).find('.active.' + config.mapTabContentClass + ' .' + config.mapClass);
|
||||
|
||||
if(map.length === 0){
|
||||
if(!map.length){
|
||||
map = false;
|
||||
}
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
@@ -563,7 +561,7 @@ define([
|
||||
activeMapIds.push(mapId);
|
||||
|
||||
// check for map data change and update tab
|
||||
if(tabMapData.config.updated !== tabElement.data('updated')){
|
||||
if(tabMapData.config.updated > tabElement.data('updated')){
|
||||
tabElement.updateTabData(tabMapData.config);
|
||||
}
|
||||
}else{
|
||||
@@ -631,7 +629,6 @@ define([
|
||||
|
||||
// add new tab for each map
|
||||
for(let j = 0; j < tempMapData.length; j++){
|
||||
|
||||
let data = tempMapData[j];
|
||||
tabMapElement.addTab(data.config);
|
||||
}
|
||||
|
||||
@@ -1252,9 +1252,7 @@ define([
|
||||
* @returns {JQuery|*|{}|T}
|
||||
*/
|
||||
$.fn.getMapTabElements = function(mapId){
|
||||
|
||||
let mapModuleElement = $(this);
|
||||
|
||||
let mapTabElements = mapModuleElement.find('#' + config.mapTabBarId).find('a');
|
||||
|
||||
if(mapId){
|
||||
|
||||
4
js/lib/jquery-3.0.0.min.js
vendored
4
js/lib/jquery-3.0.0.min.js
vendored
File diff suppressed because one or more lines are too long
4
js/lib/jquery-3.1.1.min.js
vendored
Normal file
4
js/lib/jquery-3.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@ requirejs.config({
|
||||
mappage: './app/mappage', // initial start "map page" view
|
||||
setup: './app/setup', // initial start "setup page" view
|
||||
|
||||
jquery: 'lib/jquery-3.0.0.min', // v3.0.0 jQuery
|
||||
jquery: 'lib/jquery-3.1.1.min', // v3.1.1 jQuery
|
||||
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
|
||||
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
|
||||
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
|
||||
|
||||
@@ -15,7 +15,7 @@ define(['jquery'], function($) {
|
||||
|
||||
|
||||
// NullSec Relic sites, which can also spawn in C1, C2, C3 wormholes
|
||||
var nullSecRelicSites = {
|
||||
let nullSecRelicSites = {
|
||||
10: 'Ruined Angel Crystal Quarry',
|
||||
11: 'Ruined Angel Monument Site',
|
||||
12: 'Ruined Angel Science Outpost',
|
||||
@@ -39,7 +39,7 @@ define(['jquery'], function($) {
|
||||
};
|
||||
|
||||
// NulSec Data sites, which can also spawn in C1, C2, C3 wormholes
|
||||
var nullSecDataSites = {
|
||||
let nullSecDataSites = {
|
||||
10: 'Abandoned Research Complex DA005',
|
||||
11: 'Abandoned Research Complex DA015',
|
||||
12: 'Abandoned Research Complex DC007',
|
||||
@@ -70,7 +70,7 @@ define(['jquery'], function($) {
|
||||
|
||||
|
||||
// signature types
|
||||
var signatureTypes = {
|
||||
let signatureTypes = {
|
||||
1: { // system type (wh)
|
||||
1: { // C1 (area id)
|
||||
1: { // Combat
|
||||
|
||||
@@ -9,7 +9,7 @@ define([], function() {
|
||||
'use strict';
|
||||
|
||||
// system effects
|
||||
var systemEffects = {
|
||||
let systemEffects = {
|
||||
wh: {
|
||||
magnetar: {
|
||||
1: [
|
||||
|
||||
@@ -15,15 +15,15 @@ define([
|
||||
* Cached current "Magnetizer" object
|
||||
* @type {Magnetizer}
|
||||
*/
|
||||
var m8 = null;
|
||||
let m8 = null;
|
||||
|
||||
/**
|
||||
* init a jsPlumb (map) Element for "magnetised" function.
|
||||
* this is optional and prevents systems from being overlapped
|
||||
*/
|
||||
$.fn.initMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
var systems = mapContainer.getSystems();
|
||||
let mapContainer = this;
|
||||
let systems = mapContainer.getSystems();
|
||||
|
||||
/**
|
||||
* helper function
|
||||
@@ -32,10 +32,10 @@ define([
|
||||
* @returns {{left, top}}
|
||||
* @private
|
||||
*/
|
||||
var _offset = function(system) {
|
||||
let _offset = function(system) {
|
||||
|
||||
var _ = function(p) {
|
||||
var v = system.style[p];
|
||||
let _ = function(p) {
|
||||
let v = system.style[p];
|
||||
return parseInt(v.substring(0, v.length - 2));
|
||||
};
|
||||
|
||||
@@ -52,8 +52,8 @@ define([
|
||||
* @param o
|
||||
* @private
|
||||
*/
|
||||
var _setOffset = function(system, o) {
|
||||
var markAsUpdated = false;
|
||||
let _setOffset = function(system, o) {
|
||||
let markAsUpdated = false;
|
||||
|
||||
// new position must be within parent container
|
||||
// no negative offset!
|
||||
@@ -85,11 +85,11 @@ define([
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
var _dragFilter = function(id) {
|
||||
let _dragFilter = function(id) {
|
||||
return !$('#' + id).is('.jsPlumb_dragged, .pf-system-locked');
|
||||
};
|
||||
|
||||
var gridConstrain = function(gridX, gridY) {
|
||||
let gridConstrain = function(gridX, gridY) {
|
||||
return function(id, current, delta) {
|
||||
if( mapContainer.hasClass(MapUtil.config.mapGridClass) ){
|
||||
// active grid
|
||||
@@ -126,7 +126,7 @@ define([
|
||||
};
|
||||
|
||||
$.fn.destroyMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
let mapContainer = this;
|
||||
|
||||
// remove cached "magnetizer" instance
|
||||
m8 = null;
|
||||
@@ -137,7 +137,7 @@ define([
|
||||
* @param map
|
||||
* @param e
|
||||
*/
|
||||
var executeAtEvent = function(map, e){
|
||||
let executeAtEvent = function(map, e){
|
||||
if(m8 !== null && e ){
|
||||
m8.executeAtEvent(e);
|
||||
map.repaintEverything();
|
||||
@@ -149,7 +149,7 @@ define([
|
||||
* needs "magnetization" to be active
|
||||
* @param map
|
||||
*/
|
||||
var executeAtCenter = function(map){
|
||||
let executeAtCenter = function(map){
|
||||
if(m8 !== null){
|
||||
m8.executeAtCenter();
|
||||
map.repaintEverything();
|
||||
@@ -161,10 +161,10 @@ define([
|
||||
* -> (e.g. new systems was added)
|
||||
* @param map
|
||||
*/
|
||||
var setElements = function(map){
|
||||
let setElements = function(map){
|
||||
if(m8 !== null){
|
||||
var mapContainer = $(map.getContainer());
|
||||
var systems = mapContainer.getSystems();
|
||||
let mapContainer = $(map.getContainer());
|
||||
let systems = mapContainer.getSystems();
|
||||
m8.setElements(systems);
|
||||
|
||||
// re-arrange systems
|
||||
|
||||
@@ -78,6 +78,10 @@ define([
|
||||
// active connections per map (cache object)
|
||||
let connectionCache = {};
|
||||
|
||||
// mapIds that receive updates while they are "locked" (active timer)
|
||||
// -> those maps queue their updates until "pf:unlocked" event
|
||||
let mapUpdateQueue = [];
|
||||
|
||||
// jsPlumb config
|
||||
let globalMapConfig = {
|
||||
source: {
|
||||
@@ -456,17 +460,10 @@ define([
|
||||
|
||||
// check if system already exists
|
||||
let system = document.getElementById( systemId );
|
||||
|
||||
// just update data if system is new OR "updated" timestamp vary
|
||||
let updateSystemData = false;
|
||||
|
||||
let updated = parseInt(data.updated.updated);
|
||||
let newPosX = data.position.x + 'px';
|
||||
let newPosY = data.position.y + 'px';
|
||||
|
||||
if(!system){
|
||||
updateSystemData = true;
|
||||
|
||||
// set system name or alias
|
||||
let systemName = data.name;
|
||||
|
||||
@@ -534,87 +531,81 @@ define([
|
||||
}else{
|
||||
system = $(system);
|
||||
|
||||
if( system.data('updated') !== updated){
|
||||
// system Data has changed
|
||||
updateSystemData = true;
|
||||
// set system position
|
||||
let currentPosX = system.css('left');
|
||||
let currentPosY = system.css('top');
|
||||
|
||||
// set system position
|
||||
let currentPosX = system.css('left');
|
||||
let currentPosY = system.css('top');
|
||||
if(
|
||||
newPosX !== currentPosX ||
|
||||
newPosY !== currentPosY
|
||||
){
|
||||
// change position with animation
|
||||
system.velocity(
|
||||
{
|
||||
left: newPosX,
|
||||
top: newPosY
|
||||
},{
|
||||
easing: 'linear',
|
||||
duration: Init.animationSpeed.mapMoveSystem,
|
||||
begin: function(system){
|
||||
// hide system tooltip
|
||||
$(system).toggleSystemTooltip('hide', {});
|
||||
|
||||
if(
|
||||
newPosX !== currentPosX ||
|
||||
newPosY !== currentPosY
|
||||
){
|
||||
// change position with animation
|
||||
system.velocity(
|
||||
{
|
||||
left: newPosX,
|
||||
top: newPosY
|
||||
},{
|
||||
easing: 'linear',
|
||||
duration: Init.animationSpeed.mapMoveSystem,
|
||||
begin: function(system){
|
||||
// hide system tooltip
|
||||
$(system).toggleSystemTooltip('hide', {});
|
||||
// move them to the "top"
|
||||
$(system).updateSystemZIndex();
|
||||
},
|
||||
progress: function(){
|
||||
map.revalidate( systemId );
|
||||
},
|
||||
complete: function(system){
|
||||
// show tooltip
|
||||
$(system).toggleSystemTooltip('show', {show: true});
|
||||
|
||||
// move them to the "top"
|
||||
$(system).updateSystemZIndex();
|
||||
},
|
||||
progress: function(){
|
||||
map.revalidate( systemId );
|
||||
},
|
||||
complete: function(system){
|
||||
// show tooltip
|
||||
$(system).toggleSystemTooltip('show', {show: true});
|
||||
|
||||
map.revalidate( systemId );
|
||||
}
|
||||
map.revalidate( systemId );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// set system alias
|
||||
let alias = system.getSystemInfo(['alias']);
|
||||
// set system alias
|
||||
let alias = system.getSystemInfo(['alias']);
|
||||
|
||||
if(alias !== data.alias){
|
||||
// alias changed
|
||||
system.find('.' + config.systemHeadNameClass).editable('setValue', data.alias);
|
||||
}
|
||||
if(alias !== data.alias){
|
||||
// alias changed
|
||||
system.find('.' + config.systemHeadNameClass).editable('setValue', data.alias);
|
||||
}
|
||||
}
|
||||
|
||||
if(updateSystemData){
|
||||
// set system status
|
||||
system.setSystemStatus(data.status.name);
|
||||
system.data('id', parseInt(data.id));
|
||||
system.data('systemId', parseInt(data.systemId));
|
||||
system.data('name', data.name);
|
||||
system.data('typeId', parseInt(data.type.id));
|
||||
system.data('effect', data.effect);
|
||||
system.data('security', data.security);
|
||||
system.data('trueSec', parseFloat(data.trueSec));
|
||||
system.data('regionId', parseInt(data.region.id));
|
||||
system.data('region', data.region.name);
|
||||
system.data('constellationId', parseInt(data.constellation.id));
|
||||
system.data('constellation', data.constellation.name);
|
||||
system.data('statics', data.statics);
|
||||
system.data('updated', parseInt(data.updated.updated));
|
||||
system.attr('data-mapid', parseInt(mapContainer.data('id')));
|
||||
// set system status
|
||||
system.setSystemStatus(data.status.name);
|
||||
system.data('id', parseInt(data.id));
|
||||
system.data('systemId', parseInt(data.systemId));
|
||||
system.data('name', data.name);
|
||||
system.data('typeId', parseInt(data.type.id));
|
||||
system.data('effect', data.effect);
|
||||
system.data('security', data.security);
|
||||
system.data('trueSec', parseFloat(data.trueSec));
|
||||
system.data('regionId', parseInt(data.region.id));
|
||||
system.data('region', data.region.name);
|
||||
system.data('constellationId', parseInt(data.constellation.id));
|
||||
system.data('constellation', data.constellation.name);
|
||||
system.data('statics', data.statics);
|
||||
system.data('updated', parseInt(data.updated.updated));
|
||||
system.data('changed', false);
|
||||
system.attr('data-mapid', parseInt(mapContainer.data('id')));
|
||||
|
||||
// locked system
|
||||
if( Boolean( system.data( 'locked') ) !== data.locked ){
|
||||
system.toggleLockSystem(false, {hideNotification: true, hideCounter: true, map: map});
|
||||
}
|
||||
|
||||
// rally system
|
||||
system.setSystemRally(data.rallyUpdated, {
|
||||
poke: data.rallyPoke || false,
|
||||
hideNotification: true,
|
||||
hideCounter: true,
|
||||
});
|
||||
// locked system
|
||||
if( Boolean( system.data( 'locked') ) !== data.locked ){
|
||||
system.toggleLockSystem(false, {hideNotification: true, hideCounter: true, map: map});
|
||||
}
|
||||
|
||||
// rally system
|
||||
system.setSystemRally(data.rallyUpdated, {
|
||||
poke: data.rallyPoke || false,
|
||||
hideNotification: true,
|
||||
hideCounter: true,
|
||||
});
|
||||
|
||||
return system;
|
||||
};
|
||||
|
||||
@@ -891,51 +882,58 @@ define([
|
||||
connection.setParameter('created', newConnectionData.created);
|
||||
connection.setParameter('updated', newConnectionData.updated);
|
||||
connection.setParameter('eolUpdated', newConnectionData.eolUpdated);
|
||||
connection.setParameter('changed', false);
|
||||
|
||||
return connection;
|
||||
};
|
||||
|
||||
/**
|
||||
* draw a new map or update an existing map with all its systems and connections
|
||||
* get a mapMapElement
|
||||
* @param parentElement
|
||||
* @param mapConfig
|
||||
* @returns {*}
|
||||
*/
|
||||
let updateMap = function(parentElement, mapConfig){
|
||||
let newMapElement = (parentElement, mapConfig) => {
|
||||
let mapId = mapConfig.config.id;
|
||||
|
||||
// create map wrapper
|
||||
let mapWrapper = $('<div>', {
|
||||
class: config.mapWrapperClass
|
||||
});
|
||||
|
||||
// create new map container
|
||||
let mapContainer = $('<div>', {
|
||||
id: config.mapIdPrefix + mapId,
|
||||
class: [config.mapClass].join(' ')
|
||||
});
|
||||
|
||||
// add additional information
|
||||
mapContainer.data('id', mapId);
|
||||
|
||||
mapWrapper.append(mapContainer);
|
||||
|
||||
// append mapWrapper to parent element (at the top)
|
||||
$(parentElement).prepend(mapWrapper);
|
||||
|
||||
// set main Container for current map -> the container exists now in DOM !! very important
|
||||
mapConfig.map.setContainer( config.mapIdPrefix + mapId );
|
||||
|
||||
// set map observer
|
||||
setMapObserver(mapConfig.map);
|
||||
|
||||
return mapConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* draw a new map or update an existing map with all its systems and connections
|
||||
* @param mapConfig
|
||||
* @returns {*}
|
||||
*/
|
||||
let updateMap = function(mapConfig){
|
||||
let mapContainer = mapConfig.map.getContainer();
|
||||
|
||||
let mapId = mapConfig.config.id;
|
||||
let newSystems = 0;
|
||||
|
||||
if(mapContainer === undefined){
|
||||
// add new map
|
||||
|
||||
// create map wrapper
|
||||
let mapWrapper = $('<div>', {
|
||||
class: config.mapWrapperClass
|
||||
});
|
||||
|
||||
// create new map container
|
||||
mapContainer = $('<div>', {
|
||||
id: config.mapIdPrefix + mapConfig.config.id,
|
||||
class: [config.mapClass].join(' ')
|
||||
});
|
||||
|
||||
// add additional information
|
||||
mapContainer.data('id', mapConfig.config.id);
|
||||
|
||||
mapWrapper.append(mapContainer);
|
||||
|
||||
// append mapWrapper to parent element (at the top)
|
||||
$(parentElement).prepend(mapWrapper);
|
||||
|
||||
// set main Container for current map -> the container exists now in DOM !! very important
|
||||
mapConfig.map.setContainer( config.mapIdPrefix + mapConfig.config.id );
|
||||
|
||||
// set map observer
|
||||
setMapObserver(mapConfig.map);
|
||||
}
|
||||
|
||||
mapContainer = $(mapContainer);
|
||||
|
||||
// add additional information for this map
|
||||
@@ -949,7 +947,6 @@ define([
|
||||
mapContainer.data('updated', mapConfig.config.updated);
|
||||
}
|
||||
|
||||
|
||||
// get map data
|
||||
let mapData = mapContainer.getMapDataFromClient({forceData: false});
|
||||
|
||||
@@ -1081,6 +1078,11 @@ define([
|
||||
if(newSystems > 0){
|
||||
MagnetizerWrapper.setElements(mapConfig.map);
|
||||
}
|
||||
}else{
|
||||
// map is currently logged -> queue update for this map until unlock
|
||||
if( mapUpdateQueue.indexOf(mapId) === -1 ){
|
||||
mapUpdateQueue.push(mapId);
|
||||
}
|
||||
}
|
||||
|
||||
return mapContainer;
|
||||
@@ -1607,7 +1609,6 @@ define([
|
||||
* load context menu template for map
|
||||
*/
|
||||
let initMapContextMenu = function(){
|
||||
|
||||
let moduleConfig = {
|
||||
name: 'modules/contextmenu',
|
||||
position: $('#' + config.dynamicElementWrapperId)
|
||||
@@ -1636,7 +1637,6 @@ define([
|
||||
* load contextmenu template for connections
|
||||
*/
|
||||
let initConnectionContextMenu = function(){
|
||||
|
||||
let moduleConfig = {
|
||||
name: 'modules/contextmenu',
|
||||
position: $('#' + config.dynamicElementWrapperId)
|
||||
@@ -1674,8 +1674,8 @@ define([
|
||||
* load contextmenu template for systems
|
||||
*/
|
||||
let initSystemContextMenu = function(){
|
||||
|
||||
let systemStatus = [];
|
||||
|
||||
$.each(Init.systemStatus, function(status, statusData){
|
||||
let tempStatus = {
|
||||
subIcon: 'fa-tag',
|
||||
@@ -1719,7 +1719,6 @@ define([
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getHiddenContextMenuOptions = function(component){
|
||||
|
||||
let hiddenOptions = [];
|
||||
|
||||
if(component instanceof jsPlumb.Connection){
|
||||
@@ -1758,7 +1757,6 @@ define([
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getActiveContextMenuOptions = function(component){
|
||||
|
||||
let activeOptions = [];
|
||||
|
||||
if(component instanceof jsPlumb.Connection){
|
||||
@@ -2304,10 +2302,10 @@ define([
|
||||
|
||||
if( element.hasClass(config.systemClass) ){
|
||||
// system element
|
||||
element.data('updated', 0);
|
||||
element.data('changed', true);
|
||||
}else{
|
||||
// connection element
|
||||
this.setParameter('updated', 0);
|
||||
this.setParameter('changed', true);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -2322,10 +2320,10 @@ define([
|
||||
|
||||
if( element.hasClass(config.systemClass) ){
|
||||
// system element
|
||||
changed = (element.data('updated') === 0);
|
||||
changed = element.data('changed') || false;
|
||||
}else{
|
||||
// connection element
|
||||
changed = (this[0].getParameter('updated') === 0);
|
||||
changed = this[0].getParameter('changed') || false;
|
||||
}
|
||||
|
||||
return changed;
|
||||
@@ -2486,11 +2484,14 @@ define([
|
||||
// event after DragStop a connection or new connection ------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeDrop', function(info) {
|
||||
let connection = info.connection;
|
||||
let dropEndpoint = info.dropEndpoint;
|
||||
let sourceId = info.sourceId;
|
||||
let targetId = info.targetId;
|
||||
|
||||
// lock the target system for "click" events
|
||||
// to prevent loading system information
|
||||
let sourceSystem = $('#' + info.sourceId);
|
||||
let targetSystem = $('#' + info.targetId);
|
||||
let sourceSystem = $('#' + sourceId);
|
||||
let targetSystem = $('#' + targetId);
|
||||
sourceSystem.addClass('no-click');
|
||||
targetSystem.addClass('no-click');
|
||||
setTimeout(function(){
|
||||
@@ -2498,14 +2499,25 @@ define([
|
||||
targetSystem.removeClass('no-click');
|
||||
}, Init.timer.DBL_CLICK + 50);
|
||||
|
||||
// loop connection not allowed
|
||||
if(sourceId === targetId){
|
||||
console.warn('Source/Target systems are identical');
|
||||
return false;
|
||||
}
|
||||
|
||||
// connection can not be dropped on an endpoint that already has other connections on it
|
||||
if(dropEndpoint.connections.length > 0){
|
||||
console.warn('Endpoint already occupied');
|
||||
return false;
|
||||
}
|
||||
|
||||
// set "default" connection status only for NEW connections
|
||||
if(!connection.suspendedElement){
|
||||
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );
|
||||
}
|
||||
|
||||
// prevent multiple connections between same systems
|
||||
let connections = MapUtil.checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
|
||||
|
||||
let connections = MapUtil.checkForConnection(newJsPlumbInstance, sourceId, targetId);
|
||||
if(connections.length > 1){
|
||||
bootbox.confirm('Connection already exists. Do you really want to add an additional one?', function(result) {
|
||||
if(!result){
|
||||
@@ -2520,7 +2532,12 @@ define([
|
||||
return true;
|
||||
});
|
||||
|
||||
// event before Detach connection ---------------------------------------------------------------
|
||||
// event before detach (existing connection) ----------------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeStartDetach', function(info) {
|
||||
return true;
|
||||
});
|
||||
|
||||
// event before detach connection ---------------------------------------------------------------
|
||||
newJsPlumbInstance.bind('beforeDetach', function(info) {
|
||||
return true;
|
||||
});
|
||||
@@ -2532,10 +2549,12 @@ define([
|
||||
});
|
||||
|
||||
newJsPlumbInstance.bind('checkDropAllowed', function(params){
|
||||
// connections can not be attached to foreign endpoints
|
||||
// the only endpoint available is endpoint from where the connection was dragged away (re-attach)
|
||||
let sourceEndpoint = params.sourceEndpoint;
|
||||
let targetEndpoint = params.targetEndpoint;
|
||||
|
||||
return true;
|
||||
// connections can not be attached to foreign endpoints
|
||||
// the only endpoint available is the endpoint from where the connection was dragged away (re-attach)
|
||||
return (targetEndpoint.connections.length === 0);
|
||||
});
|
||||
|
||||
activeInstances[mapId] = newJsPlumbInstance;
|
||||
@@ -2549,11 +2568,10 @@ define([
|
||||
* @param map
|
||||
*/
|
||||
let setMapObserver = function(map){
|
||||
|
||||
// get map container
|
||||
let mapContainer = map.getContainer();
|
||||
let mapContainer = $( map.getContainer() );
|
||||
|
||||
$(mapContainer).bind('contextmenu', function(e){
|
||||
mapContainer.bind('contextmenu', function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -2571,7 +2589,7 @@ define([
|
||||
return false;
|
||||
});
|
||||
|
||||
$(mapContainer).contextMenu({
|
||||
mapContainer.contextMenu({
|
||||
menuSelector: '#' + config.mapContextMenuId,
|
||||
menuSelected: function (params) {
|
||||
|
||||
@@ -2674,11 +2692,11 @@ define([
|
||||
});
|
||||
|
||||
// init drag-frame selection
|
||||
$(mapContainer).dragToSelect({
|
||||
mapContainer.dragToSelect({
|
||||
selectOnMove: true,
|
||||
selectables: '.' + config.systemClass,
|
||||
onHide: function (selectBox, deselectedSystems) {
|
||||
let selectedSystems = $(mapContainer).getSelectedSystems();
|
||||
let selectedSystems = mapContainer.getSelectedSystems();
|
||||
|
||||
if(selectedSystems.length > 0){
|
||||
// make all selected systems draggable
|
||||
@@ -2702,10 +2720,10 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
// catch events =========================================================
|
||||
// catch events =====================================================================================
|
||||
|
||||
// toggle global map option (e.g. "grid snap", "magnetization")
|
||||
$(mapContainer).on('pf:menuMapOption', function(e, mapOption){
|
||||
mapContainer.on('pf:menuMapOption', function(e, mapOption){
|
||||
let mapElement = $(this);
|
||||
|
||||
// get map menu config options
|
||||
@@ -2780,11 +2798,12 @@ define([
|
||||
|
||||
// delete system event
|
||||
// triggered from "map info" dialog scope
|
||||
$(mapContainer).on('pf:deleteSystems', function(e, data){
|
||||
mapContainer.on('pf:deleteSystems', function(e, data){
|
||||
System.deleteSystems(map, data.systems, data.callback);
|
||||
});
|
||||
|
||||
$(mapContainer).on('pf:menuSelectSystem', function(e, data){
|
||||
// triggered from "header" link (if user is active in one of the systems)
|
||||
mapContainer.on('pf:menuSelectSystem', function(e, data){
|
||||
let tempMapContainer = $(this);
|
||||
let systemId = MapUtil.getSystemId(tempMapContainer.data('id'), data.systemId);
|
||||
let system = $(this).find('#' + systemId);
|
||||
@@ -2798,6 +2817,27 @@ define([
|
||||
system.showSystemInfo(map);
|
||||
}
|
||||
});
|
||||
|
||||
// triggered when map lock timer (interval) was cleared
|
||||
mapContainer.on('pf:unlocked', function(){
|
||||
let mapElement = $(this);
|
||||
let mapId = mapElement.data('id');
|
||||
|
||||
// check if there was a mapUpdate during map was locked
|
||||
let mapQueueIndex = mapUpdateQueue.indexOf(mapId);
|
||||
if(mapQueueIndex !== -1){
|
||||
// get current mapConfig
|
||||
let mapConfig = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(mapConfig){
|
||||
// map data is available => update map
|
||||
updateMap(mapConfig);
|
||||
}
|
||||
|
||||
// update done -> clear mapId from mapUpdateQueue
|
||||
mapUpdateQueue.splice(mapQueueIndex, 1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3020,16 +3060,11 @@ define([
|
||||
*/
|
||||
$.fn.getMapDataFromClient = function(options){
|
||||
let mapElement = $(this);
|
||||
|
||||
let map = getMapInstance( mapElement.data('id') );
|
||||
|
||||
let mapData = {};
|
||||
|
||||
// check if there is an active map counter that prevents collecting map data
|
||||
let overlay = mapElement.getMapOverlay('timer');
|
||||
let counterChart = overlay.getMapCounter();
|
||||
|
||||
let interval = counterChart.data('interval');
|
||||
// check if there is an active map counter that prevents collecting map data (locked map)
|
||||
let interval = mapElement.getMapOverlayInterval();
|
||||
|
||||
if(
|
||||
! interval ||
|
||||
@@ -3188,7 +3223,6 @@ define([
|
||||
* @param options
|
||||
*/
|
||||
$.fn.loadMap = function(mapConfig, options){
|
||||
|
||||
// parent element where the map will be loaded
|
||||
let parentElement = $(this);
|
||||
|
||||
@@ -3197,9 +3231,6 @@ define([
|
||||
initConnectionContextMenu();
|
||||
initSystemContextMenu();
|
||||
|
||||
// new map init
|
||||
let newMap = false;
|
||||
|
||||
// init jsPlumb
|
||||
jsPlumb.ready(function() {
|
||||
// get new map instance or load existing
|
||||
@@ -3208,13 +3239,8 @@ define([
|
||||
// check for map Container -> first time initialization
|
||||
if(mapConfig.map.getContainer() === undefined){
|
||||
// new map instance
|
||||
newMap = true;
|
||||
}
|
||||
mapConfig = newMapElement(parentElement, mapConfig);
|
||||
|
||||
// draw/update map initial map and set container
|
||||
let mapContainer = updateMap(parentElement, mapConfig);
|
||||
|
||||
if(newMap){
|
||||
// init custom scrollbars and add overlay
|
||||
parentElement.initMapScrollbar();
|
||||
|
||||
@@ -3226,6 +3252,9 @@ define([
|
||||
mapOverlay.updateOverlayIcon('connectionEol', 'show');
|
||||
}
|
||||
|
||||
// draw/update map initial map and set container
|
||||
let mapContainer = updateMap(mapConfig);
|
||||
|
||||
// callback function after tab switch
|
||||
function switchTabCallback( mapName, mapContainer ){
|
||||
Util.showNotify({title: 'Map initialized', text: mapName + ' - loaded', type: 'success'});
|
||||
|
||||
@@ -91,7 +91,10 @@ define([
|
||||
if(label.length > 0){
|
||||
newLabel = label;
|
||||
|
||||
if( !label.includes('K162') ){
|
||||
// check if multiple labels found => conflict
|
||||
if( label.includes(', ') ){
|
||||
colorClass = 'txt-color-orangeLight';
|
||||
}else if( !label.includes('K162') ){
|
||||
colorClass = 'txt-color-yellow';
|
||||
}
|
||||
}else{
|
||||
@@ -570,14 +573,15 @@ define([
|
||||
};
|
||||
|
||||
/**
|
||||
* get the map counter chart by an overlay
|
||||
* @returns {*}
|
||||
* get the map counter chart from overlay
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getMapCounter = function(){
|
||||
return $(this).find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
};
|
||||
|
||||
let mapOverlayTimer = $(this);
|
||||
|
||||
return mapOverlayTimer.find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
$.fn.getMapOverlayInterval = function(){
|
||||
return $(this).getMapOverlay('timer').getMapCounter().data('interval');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -622,6 +626,7 @@ define([
|
||||
duration: Init.animationSpeed.mapOverlay,
|
||||
complete: function(){
|
||||
counterChart.data('interval', false);
|
||||
getMapElementFromOverlay(mapOverlayTimer).trigger('pf:unlocked');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ define([
|
||||
$.fn.initCustomScrollbar = function(config){
|
||||
|
||||
// default config -------------------------------------------------------------------------
|
||||
var defaultConfig = {
|
||||
let defaultConfig = {
|
||||
axis: 'x',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 300,
|
||||
@@ -52,7 +52,7 @@ define([
|
||||
config = $.extend(true, {}, defaultConfig, config);
|
||||
|
||||
return this.each(function(){
|
||||
var scrollableElement = $(this);
|
||||
let scrollableElement = $(this);
|
||||
|
||||
// prevent multiple initialization
|
||||
scrollableElement.mCustomScrollbar('destroy');
|
||||
|
||||
@@ -56,16 +56,14 @@ define([
|
||||
};
|
||||
|
||||
/**
|
||||
* get the current active map for
|
||||
* @returns {*}
|
||||
* get the current active mapElement
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getActiveMap = function(){
|
||||
let map = $(this).find('.active.' + config.mapTabContentClass + ' .' + config.mapClass);
|
||||
|
||||
if(map.length === 0){
|
||||
if(!map.length){
|
||||
map = false;
|
||||
}
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
@@ -563,7 +561,7 @@ define([
|
||||
activeMapIds.push(mapId);
|
||||
|
||||
// check for map data change and update tab
|
||||
if(tabMapData.config.updated !== tabElement.data('updated')){
|
||||
if(tabMapData.config.updated > tabElement.data('updated')){
|
||||
tabElement.updateTabData(tabMapData.config);
|
||||
}
|
||||
}else{
|
||||
@@ -631,7 +629,6 @@ define([
|
||||
|
||||
// add new tab for each map
|
||||
for(let j = 0; j < tempMapData.length; j++){
|
||||
|
||||
let data = tempMapData[j];
|
||||
tabMapElement.addTab(data.config);
|
||||
}
|
||||
|
||||
@@ -1252,9 +1252,7 @@ define([
|
||||
* @returns {JQuery|*|{}|T}
|
||||
*/
|
||||
$.fn.getMapTabElements = function(mapId){
|
||||
|
||||
let mapModuleElement = $(this);
|
||||
|
||||
let mapTabElements = mapModuleElement.find('#' + config.mapTabBarId).find('a');
|
||||
|
||||
if(mapId){
|
||||
|
||||
4
public/js/v1.2.1/lib/jquery-3.0.0.min.js
vendored
4
public/js/v1.2.1/lib/jquery-3.0.0.min.js
vendored
File diff suppressed because one or more lines are too long
4
public/js/v1.2.1/lib/jquery-3.1.1.min.js
vendored
Normal file
4
public/js/v1.2.1/lib/jquery-3.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -18,6 +18,7 @@
|
||||
&.txt-color-red { color: $red !important; }
|
||||
&.txt-color-redDarker { color: $red-darker !important; }
|
||||
&.txt-color-yellow { color: $yellow !important; }
|
||||
&.txt-color-orangeLight { color: $orange-light !important; }
|
||||
&.txt-color-orange { color: $orange !important; }
|
||||
&.txt-color-orangeDark { color: $orange-dark !important; }
|
||||
&.txt-color-pink { color: $pink !important; }
|
||||
|
||||
Reference in New Issue
Block a user