mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Added keyboard shortcuts
This commit is contained in:
parent
939042a645
commit
24186d5aec
|
@ -19,6 +19,8 @@
|
||||||
this.updateZoom_();
|
this.updateZoom_();
|
||||||
$.subscribe(Events.FRAME_SIZE_CHANGED, this.onFrameSizeChange_.bind(this));
|
$.subscribe(Events.FRAME_SIZE_CHANGED, this.onFrameSizeChange_.bind(this));
|
||||||
$.subscribe(Events.USER_SETTINGS_CHANGED, $.proxy(this.onUserSettingsChange_, this));
|
$.subscribe(Events.USER_SETTINGS_CHANGED, $.proxy(this.onUserSettingsChange_, this));
|
||||||
|
|
||||||
|
pskl.app.shortcutService.addShortcut('alt+O', this.toggleOnionSkin_.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.AnimatedPreviewController.prototype.onUserSettingsChange_ = function () {
|
ns.AnimatedPreviewController.prototype.onUserSettingsChange_ = function () {
|
||||||
|
@ -122,4 +124,9 @@
|
||||||
containerEl.style.marginLeft = ((PREVIEW_SIZE - width) / 2) + "px";
|
containerEl.style.marginLeft = ((PREVIEW_SIZE - width) / 2) + "px";
|
||||||
containerEl.style.marginRight = ((PREVIEW_SIZE - width) / 2) + "px";
|
containerEl.style.marginRight = ((PREVIEW_SIZE - width) / 2) + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.AnimatedPreviewController.prototype.toggleOnionSkin_ = function () {
|
||||||
|
var currentValue = pskl.UserSettings.get(pskl.UserSettings.ONION_SKIN);
|
||||||
|
pskl.UserSettings.set(pskl.UserSettings.ONION_SKIN, !currentValue);
|
||||||
|
};
|
||||||
})();
|
})();
|
|
@ -113,7 +113,7 @@
|
||||||
ns.DrawingController.prototype.onUserSettingsChange_ = function (evt, settingsName, settingsValue) {
|
ns.DrawingController.prototype.onUserSettingsChange_ = function (evt, settingsName, settingsValue) {
|
||||||
if(settingsName == pskl.UserSettings.SHOW_GRID) {
|
if(settingsName == pskl.UserSettings.SHOW_GRID) {
|
||||||
console.warn('DrawingController:onUserSettingsChange_ not implemented !');
|
console.warn('DrawingController:onUserSettingsChange_ not implemented !');
|
||||||
} else if (settingsName == pskl.UserSettings.OVERLAY) {
|
} else if (settingsName == pskl.UserSettings.ONION_SKIN || settingsName == pskl.UserSettings.LAYER_PREVIEW) {
|
||||||
this.onionSkinRenderer.clear();
|
this.onionSkinRenderer.clear();
|
||||||
this.onionSkinRenderer.flush();
|
this.onionSkinRenderer.flush();
|
||||||
this.layersRenderer.clear();
|
this.layersRenderer.clear();
|
||||||
|
@ -319,10 +319,11 @@
|
||||||
this.overlayFrame = pskl.model.Frame.createEmptyFromFrame(currentFrame);
|
this.overlayFrame = pskl.model.Frame.createEmptyFromFrame(currentFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
var overlaySetting = pskl.UserSettings.get(pskl.UserSettings.OVERLAY);
|
if (pskl.UserSettings.get(pskl.UserSettings.ONION_SKIN)) {
|
||||||
if (overlaySetting === Constants.OVERLAY_ONION_SKIN) {
|
|
||||||
this.onionSkinRenderer.render();
|
this.onionSkinRenderer.render();
|
||||||
} else if (overlaySetting === Constants.OVERLAY_LAYER_PREVIEW) {
|
}
|
||||||
|
|
||||||
|
if (pskl.UserSettings.get(pskl.UserSettings.LAYER_PREVIEW)) {
|
||||||
this.layersRenderer.render();
|
this.layersRenderer.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
$.subscribe(Events.PISKEL_RESET, this.renderLayerList_.bind(this));
|
$.subscribe(Events.PISKEL_RESET, this.renderLayerList_.bind(this));
|
||||||
|
|
||||||
|
pskl.app.shortcutService.addShortcut('alt+L', this.toggleLayerPreview_.bind(this));
|
||||||
|
|
||||||
this.renderLayerList_();
|
this.renderLayerList_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,4 +71,9 @@
|
||||||
this.piskelController.removeCurrentLayer();
|
this.piskelController.removeCurrentLayer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.LayersListController.prototype.toggleLayerPreview_ = function () {
|
||||||
|
var currentValue = pskl.UserSettings.get(pskl.UserSettings.LAYER_PREVIEW);
|
||||||
|
pskl.UserSettings.set(pskl.UserSettings.LAYER_PREVIEW, !currentValue);
|
||||||
|
};
|
||||||
})();
|
})();
|
|
@ -103,7 +103,9 @@
|
||||||
this.toDescriptor_('N', 'Create new frame'),
|
this.toDescriptor_('N', 'Create new frame'),
|
||||||
this.toDescriptor_('shift + N', 'Duplicate selected frame'),
|
this.toDescriptor_('shift + N', 'Duplicate selected frame'),
|
||||||
this.toDescriptor_('shift + ?', 'Open/Close this popup'),
|
this.toDescriptor_('shift + ?', 'Open/Close this popup'),
|
||||||
this.toDescriptor_('alt + P', 'Open the Palette Manager')
|
this.toDescriptor_('alt + P', 'Open the Palette Manager'),
|
||||||
|
this.toDescriptor_('alt + O', 'Toggle Onion Skin'),
|
||||||
|
this.toDescriptor_('alt + L', 'Toggle Layer Preview')
|
||||||
];
|
];
|
||||||
|
|
||||||
this.initMarkupAbstract_(descriptors, '.cheatsheet-misc-shortcuts');
|
this.initMarkupAbstract_(descriptors, '.cheatsheet-misc-shortcuts');
|
||||||
|
|
|
@ -6,14 +6,16 @@
|
||||||
CANVAS_BACKGROUND : 'CANVAS_BACKGROUND',
|
CANVAS_BACKGROUND : 'CANVAS_BACKGROUND',
|
||||||
SELECTED_PALETTE : 'SELECTED_PALETTE',
|
SELECTED_PALETTE : 'SELECTED_PALETTE',
|
||||||
TILED_PREVIEW : 'TILED_PREVIEW',
|
TILED_PREVIEW : 'TILED_PREVIEW',
|
||||||
OVERLAY : 'OVERLAY',
|
ONION_SKIN : 'ONION_SKIN',
|
||||||
|
LAYER_PREVIEW : 'LAYER_PREVIEW',
|
||||||
|
|
||||||
KEY_TO_DEFAULT_VALUE_MAP_ : {
|
KEY_TO_DEFAULT_VALUE_MAP_ : {
|
||||||
'GRID_WIDTH' : 0,
|
'GRID_WIDTH' : 0,
|
||||||
'CANVAS_BACKGROUND' : 'lowcont-dark-canvas-background',
|
'CANVAS_BACKGROUND' : 'lowcont-dark-canvas-background',
|
||||||
'SELECTED_PALETTE' : Constants.CURRENT_COLORS_PALETTE_ID,
|
'SELECTED_PALETTE' : Constants.CURRENT_COLORS_PALETTE_ID,
|
||||||
'TILED_PREVIEW' : false,
|
'TILED_PREVIEW' : false,
|
||||||
'OVERLAY' : Constants.OVERLAY_ONION_SKIN
|
'ONION_SKIN' : false,
|
||||||
|
'LAYER_PREVIEW' : true
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user