1
- From b89380c65ea8bc9231cc98a6ae0e812227c85b3d Mon Sep 17 00:00:00 2001
1
+ From 5eeb1092c64865c555671ed585da18f974c9c10c Mon Sep 17 00:00:00 2001
2
2
From: Boris Sekachev <
[email protected] >
3
- Date: Tue, 10 Jul 2018 14:31:13 +0300
3
+ Date: Tue, 18 Sep 2018 15:58:20 +0300
4
4
Subject: [PATCH] tmp
5
5
6
6
---
7
7
.../engine/static/engine/js/3rdparty/svg.draggable.js | 1 +
8
8
cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js | 17 +++++++++++++++--
9
9
.../apps/engine/static/engine/js/3rdparty/svg.resize.js | 5 +++--
10
- .../apps/engine/static/engine/js/3rdparty/svg.select.js | 1 +
11
- 4 files changed, 20 insertions(+), 4 deletions(-)
10
+ .../apps/engine/static/engine/js/3rdparty/svg.select.js | 5 ++++-
11
+ 4 files changed, 23 insertions(+), 5 deletions(-)
12
12
13
13
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
14
- index d88abf5..06158f1 100644
14
+ index d88abf5..aba474c 100644
15
15
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
16
16
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
17
17
@@ -109,6 +109,7 @@
18
-
18
+
19
19
// while dragging
20
20
DragHandler.prototype.drag = function(e){
21
21
+ this.m = this.el.node.getScreenCTM().inverse();
22
-
22
+
23
23
var box = this.getBBox()
24
24
, p = this.transformPoint(e)
25
25
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
26
- index 68dbf2a..9884b75 100644
26
+ index 68dbf2a..20a6917 100644
27
27
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
28
28
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
29
29
@@ -18,6 +18,7 @@
30
30
this.startPoint = null;
31
31
this.lastUpdateCall = null;
32
32
this.options = {};
33
33
+ this.set = new SVG.Set();
34
-
34
+
35
35
// Merge options and defaults
36
36
for (var i in this.el.draw.defaults) {
37
37
@@ -139,6 +140,8 @@
38
38
// Call the calc-function which calculates the new position and size
39
39
this.calc(event);
40
-
40
+
41
41
+ this.m = this.el.node.getScreenCTM().inverse();
42
42
+ this.offset = { x: window.pageXOffset, y: window.pageYOffset };
43
43
// Fire the `drawupdate`-event
@@ -46,7 +46,7 @@ index 68dbf2a..9884b75 100644
46
46
@@ -160,6 +163,16 @@
47
47
this.el.fire('drawcancel');
48
48
};
49
-
49
+
50
50
+ // Undo last drawed point
51
51
+ PaintHandler.prototype.undo = function () {
52
52
+ if (this.set.length()) {
@@ -59,24 +59,24 @@ index 68dbf2a..9884b75 100644
59
59
+
60
60
// Calculate the corrected position when using `snapToGrid`
61
61
PaintHandler.prototype.snapToGrid = function (draw) {
62
-
62
+
63
63
@@ -371,14 +384,14 @@
64
-
64
+
65
65
this.set.clear();
66
-
66
+
67
67
- for (var i = 0; i < array.length; ++i) {
68
68
+ for (var i = 0; i < array.length - 1; ++i) {
69
-
69
+
70
70
this.p.x = array[i][0]
71
71
this.p.y = array[i][1]
72
-
72
+
73
73
var p = this.p.matrixTransform(this.parent.node.getScreenCTM().inverse().multiply(this.el.node.getScreenCTM()));
74
-
74
+
75
75
- this.set.add(this.parent.circle(5).stroke({width: 1}).fill('#ccc').center(p.x, p.y));
76
76
+ this.set.add(this.parent.circle(5).stroke({width: 1}).fill('#ccc').center(p.x, p.y)).addClass("svg_draw_point");
77
77
}
78
78
}
79
-
79
+
80
80
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js
81
81
index 0c3b63d..fb5dc26 100644
82
82
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.resize.js
@@ -91,27 +91,53 @@ index 0c3b63d..fb5dc26 100644
91
91
+ y: event.clientY != null ? event.clientY : event.touches[0].clientY
92
92
};
93
93
};
94
-
94
+
95
95
@@ -343,6 +343,7 @@
96
96
}
97
97
return;
98
98
}
99
99
+ this.m = this.el.node.getScreenCTM().inverse();
100
-
100
+
101
101
// Calculate the difference between the mouseposition at start and now
102
102
var txPt = this._extractPosition(event);
103
103
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
104
- index 47e07bd..f1d0c02 100644
104
+ index 47e07bd..cee6d34 100644
105
105
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
106
106
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
107
107
@@ -160,6 +160,7 @@ SelectHandler.prototype.drawPoints = function () {
108
108
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
109
109
ev.stopPropagation();
110
-
110
+
111
111
+ if (ev.which != 1) return false;
112
112
var x = ev.pageX || ev.touches[0].pageX;
113
113
var y = ev.pageY || ev.touches[0].pageY;
114
114
_this.el.fire('point', {x: x, y: y, i: k, event: ev});
115
- - -
115
+ @@ -361,6 +362,7 @@ SelectHandler.prototype.cleanup = function () {
116
+ // stop watching the element, remove the selection
117
+ this.rectSelection.set.each(function () {
118
+ this.remove();
119
+ + SVG.off(this.node);
120
+ });
121
+
122
+ this.rectSelection.set.clear();
123
+ @@ -371,6 +373,7 @@ SelectHandler.prototype.cleanup = function () {
124
+ // Remove all points, clear the set, stop watching the element
125
+ this.pointSelection.set.each(function () {
126
+ this.remove();
127
+ + SVG.off(this.node);
128
+ });
129
+
130
+ this.pointSelection.set.clear();
131
+ @@ -379,8 +382,8 @@ SelectHandler.prototype.cleanup = function () {
132
+
133
+ if (!this.pointSelection.isSelected && !this.rectSelection.isSelected) {
134
+ this.nested.remove();
135
+ + SVG.off(this.node);
136
+ delete this.nested;
137
+ -
138
+ }
139
+ };
140
+
141
+ - -
116
142
2.7.4
117
143
0 commit comments