|
@@ -39,43 +39,41 @@
|
39
|
39
|
var selectorState = selectorStates.pointing;
|
40
|
40
|
var last_sent = 0;
|
41
|
41
|
var blockedSelectionButtons = Tools.server_config.BLOCKED_SELECTION_BUTTONS;
|
42
|
|
- var selectionButtons = {};
|
43
|
|
-
|
44
|
|
- selectionButtons["delete"] = createButton("delete", "delete", 22, 22,
|
45
|
|
- function (me, bbox, s) {
|
46
|
|
- me.width.baseVal.value = me.origWidth / s;
|
47
|
|
- me.height.baseVal.value = me.origHeight / s;
|
48
|
|
- me.x.baseVal.value = bbox.r[0];
|
49
|
|
- me.y.baseVal.value = bbox.r[1] - (me.origHeight + 3) / s;
|
50
|
|
- me.style.display = "";
|
51
|
|
- },
|
52
|
|
- deleteSelection);
|
53
|
|
-
|
54
|
|
- selectionButtons["duplicate"] = createButton("duplicate", "duplicate", 22, 22,
|
55
|
|
- function (me, bbox, s) {
|
56
|
|
- me.width.baseVal.value = me.origWidth / s;
|
57
|
|
- me.height.baseVal.value = me.origHeight / s;
|
58
|
|
- me.x.baseVal.value = bbox.r[0] + (me.origWidth + 2) / s;
|
59
|
|
- me.y.baseVal.value = bbox.r[1] - (me.origHeight + 3) / s;
|
60
|
|
- me.style.display = "";
|
61
|
|
- },
|
62
|
|
- duplicateSelection);
|
63
|
|
- selectionButtons["scale"] = createButton("scaleHandle", "handle", 14, 14,
|
64
|
|
- function (me, bbox, s) {
|
65
|
|
- me.width.baseVal.value = me.origWidth / s;
|
66
|
|
- me.height.baseVal.value = me.origHeight / s;
|
67
|
|
- me.x.baseVal.value = bbox.r[0] + bbox.a[0] - me.origWidth / (2 * s);
|
68
|
|
- me.y.baseVal.value = bbox.r[1] + bbox.b[1] - me.origHeight / (2 * s);
|
69
|
|
- me.style.display = "";
|
70
|
|
- },
|
71
|
|
- startScalingTransform);
|
|
42
|
+ var selectionButtons = [
|
|
43
|
+ createButton("delete", "delete", 24, 24,
|
|
44
|
+ function (me, bbox, s) {
|
|
45
|
+ me.width.baseVal.value = me.origWidth / s;
|
|
46
|
+ me.height.baseVal.value = me.origHeight / s;
|
|
47
|
+ me.x.baseVal.value = bbox.r[0];
|
|
48
|
+ me.y.baseVal.value = bbox.r[1] - (me.origHeight + 3) / s;
|
|
49
|
+ me.style.display = "";
|
|
50
|
+ },
|
|
51
|
+ deleteSelection),
|
|
52
|
+
|
|
53
|
+ createButton("duplicate", "duplicate", 24, 24,
|
|
54
|
+ function (me, bbox, s) {
|
|
55
|
+ me.width.baseVal.value = me.origWidth / s;
|
|
56
|
+ me.height.baseVal.value = me.origHeight / s;
|
|
57
|
+ me.x.baseVal.value = bbox.r[0] + (me.origWidth + 2) / s;
|
|
58
|
+ me.y.baseVal.value = bbox.r[1] - (me.origHeight + 3) / s;
|
|
59
|
+ me.style.display = "";
|
|
60
|
+ },
|
|
61
|
+ duplicateSelection),
|
|
62
|
+
|
|
63
|
+ createButton("scaleHandle", "handle", 14, 14,
|
|
64
|
+ function (me, bbox, s) {
|
|
65
|
+ me.width.baseVal.value = me.origWidth / s;
|
|
66
|
+ me.height.baseVal.value = me.origHeight / s;
|
|
67
|
+ me.x.baseVal.value = bbox.r[0] + bbox.a[0] - me.origWidth / (2 * s);
|
|
68
|
+ me.y.baseVal.value = bbox.r[1] + bbox.b[1] - me.origHeight / (2 * s);
|
|
69
|
+ me.style.display = "";
|
|
70
|
+ },
|
|
71
|
+ startScalingTransform)
|
|
72
|
+ ];
|
72
|
73
|
|
73
|
74
|
for (i in blockedSelectionButtons) {
|
74
|
75
|
delete selectionButtons[blockedSelectionButtons[i]];
|
75
|
76
|
}
|
76
|
|
- selectionButtons = Object.keys(selectionButtons).map(function (k) {
|
77
|
|
- return selectionButtons[k];
|
78
|
|
- });
|
79
|
77
|
|
80
|
78
|
var getScale = Tools.getScale;
|
81
|
79
|
|
|
@@ -149,12 +147,7 @@
|
149
|
147
|
}
|
150
|
148
|
|
151
|
149
|
function createButton(name, icon, width, height, drawCallback, clickCallback) {
|
152
|
|
- var shape = Tools.createSVGElement("image", {
|
153
|
|
- id: name + "Icon",
|
154
|
|
- href: "tools/hand/" + icon + ".svg",
|
155
|
|
- width: width,
|
156
|
|
- height: height,
|
157
|
|
- });
|
|
150
|
+ var shape = Tools.createSVGElement("use", {href: "tools/hand/" + icon + ".svg#root"});
|
158
|
151
|
shape.style.display = "none";
|
159
|
152
|
shape.origWidth = width;
|
160
|
153
|
shape.origHeight = height;
|
|
@@ -405,10 +398,9 @@
|
405
|
398
|
|
406
|
399
|
function clickSelector(x, y, evt) {
|
407
|
400
|
selectionRect = selectionRect || createSelectorRect();
|
408
|
|
- var button = null;
|
409
|
401
|
for (var i = 0; i < selectionButtons.length; i++) {
|
410
|
402
|
if (selectionButtons[i].contains(evt.target)) {
|
411
|
|
- button = selectionButtons[i];
|
|
403
|
+ var button = selectionButtons[i];
|
412
|
404
|
}
|
413
|
405
|
}
|
414
|
406
|
if (button) {
|