Skip to content

Commit

Permalink
Some fixes for resize. It becomes to work more stability. (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored and nmanovic committed Nov 19, 2018
1 parent c35d07c commit ce06c95
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
20 changes: 14 additions & 6 deletions cvat/apps/engine/static/engine/js/3rdparty.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From 5eeb1092c64865c555671ed585da18f974c9c10c Mon Sep 17 00:00:00 2001
From d44089dfc96b56d427d5631442d6587f876f43b6 Mon Sep 17 00:00:00 2001
From: Boris Sekachev <[email protected]>
Date: Tue, 18 Sep 2018 15:58:20 +0300
Date: Mon, 19 Nov 2018 12:09:48 +0300
Subject: [PATCH] tmp

---
.../engine/static/engine/js/3rdparty/svg.draggable.js | 1 +
cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js | 17 +++++++++++++++--
.../apps/engine/static/engine/js/3rdparty/svg.resize.js | 5 +++--
.../apps/engine/static/engine/js/3rdparty/svg.resize.js | 6 ++++--
.../apps/engine/static/engine/js/3rdparty/svg.select.js | 5 ++++-
4 files changed, 23 insertions(+), 5 deletions(-)
4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
index d88abf5..aba474c 100644
Expand Down Expand Up @@ -78,7 +78,7 @@ index 68dbf2a..20a6917 100644
}

diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js
index 0c3b63d..fb5dc26 100644
index 0c3b63d..dceede5 100644
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js
@@ -34,8 +34,8 @@
Expand All @@ -92,7 +92,15 @@ index 0c3b63d..fb5dc26 100644
};
};

@@ -343,6 +343,7 @@
@@ -98,6 +98,7 @@
};

ResizeHandler.prototype.resize = function (event) {
+ if (event.detail.event.button) return; // only left mouse button

var _this = this;

@@ -343,6 +344,7 @@
}
return;
}
Expand Down
34 changes: 29 additions & 5 deletions cvat/apps/engine/static/engine/js/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,24 @@ class ShapeView extends Listener {
deepSelect: true,
}).resize(false);

if (this._flags.resizing) {
this._flags.resizing = false;
this.notify('resize');
}

if (this._flags.dragging) {
this._flags.dragging = false;
this.notify('drag');
}

this._uis.shape.off('dragstart')
.off('dragend')
.off('resizestart')
.off('resizing')
.off('resizedone')
.off('contextmenu.contextMenu')
.off('mousedown.contextMenu');

this._flags.editable = false;
}

Expand Down Expand Up @@ -2705,25 +2716,39 @@ ShapeView.labels = function() {
class BoxView extends ShapeView {
constructor(boxModel, boxController, svgScene, menusScene) {
super(boxModel, boxController, svgScene, menusScene);

this._uis.boxSize = null;
}


_makeEditable() {
if (this._uis.shape && this._uis.shape.node.parentElement && !this._flags.editable) {
if (!this._controller.lock) {
let sizeObject = null;
this._uis.shape.on('resizestart', (e) => {
sizeObject = drawBoxSize(this._scenes.svg, e.target);
if (this._uis.boxSize) {
this._uis.boxSize.rm();
this._uis.boxSize = null;
}

this._uis.boxSize = drawBoxSize(this._scenes.svg, e.target);
}).on('resizing', (e) => {
sizeObject = drawBoxSize.call(sizeObject, this._scenes.svg, e.target);
this._uis.boxSize = drawBoxSize.call(this._uis.boxSize, this._scenes.svg, e.target);
}).on('resizedone', () => {
sizeObject.rm();
this._uis.boxSize.rm();
});
}
ShapeView.prototype._makeEditable.call(this);
}
}

_makeNotEditable() {
if (this._uis.boxSize) {
this._uis.boxSize.rm();
this._uis.boxSize = null;
}
ShapeView.prototype._makeNotEditable.call(this);
}


_buildPosition() {
let shape = this._uis.shape.node;
Expand Down Expand Up @@ -2756,7 +2781,6 @@ class BoxView extends ShapeView {
ShapeView.prototype._drawShapeUI.call(this);
}


_setupAAMView(active, pos) {
let oldRect = $('#outsideRect');
let oldMask = $('#outsideMask');
Expand Down

0 comments on commit ce06c95

Please sign in to comment.