- new shortcut alt + N for system renaming, closed #790

This commit is contained in:
Mark Friedrich
2019-06-03 00:05:37 +02:00
parent 83a9cd0c0a
commit 91dcc3b063
10 changed files with 62 additions and 12 deletions

View File

@@ -43,6 +43,11 @@ define([
keyNames: ['CONTROL', 'V'],
alias: 'paste'
},
renameSystem: {
group: 'map',
label: 'Rename system',
keyNames: ['ALT', 'N']
},
newSignature: {
group: 'signatures',
label: 'New Signature',

View File

@@ -3176,7 +3176,7 @@ define([
},
onScrollStart: function(){
// hide all open xEditable fields
$(this).find('.editable').editable('hide');
$(this).find('.editable.editable-open').editable('hide');
// hide all system head tooltips
$(this).find('.' + config.systemHeadClass + ' .fa').tooltip('hide');

View File

@@ -85,10 +85,11 @@ define([
* -> subtract some offset for tooltips/connections
* @param scrollWrapper
* @param position
* @param options
*/
let scrollToSystem = (scrollWrapper, position) => {
let scrollToSystem = (scrollWrapper, position, options) => {
position = getOffsetPosition(position, {x: -15, y: -35});
scrollToPosition(scrollWrapper, position);
scrollToPosition(scrollWrapper, position, options);
};
/**

View File

@@ -778,6 +778,14 @@ define([
return zoomChange;
};
/**
* toggles editable input form for system rename (set alias)
* @param system
*/
let toggleSystemAliasEditable = system => {
system.find('.editable').editable('toggle');
};
/**
* mark system as "selected" e.g. for dragging
* @param map
@@ -1999,6 +2007,7 @@ define([
filterMapByScopes: filterMapByScopes,
changeZoom: changeZoom,
setZoom: setZoom,
toggleSystemAliasEditable: toggleSystemAliasEditable,
storeLocaleCharacterData: storeLocaleCharacterData,
getLocaleData: getLocaleData,
storeLocalData: storeLocalData,

View File

@@ -119,11 +119,21 @@ define([
return this.each((i, body) => {
body = $(body);
body.watchKey('tabReload', (body) => {
body.watchKey('tabReload', body => {
location.reload();
});
body.watchKey('newSignature', (body) => {
body.watchKey('renameSystem', body => {
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){
let activeSystem = activeMap.find('.' + MapUtil.config.systemActiveClass + ':first');
if(activeSystem.length){
MapUtil.toggleSystemAliasEditable(activeSystem);
}
}
});
body.watchKey('newSignature', body => {
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){
let mapContentElement = MapUtil.getTabContentElementByMapElement(activeMap);
@@ -132,7 +142,7 @@ define([
}
});
body.watchKey('clipboardPaste', (e) => {
body.watchKey('clipboardPaste', e => {
// just send event to the current active map
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){

View File

@@ -43,6 +43,11 @@ define([
keyNames: ['CONTROL', 'V'],
alias: 'paste'
},
renameSystem: {
group: 'map',
label: 'Rename system',
keyNames: ['ALT', 'N']
},
newSignature: {
group: 'signatures',
label: 'New Signature',

View File

@@ -3176,7 +3176,7 @@ define([
},
onScrollStart: function(){
// hide all open xEditable fields
$(this).find('.editable').editable('hide');
$(this).find('.editable.editable-open').editable('hide');
// hide all system head tooltips
$(this).find('.' + config.systemHeadClass + ' .fa').tooltip('hide');

View File

@@ -85,10 +85,11 @@ define([
* -> subtract some offset for tooltips/connections
* @param scrollWrapper
* @param position
* @param options
*/
let scrollToSystem = (scrollWrapper, position) => {
let scrollToSystem = (scrollWrapper, position, options) => {
position = getOffsetPosition(position, {x: -15, y: -35});
scrollToPosition(scrollWrapper, position);
scrollToPosition(scrollWrapper, position, options);
};
/**

View File

@@ -778,6 +778,14 @@ define([
return zoomChange;
};
/**
* toggles editable input form for system rename (set alias)
* @param system
*/
let toggleSystemAliasEditable = system => {
system.find('.editable').editable('toggle');
};
/**
* mark system as "selected" e.g. for dragging
* @param map
@@ -1999,6 +2007,7 @@ define([
filterMapByScopes: filterMapByScopes,
changeZoom: changeZoom,
setZoom: setZoom,
toggleSystemAliasEditable: toggleSystemAliasEditable,
storeLocaleCharacterData: storeLocaleCharacterData,
getLocaleData: getLocaleData,
storeLocalData: storeLocalData,

View File

@@ -119,11 +119,21 @@ define([
return this.each((i, body) => {
body = $(body);
body.watchKey('tabReload', (body) => {
body.watchKey('tabReload', body => {
location.reload();
});
body.watchKey('newSignature', (body) => {
body.watchKey('renameSystem', body => {
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){
let activeSystem = activeMap.find('.' + MapUtil.config.systemActiveClass + ':first');
if(activeSystem.length){
MapUtil.toggleSystemAliasEditable(activeSystem);
}
}
});
body.watchKey('newSignature', body => {
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){
let mapContentElement = MapUtil.getTabContentElementByMapElement(activeMap);
@@ -132,7 +142,7 @@ define([
}
});
body.watchKey('clipboardPaste', (e) => {
body.watchKey('clipboardPaste', e => {
// just send event to the current active map
let activeMap = Util.getMapModule().getActiveMap();
if(activeMap){