@@ -592,7 +592,7 @@ var CANVAS = function (_APP) {
592
592
interactive: true,
593
593
fireRightClick: true,
594
594
stopContextMenu: true
595
- }, _defineProperty(_ref2, "fireRightClick", false), _defineProperty(_ref2, "fireMiddleClick", false), _defineProperty(_ref2, "preserveObjectStacking", true), _ref2));
595
+ }, _defineProperty(_ref2, "fireRightClick", false), _defineProperty(_ref2, "fireMiddleClick", false), _defineProperty(_ref2, "preserveObjectStacking", true), _defineProperty(_ref2, "skipTargetFind", true), _ref2));
596
596
597
597
_this.c.wrapper_zoom = wrapper_zoom;
598
598
@@ -1454,7 +1454,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1454
1454
layout: "full",
1455
1455
submit: 1,
1456
1456
submitText: "ПРИМЕНИТЬ",
1457
- height: 200 ,
1457
+ height: 350 ,
1458
1458
polyfill: false,
1459
1459
styles: false
1460
1460
},
@@ -2036,16 +2036,6 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2036
2036
2037
2037
var _this = _possibleConstructorReturn(this, (TOOL_ALL.__proto__ || Object.getPrototypeOf(TOOL_ALL)).call(this, wrapper, func_panel));
2038
2038
2039
- _this.default_settings = {
2040
- hasControls: false,
2041
- hasBorders: false,
2042
- lockMovementX: true,
2043
- lockMovementY: true,
2044
- width: 0,
2045
- height: 0,
2046
- hoverCursor: "default"
2047
- };
2048
-
2049
2039
_this.move = {
2050
2040
elem_setting: document.querySelector(".header-panel-settings-move"),
2051
2041
elem: document.querySelector(".move-badge"),
@@ -2087,7 +2077,9 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2087
2077
func_event: _this.pouring_func_event.bind(_this),
2088
2078
func_start: _this.pouring_func_start.bind(_this),
2089
2079
func_end: _this.pouring_func_end.bind(_this),
2090
- settings: {}
2080
+ settings: {
2081
+ fill: "#000"
2082
+ }
2091
2083
};
2092
2084
_this.rubber = {
2093
2085
elem_setting: document.querySelector(".header-panel-settings-rubber"),
@@ -2137,16 +2129,7 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2137
2129
_class_app2.default.canvas.on(this.move.event, this.move.func_event);
2138
2130
2139
2131
_class_app2.default.canvas.selection = true;
2140
-
2141
- _class_app2.default.canvas.getActiveObjects().forEach(function (item) {});
2142
-
2143
- _class_app2.default.canvas.forEachObject(function (item) {
2144
- item.hasControls = true;
2145
- item.hasBorders = true;
2146
- item.hoverCursor = "move";
2147
- item.lockMovementX = false;
2148
- item.lockMovementY = false;
2149
- });
2132
+ _class_app2.default.canvas.skipTargetFind = false;
2150
2133
}
2151
2134
}, {
2152
2135
key: "pencil_func_start",
@@ -2163,12 +2146,70 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2163
2146
}, {
2164
2147
key: "pouring_func_start",
2165
2148
value: function pouring_func_start() {
2166
- _class_app2.default.canvas.on(this.pouring.event, this.pouring.func_event);
2149
+ var _this2 = this;
2150
+
2151
+ _class_app2.default.canvas.on("mouse:down", function (_ref) {
2152
+ var e = _ref.e;
2153
+
2154
+ var x = (0, _addition_function.get_x)(e);
2155
+ var y = (0, _addition_function.get_y)(e);
2156
+
2157
+ _class_app2.default.canvas.forEachObject(function (item, i) {
2158
+ return _class_app2.default.canvas.containsPoint(e, item, { x: x, y: y }) ? _class_app2.default.canvas.item(i).set({ fill: _this2.pouring.settings.fill }) : void 0;
2159
+ });
2160
+ });
2167
2161
}
2168
2162
}, {
2169
2163
key: "rubber_func_start",
2170
2164
value: function rubber_func_start() {
2171
- _class_app2.default.canvas.on(this.rubber.event, this.rubber.func_event);
2165
+ var _this3 = this;
2166
+
2167
+ _class_app2.default.canvas.on("mouse:move", function (_ref2) {
2168
+ var e = _ref2.e;
2169
+
2170
+ var x = (0, _addition_function.get_x)(e);
2171
+ var y = (0, _addition_function.get_y)(e);
2172
+
2173
+ _this3.rubber.settings.radius = 16;
2174
+ _this3.rubber.settings.left = x - 16;
2175
+ _this3.rubber.settings.top = y - 16;
2176
+ _this3.rubber.settings.fill = "transparent";
2177
+ _this3.rubber.settings.stroke = "black";
2178
+
2179
+ var circle = new fabric.Circle(_this3.rubber.settings);
2180
+
2181
+ _class_app2.default.canvas.renderAll();
2182
+
2183
+ console.log(123);
2184
+
2185
+ circle.render(_class_app2.default.canvas.getContext());
2186
+ });
2187
+ _class_app2.default.canvas.on("mouse:down", function (_ref3) {
2188
+ var e = _ref3.e;
2189
+
2190
+ var x = (0, _addition_function.get_x)(e);
2191
+ var y = (0, _addition_function.get_y)(e);
2192
+
2193
+ //APP.canvas.getContext().globalCompositeOperation = "destination-out";
2194
+
2195
+ _this3.rubber.settings.radius = 16;
2196
+ _this3.rubber.settings.left = x - 16;
2197
+ _this3.rubber.settings.top = y - 16;
2198
+ _this3.rubber.settings.globalCompositeOperation = "destination-out";
2199
+ _this3.rubber.settings.fill = "red";
2200
+
2201
+ _class_app2.default.canvas.freeDrawingBrush.width = 12;
2202
+
2203
+ _class_app2.default.canvas.isDrawingMode = true;
2204
+
2205
+ _class_app2.default.canvas.getContext().globalCompositeOperation = "destination-out";
2206
+
2207
+ //let circle = new fabric.Circle(this.rubber.settings);
2208
+
2209
+ //APP.canvas.add(circle);
2210
+
2211
+ _class_app2.default.canvas.renderAll();
2212
+ });
2172
2213
}
2173
2214
}, {
2174
2215
key: "square_func_start",
@@ -2187,14 +2228,10 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2187
2228
key: "move_func_end",
2188
2229
value: function move_func_end() {
2189
2230
_class_app2.default.canvas.off(this.move.event, this.move.func_event);
2231
+ _class_app2.default.canvas.skipTargetFind = true;
2232
+ _class_app2.default.canvas.selection = false;
2190
2233
2191
- _class_app2.default.canvas.forEachObject(function (item) {
2192
- item.hasControls = false;
2193
- item.hasBorders = false;
2194
- item.hoverCursor = "default";
2195
- item.lockMovementX = true;
2196
- item.lockMovementY = true;
2197
- });
2234
+ _class_app2.default.canvas.discardActiveObject();
2198
2235
}
2199
2236
}, {
2200
2237
key: "pencil_func_end",
@@ -2215,12 +2252,15 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2215
2252
}, {
2216
2253
key: "pouring_func_end",
2217
2254
value: function pouring_func_end() {
2218
- _class_app2.default.canvas.off(this.pouring.event, this.pouring.func_event );
2255
+ _class_app2.default.canvas.off("mouse:down" );
2219
2256
}
2220
2257
}, {
2221
2258
key: "rubber_func_end",
2222
2259
value: function rubber_func_end() {
2223
- _class_app2.default.canvas.off(this.rubber.event, this.rubber.func_event);
2260
+ _class_app2.default.canvas.off("mouse:move");
2261
+ _class_app2.default.canvas.off("mouse:down");
2262
+
2263
+ _class_app2.default.canvas.getContext().globalCompositeOperation = "source-over";
2224
2264
}
2225
2265
}, {
2226
2266
key: "square_func_end",
@@ -2250,7 +2290,7 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2250
2290
var x = (0, _addition_function.get_x)(props.e);
2251
2291
var y = (0, _addition_function.get_y)(props.e);
2252
2292
2253
- Object.assign(this.text.settings, this.default_settings, {
2293
+ Object.assign(this.text.settings, {
2254
2294
left: x,
2255
2295
top: y
2256
2296
});
@@ -2270,24 +2310,8 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2270
2310
value: function pouring_func_event(e) {}
2271
2311
}, {
2272
2312
key: "rubber_func_event",
2273
- value: function rubber_func_event(_ref) {
2274
- var e = _ref.e;
2275
-
2276
- var x = (0, _addition_function.get_x)(e);
2277
- var y = (0, _addition_function.get_y)(e);
2278
-
2279
- this.rubber.settings.radius = 16;
2280
- this.rubber.settings.left = x - 16;
2281
- this.rubber.settings.top = y - 16;
2282
- this.rubber.settings.fill = "transparent";
2283
-
2284
- var circle = new fabric.Circle(this.rubber.settings);
2285
-
2286
- _class_app2.default.canvas.renderAll();
2287
-
2288
- console.log(123);
2289
-
2290
- circle.render(_class_app2.default.canvas.getContext());
2313
+ value: function rubber_func_event(_ref4) {
2314
+ var e = _ref4.e;
2291
2315
}
2292
2316
}, {
2293
2317
key: "square_func_event",
@@ -2297,8 +2321,6 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2297
2321
var x1 = (0, _addition_function.get_x)(props.e);
2298
2322
var y1 = (0, _addition_function.get_y)(props.e);
2299
2323
2300
- Object.assign(this.square.settings, this.default_settings);
2301
-
2302
2324
this.square.settings.left = x1;
2303
2325
this.square.settings.top = y1;
2304
2326
@@ -2342,8 +2364,6 @@ var TOOL_ALL = function (_TOOLS_COMPONENTS) {
2342
2364
var x = (0, _addition_function.get_x)(props.e);
2343
2365
var y = (0, _addition_function.get_y)(props.e);
2344
2366
2345
- Object.assign(this.line.settings, this.default_settings);
2346
-
2347
2367
var line = new fabric.Line([x, y, x, y], this.line.settings);
2348
2368
2349
2369
_class_app2.default.canvas.on("mouse:move", function (props) {
0 commit comments