Fixed resize on right mouse button

main
Boris Sekachev 6 years ago
parent 62cd4eccdc
commit 73a7a7fd79

@ -1208,11 +1208,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
let shapeSizeElement: ShapeSizeElement | null = null; let shapeSizeElement: ShapeSizeElement | null = null;
let resized = false; let resized = false;
(shape as any).resize().on('resizestart', (e: any): void => { (shape as any).resize().on('resizestart', (): void => {
if (e.detail.event.detail.event.button === 2) {
e.preventDefault();
return;
}
this.mode = Mode.RESIZE; this.mode = Mode.RESIZE;
if (state.shapeType === 'rectangle') { if (state.shapeType === 'rectangle') {
shapeSizeElement = displayShapeSize(this.adoptedContent, this.adoptedText); shapeSizeElement = displayShapeSize(this.adoptedContent, this.adoptedText);

@ -161,6 +161,11 @@ SVG.Element.prototype.resize = function constructor(...args: any): any {
if (!handler) { if (!handler) {
originalResize.call(this, ...args); originalResize.call(this, ...args);
handler = this.remember('_resizeHandler'); handler = this.remember('_resizeHandler');
handler.resize = function(e: any) {
if (e.detail.event.button === 0) {
return handler.constructor.prototype.resize.call(this, e);
}
}
handler.update = function(e: any) { handler.update = function(e: any) {
this.m = this.el.node.getScreenCTM().inverse(); this.m = this.el.node.getScreenCTM().inverse();
return handler.constructor.prototype.update.call(this, e); return handler.constructor.prototype.update.call(this, e);

Loading…
Cancel
Save