Skip to content

Commit 7111bfd

Browse files
author
HarshKhandeparkar
committed
refactor<RealDrawBoard>: bored of
writing this again
1 parent b638a17 commit 7111bfd

File tree

5 files changed

+26
-35
lines changed

5 files changed

+26
-35
lines changed

dist/gpujs-real-renderer-browser.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,15 @@
998998
exports._initializeKernels = _initializeKernels;
999999
});
10001000

1001-
var _stroke_1 = createCommonjsModule(function (module, exports) {
1001+
var _draw = createCommonjsModule(function (module, exports) {
10021002
Object.defineProperty(exports, "__esModule", { value: true });
1003-
exports._stroke = void 0;
1003+
exports._stroke = exports._plot = void 0;
1004+
function _plot(x, y) {
1005+
this.graphPixels = this._plotKernel(this._cloneTexture(this.graphPixels), x, y, this.mode === 'paint' ? this.brushSize : this.eraserSize, this.mode === 'paint' ? this.brushColor : this.bgColor);
1006+
this._display(this.graphPixels);
1007+
return this;
1008+
}
1009+
exports._plot = _plot;
10041010
function _stroke(x, y) {
10051011
if (this._lastCoords === null)
10061012
this._lastCoords = [x, y];
@@ -1010,17 +1016,6 @@
10101016
exports._stroke = _stroke;
10111017
});
10121018

1013-
var _plot_1 = createCommonjsModule(function (module, exports) {
1014-
Object.defineProperty(exports, "__esModule", { value: true });
1015-
exports._plot = void 0;
1016-
function _plot(x, y) {
1017-
this.graphPixels = this._plotKernel(this._cloneTexture(this.graphPixels), x, y, this.mode === 'paint' ? this.brushSize : this.eraserSize, this.mode === 'paint' ? this.brushColor : this.bgColor);
1018-
this._display(this.graphPixels);
1019-
return this;
1020-
}
1021-
exports._plot = _plot;
1022-
});
1023-
10241019
var undo_1 = createCommonjsModule(function (module, exports) {
10251020
Object.defineProperty(exports, "__esModule", { value: true });
10261021
exports.redo = exports.undo = void 0;
@@ -1235,7 +1230,6 @@
12351230

12361231

12371232

1238-
12391233
var RealDrawBoard = /** @class */ (function (_super) {
12401234
__extends(RealDrawBoard, _super);
12411235
function RealDrawBoard(options) {
@@ -1248,8 +1242,8 @@
12481242
_this._pathIndex = -1; // Index of path in _drawnPaths
12491243
_this._lastCoords = null;
12501244
_this._initializeKernels = _initializeKernels_1._initializeKernels;
1251-
_this._stroke = _stroke_1._stroke;
1252-
_this._plot = _plot_1._plot;
1245+
_this._stroke = _draw._stroke;
1246+
_this._plot = _draw._plot;
12531247
_this._resetBoard = boardManip._resetBoard;
12541248
_this._addMouseEvents = _DOMEvents._addMouseEvents;
12551249
_this._removeMouseEvents = _DOMEvents._removeMouseEvents;

dist/gpujs-real-renderer-browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderers/RealDrawBoard/RealDrawBoard.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export * as RealDrawBoardTypes from '../../types/RealDrawBoardTypes';
1111
export * from '../../constants/defaults/RealDrawBoardDefaults';
1212

1313
import { _initializeKernels } from './_initializeKernels';
14-
import { _stroke } from './_stroke';
15-
import { _plot } from './_plot';
14+
import { _plot, _stroke } from './_draw';
1615
import { undo, redo } from './undo';
1716
import {
1817
changeBrushColor,

src/renderers/RealDrawBoard/_stroke.ts renamed to src/renderers/RealDrawBoard/_draw.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import { RealDrawBoard } from './RealDrawBoard';
22
import { Texture } from 'gpu.js';
33

4+
export function _plot(this: RealDrawBoard, x: number, y: number) {
5+
this.graphPixels = <Texture>this._plotKernel(
6+
this._cloneTexture(this.graphPixels),
7+
x,
8+
y,
9+
this.mode === 'paint' ? this.brushSize : this.eraserSize,
10+
this.mode === 'paint' ? this.brushColor : this.bgColor
11+
)
12+
13+
this._display(this.graphPixels);
14+
15+
return this;
16+
}
17+
418
export function _stroke(this: RealDrawBoard, x: number, y: number) {
519
if (this._lastCoords === null) this._lastCoords = [x, y];
620

src/renderers/RealDrawBoard/_plot.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)