Fix : Lighten tooltip + fix for #170

Issue 170 : both selected frame and layer are kept after a resize
This commit is contained in:
jdescottes 2014-05-17 00:38:13 +02:00
parent d8772bdd8d
commit 1401c30d87
4 changed files with 17 additions and 9 deletions

View file

@ -9,10 +9,17 @@
}
};
ns.PiskelController.prototype.setPiskel = function (piskel) {
/**
* Set the current piskel. Will reset the selected frame and layer unless specified
* @param {Object} piskel
* @param {Boolean} preserveState if true, keep the selected frame and layer
*/
ns.PiskelController.prototype.setPiskel = function (piskel, preserveState) {
this.piskel = piskel;
this.currentLayerIndex = 0;
this.currentFrameIndex = 0;
if (!preserveState) {
this.currentLayerIndex = 0;
this.currentFrameIndex = 0;
}
this.layerIdCounter = 1;
};

View file

@ -13,8 +13,8 @@
pskl.app.shortcutService.addShortcut('shift+n', this.duplicateCurrentFrame.bind(this));
};
ns.PublicPiskelController.prototype.setPiskel = function (piskel) {
this.piskelController.setPiskel(piskel);
ns.PublicPiskelController.prototype.setPiskel = function (piskel, preserveState) {
this.piskelController.setPiskel(piskel, preserveState);
$.publish(Events.FRAME_SIZE_CHANGED);
$.publish(Events.PISKEL_RESET);

View file

@ -32,7 +32,8 @@
var resizedLayers = this.piskelController.getLayers().map(this.resizeLayer_.bind(this));
var piskel = pskl.model.Piskel.fromLayers(resizedLayers, this.piskelController.getPiskel().getDescriptor());
pskl.app.piskelController.setPiskel(piskel);
pskl.app.piskelController.setPiskel(piskel, true);
$.publish(Events.CLOSE_SETTINGS_DRAWER);
};
@ -44,7 +45,7 @@
ns.ResizeController.prototype.resizeFrame_ = function (frame) {
var width = parseInt(this.resizeWidth.val(), 10);
var height = parseInt(this.resizeHeight.val(), 10);
var resizedFrame;
if (this.isResizeContentEnabled_()) {
resizedFrame = pskl.utils.FrameUtils.resize(frame, width, height, false);
@ -56,7 +57,7 @@
}
});
}
return resizedFrame;
};

View file

@ -10,7 +10,7 @@
ns.Lighten = function() {
this.superclass.constructor.call(this);
this.toolId = "tool-lighten";
this.helpText = "Lighten / Darken";
this.helpText = "Lighten or ctrl:Darken";
this.step = 3;
this.resetUsedPixels_();
};