Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for resize. It becomes to work more stability. #200

Merged
merged 1 commit into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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