fix click mode
This commit is contained in:
parent
8795fc3685
commit
c5a52ab37a
@ -195,14 +195,35 @@ define(
|
||||
return;
|
||||
}
|
||||
|
||||
// 放大
|
||||
if (e.keyCode == 187 && e.ctrlKey) {
|
||||
e.originEvent.stopPropagation();
|
||||
e.originEvent.preventDefault();
|
||||
var size = render.getSize();
|
||||
render.scale(1.25, {
|
||||
x: size.width / 2,
|
||||
y: size.height / 2
|
||||
});
|
||||
}
|
||||
// 缩小
|
||||
else if (e.keyCode == 189 && e.ctrlKey) {
|
||||
e.originEvent.stopPropagation();
|
||||
e.originEvent.preventDefault();
|
||||
var size = render.getSize();
|
||||
render.scale(0.8, {
|
||||
x: size.width / 2,
|
||||
y: size.height / 2
|
||||
});
|
||||
}
|
||||
// 撤销
|
||||
if (e.keyCode == 90 && e.ctrlKey) {
|
||||
else if (e.keyCode == 90 && e.ctrlKey) {
|
||||
me.execCommand('undo');
|
||||
}
|
||||
// 恢复
|
||||
else if (e.keyCode == 89 && e.ctrlKey) {
|
||||
me.execCommand('redo');
|
||||
}
|
||||
|
||||
else {
|
||||
me.mode.keydown && me.mode.keydown.call(me, e);
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ define(
|
||||
|
||||
|
||||
this.editor.coverLayer.removeShape('bound');
|
||||
this.editor.coverLayer.removeShape('boundcenter');
|
||||
delete this.bound;
|
||||
|
||||
this.refresh();
|
||||
|
@ -33,7 +33,8 @@ define(
|
||||
if (result.length > 1) {
|
||||
shape = selectShape(result);
|
||||
}
|
||||
this.setMode('shapes', [shape]);
|
||||
|
||||
this.setMode('shapes', [shape], 'bound');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ define(
|
||||
if (bound.width >= 20 && bound.height >= 20) {
|
||||
var shapes;
|
||||
if ((shapes = selectShapes.call(this, bound))) {
|
||||
this.setMode('shapes', shapes);
|
||||
this.setMode('shapes', shapes, 'range');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -289,11 +289,16 @@ define(
|
||||
/**
|
||||
* 开始模式
|
||||
*/
|
||||
begin: function(shapes) {
|
||||
begin: function(shapes, prevMode) {
|
||||
this.currentGroup = new ShapesGroup(shapes, this);
|
||||
this.currentGroup.refresh();
|
||||
this.currentGroup.setMode('scale');
|
||||
this.clicked = false;
|
||||
if (prevMode == 'bound') {
|
||||
this.clicked = false;
|
||||
}
|
||||
else {
|
||||
this.clicked = true;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
@ -47,7 +47,9 @@ define(
|
||||
if(this.options.enableScale) {
|
||||
var me = this;
|
||||
this.capture.on('wheel', function(e) {
|
||||
if (e.altKey) {
|
||||
if (e.ctrlKey) {
|
||||
e.originEvent.stopPropagation();
|
||||
e.originEvent.preventDefault();
|
||||
var defaultRatio = me.options.defaultRatio || 1.2;
|
||||
var ratio = e.delta > 0 ? defaultRatio : 1 / defaultRatio;
|
||||
var toScale = me.camera.scale * ratio;
|
||||
@ -154,10 +156,19 @@ define(
|
||||
* @return {this}
|
||||
*/
|
||||
Render.prototype.scale = function(ratio, p, noRefresh) {
|
||||
|
||||
var toScale = this.camera.scale * ratio;
|
||||
if (
|
||||
toScale < this.options.minScale
|
||||
|| toScale > this.options.maxScale
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.camera.ratio = ratio;
|
||||
this.camera.center.x = p.x;
|
||||
this.camera.center.y = p.y;
|
||||
this.camera.scale *= ratio;
|
||||
this.camera.scale = toScale;
|
||||
|
||||
if(true !== noRefresh) {
|
||||
this.painter.refresh();
|
||||
|
@ -47,7 +47,8 @@ define(
|
||||
ctrlKey: e.ctrlKey,
|
||||
metaKey: e.metaKey,
|
||||
altKey: e.altKey,
|
||||
shiftKey: e.shiftKey
|
||||
shiftKey: e.shiftKey,
|
||||
originEvent: e
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user