|
1025 | 1025 | if (this._pathIndex >= numUndo - 1 && this._pathIndex - numUndo < this._drawnPaths.length) { |
1026 | 1026 | this.graphPixels = this._blankGraph(); // Start with a blank graph |
1027 | 1027 | var originalMode = this.mode, originalBrushColor = this.brushColor, originalBrushSize = this.brushSize, originalEraserSize = this.eraserSize; |
1028 | | - this._removeMouseEvents(); |
| 1028 | + this._removeDOMEvents(); |
1029 | 1029 | this._drawnPaths.slice(0, this._pathIndex - numUndo + 1).forEach(function (path) { |
1030 | 1030 | _this.mode = path.mode; |
1031 | 1031 | _this.brushColor = path.color; |
|
1115 | 1115 |
|
1116 | 1116 | var _DOMEvents = createCommonjsModule(function (module, exports) { |
1117 | 1117 | Object.defineProperty(exports, "__esModule", { value: true }); |
1118 | | - exports._removeMouseEvents = exports._addMouseEvents = void 0; |
1119 | | - function _addMouseEvents() { |
| 1118 | + exports._removeDOMEvents = exports._addDOMEvents = void 0; |
| 1119 | + function _addDOMEvents() { |
1120 | 1120 | this.canvas.addEventListener('mousedown', this._mouseDownEventListener); |
1121 | 1121 | this.canvas.addEventListener('mouseup', this._mouseUpEventListener); |
1122 | 1122 | this.canvas.addEventListener('mouseenter', this._mouseEnterEventListener); |
1123 | 1123 | this.canvas.addEventListener('mouseleave', this._mouseLeaveEventListener); |
1124 | 1124 | } |
1125 | | - exports._addMouseEvents = _addMouseEvents; |
1126 | | - function _removeMouseEvents() { |
| 1125 | + exports._addDOMEvents = _addDOMEvents; |
| 1126 | + function _removeDOMEvents() { |
1127 | 1127 | this.canvas.removeEventListener('mousedown', this._mouseDownEventListener); |
1128 | 1128 | this.canvas.removeEventListener('mouseup', this._mouseUpEventListener); |
1129 | 1129 | this.canvas.removeEventListener('mouseenter', this._mouseEnterEventListener); |
1130 | 1130 | this.canvas.removeEventListener('mouseexit', this._mouseLeaveEventListener); |
1131 | 1131 | } |
1132 | | - exports._removeMouseEvents = _removeMouseEvents; |
| 1132 | + exports._removeDOMEvents = _removeDOMEvents; |
1133 | 1133 | }); |
1134 | 1134 |
|
1135 | 1135 | var stroke = createCommonjsModule(function (module, exports) { |
|
1161 | 1161 | this._drawnPaths[this._pathIndex + 1].pathCoords.push(__spreadArrays(endCoords, [true])); |
1162 | 1162 | } |
1163 | 1163 | if (this._strokeHappening) { |
1164 | | - this.canvas.removeEventListener('mousemove', this._strokeEventListener); |
| 1164 | + this.canvas.removeEventListener('mousemove', this._mouseMoveEventListener); |
1165 | 1165 | this._lastCoords = null; |
1166 | 1166 | if (this._drawnPaths[this._pathIndex + 1].pathCoords.length === 0) |
1167 | 1167 | this._drawnPaths.splice(-1, 1); |
|
1245 | 1245 | _this._stroke = _draw._stroke; |
1246 | 1246 | _this._plot = _draw._plot; |
1247 | 1247 | _this._resetBoard = boardManip._resetBoard; |
1248 | | - _this._addMouseEvents = _DOMEvents._addMouseEvents; |
1249 | | - _this._removeMouseEvents = _DOMEvents._removeMouseEvents; |
| 1248 | + _this._addDOMEvents = _DOMEvents._addDOMEvents; |
| 1249 | + _this._removeDOMEvents = _DOMEvents._removeDOMEvents; |
1250 | 1250 | _this._startStroke = stroke._startStroke; |
1251 | 1251 | _this._endStroke = stroke._endStroke; |
1252 | 1252 | _this._doStroke = stroke._doStroke; |
|
1266 | 1266 | }; |
1267 | 1267 | _this._mouseDownEventListener = function (e) { |
1268 | 1268 | if (e.button === 0 /* Left Click */) { |
1269 | | - _this.canvas.addEventListener('mousemove', _this._strokeEventListener); |
| 1269 | + _this.canvas.addEventListener('mousemove', _this._mouseMoveEventListener); |
1270 | 1270 | _this._startStroke(_this._getCoords(e)); |
1271 | 1271 | } |
1272 | 1272 | }; |
|
1282 | 1282 | _this._mouseLeaveEventListener = function (e) { |
1283 | 1283 | _this._endStroke(_this._getCoords(e)); |
1284 | 1284 | }; |
1285 | | - _this._strokeEventListener = function (e) { |
| 1285 | + _this._mouseMoveEventListener = function (e) { |
1286 | 1286 | var coords = _this._getCoords(e); |
1287 | 1287 | _this._doStroke(coords); |
1288 | 1288 | }; |
|
1297 | 1297 | return _this; |
1298 | 1298 | } |
1299 | 1299 | RealDrawBoard.prototype.startRender = function () { |
1300 | | - this._addMouseEvents(); |
| 1300 | + this._addDOMEvents(); |
1301 | 1301 | this._isDrawing = true; |
1302 | 1302 | return this; |
1303 | 1303 | }; |
1304 | 1304 | RealDrawBoard.prototype.stopRender = function () { |
1305 | | - this._removeMouseEvents(); |
| 1305 | + this._removeDOMEvents(); |
1306 | 1306 | this._isDrawing = false; |
1307 | 1307 | return this; |
1308 | 1308 | }; |
|
0 commit comments