@pooder/kit 4.3.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.test-dist/src/CanvasService.js +249 -0
- package/.test-dist/src/ViewportSystem.js +75 -0
- package/.test-dist/src/background.js +203 -0
- package/.test-dist/src/bridgeSelection.js +20 -0
- package/.test-dist/src/constraints.js +237 -0
- package/.test-dist/src/coordinate.js +74 -0
- package/.test-dist/src/dieline.js +723 -0
- package/.test-dist/src/edgeScale.js +12 -0
- package/.test-dist/src/feature.js +752 -0
- package/.test-dist/src/featureComplete.js +32 -0
- package/.test-dist/src/film.js +167 -0
- package/.test-dist/src/geometry.js +506 -0
- package/.test-dist/src/image.js +1234 -0
- package/.test-dist/src/index.js +35 -0
- package/.test-dist/src/maskOps.js +270 -0
- package/.test-dist/src/mirror.js +104 -0
- package/.test-dist/src/renderSpec.js +2 -0
- package/.test-dist/src/ruler.js +343 -0
- package/.test-dist/src/sceneLayout.js +99 -0
- package/.test-dist/src/sceneLayoutModel.js +196 -0
- package/.test-dist/src/sceneView.js +40 -0
- package/.test-dist/src/sceneVisibility.js +42 -0
- package/.test-dist/src/size.js +332 -0
- package/.test-dist/src/tracer.js +544 -0
- package/.test-dist/src/units.js +30 -0
- package/.test-dist/src/white-ink.js +829 -0
- package/.test-dist/src/wrappedOffsets.js +33 -0
- package/.test-dist/tests/run.js +94 -0
- package/CHANGELOG.md +11 -0
- package/dist/index.d.mts +339 -36
- package/dist/index.d.ts +339 -36
- package/dist/index.js +3572 -850
- package/dist/index.mjs +3565 -852
- package/package.json +2 -2
- package/src/CanvasService.ts +300 -96
- package/src/ViewportSystem.ts +92 -92
- package/src/background.ts +230 -230
- package/src/bridgeSelection.ts +17 -0
- package/src/coordinate.ts +106 -106
- package/src/dieline.ts +897 -973
- package/src/edgeScale.ts +19 -0
- package/src/feature.ts +83 -30
- package/src/film.ts +194 -194
- package/src/geometry.ts +242 -84
- package/src/image.ts +1582 -512
- package/src/index.ts +14 -10
- package/src/maskOps.ts +326 -0
- package/src/mirror.ts +128 -128
- package/src/renderSpec.ts +18 -0
- package/src/ruler.ts +449 -508
- package/src/sceneLayout.ts +121 -0
- package/src/sceneLayoutModel.ts +335 -0
- package/src/sceneVisibility.ts +49 -0
- package/src/size.ts +379 -0
- package/src/tracer.ts +719 -570
- package/src/units.ts +27 -27
- package/src/white-ink.ts +1018 -373
- package/src/wrappedOffsets.ts +33 -0
- package/tests/run.ts +118 -0
- package/tsconfig.test.json +15 -15
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.CanvasService = void 0;
|
|
21
|
+
__exportStar(require("./background"), exports);
|
|
22
|
+
__exportStar(require("./dieline"), exports);
|
|
23
|
+
__exportStar(require("./film"), exports);
|
|
24
|
+
__exportStar(require("./feature"), exports);
|
|
25
|
+
__exportStar(require("./image"), exports);
|
|
26
|
+
__exportStar(require("./white-ink"), exports);
|
|
27
|
+
__exportStar(require("./ruler"), exports);
|
|
28
|
+
__exportStar(require("./mirror"), exports);
|
|
29
|
+
__exportStar(require("./size"), exports);
|
|
30
|
+
__exportStar(require("./sceneLayout"), exports);
|
|
31
|
+
__exportStar(require("./sceneLayoutModel"), exports);
|
|
32
|
+
__exportStar(require("./sceneVisibility"), exports);
|
|
33
|
+
__exportStar(require("./units"), exports);
|
|
34
|
+
var CanvasService_1 = require("./CanvasService");
|
|
35
|
+
Object.defineProperty(exports, "CanvasService", { enumerable: true, get: function () { return __importDefault(CanvasService_1).default; } });
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMask = createMask;
|
|
4
|
+
exports.circularMorphology = circularMorphology;
|
|
5
|
+
exports.fillHoles = fillHoles;
|
|
6
|
+
exports.countForeground = countForeground;
|
|
7
|
+
exports.isMaskConnected8 = isMaskConnected8;
|
|
8
|
+
exports.findMinimalConnectRadius = findMinimalConnectRadius;
|
|
9
|
+
exports.polygonSignedArea = polygonSignedArea;
|
|
10
|
+
function createMask(imageData, options) {
|
|
11
|
+
const { width, height, data } = imageData;
|
|
12
|
+
const { threshold, padding, paddedWidth, paddedHeight, maskMode = "auto", whiteThreshold = 240, alphaOpaqueCutoff = 250, } = options;
|
|
13
|
+
const resolvedMode = maskMode === "auto" ? inferMaskMode(imageData, alphaOpaqueCutoff) : maskMode;
|
|
14
|
+
const mask = new Uint8Array(paddedWidth * paddedHeight);
|
|
15
|
+
for (let y = 0; y < height; y++) {
|
|
16
|
+
for (let x = 0; x < width; x++) {
|
|
17
|
+
const srcIdx = (y * width + x) * 4;
|
|
18
|
+
const r = data[srcIdx];
|
|
19
|
+
const g = data[srcIdx + 1];
|
|
20
|
+
const b = data[srcIdx + 2];
|
|
21
|
+
const a = data[srcIdx + 3];
|
|
22
|
+
const destIdx = (y + padding) * paddedWidth + (x + padding);
|
|
23
|
+
if (resolvedMode === "alpha") {
|
|
24
|
+
if (a > threshold)
|
|
25
|
+
mask[destIdx] = 1;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (a > threshold &&
|
|
29
|
+
!(r > whiteThreshold && g > whiteThreshold && b > whiteThreshold)) {
|
|
30
|
+
mask[destIdx] = 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return mask;
|
|
36
|
+
}
|
|
37
|
+
function inferMaskMode(imageData, alphaOpaqueCutoff) {
|
|
38
|
+
const { data } = imageData;
|
|
39
|
+
const total = data.length / 4;
|
|
40
|
+
let belowOpaque = 0;
|
|
41
|
+
let veryTransparent = 0;
|
|
42
|
+
let minAlpha = 255;
|
|
43
|
+
for (let i = 3; i < data.length; i += 4) {
|
|
44
|
+
const a = data[i];
|
|
45
|
+
if (a < minAlpha)
|
|
46
|
+
minAlpha = a;
|
|
47
|
+
if (a < alphaOpaqueCutoff)
|
|
48
|
+
belowOpaque++;
|
|
49
|
+
if (a < 32)
|
|
50
|
+
veryTransparent++;
|
|
51
|
+
}
|
|
52
|
+
if (minAlpha === 255)
|
|
53
|
+
return "whitebg";
|
|
54
|
+
const belowOpaqueRatio = belowOpaque / total;
|
|
55
|
+
const veryTransparentRatio = veryTransparent / total;
|
|
56
|
+
if (veryTransparentRatio >= 0.0005)
|
|
57
|
+
return "alpha";
|
|
58
|
+
if (belowOpaqueRatio >= 0.01)
|
|
59
|
+
return "alpha";
|
|
60
|
+
return "whitebg";
|
|
61
|
+
}
|
|
62
|
+
function circularMorphology(mask, width, height, radius, op) {
|
|
63
|
+
const dilate = (m, r) => {
|
|
64
|
+
const horizontalDist = new Int32Array(width * height);
|
|
65
|
+
for (let y = 0; y < height; y++) {
|
|
66
|
+
let lastSolid = -r * 2;
|
|
67
|
+
for (let x = 0; x < width; x++) {
|
|
68
|
+
if (m[y * width + x])
|
|
69
|
+
lastSolid = x;
|
|
70
|
+
horizontalDist[y * width + x] = x - lastSolid;
|
|
71
|
+
}
|
|
72
|
+
lastSolid = width + r * 2;
|
|
73
|
+
for (let x = width - 1; x >= 0; x--) {
|
|
74
|
+
if (m[y * width + x])
|
|
75
|
+
lastSolid = x;
|
|
76
|
+
horizontalDist[y * width + x] = Math.min(horizontalDist[y * width + x], lastSolid - x);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const result = new Uint8Array(width * height);
|
|
80
|
+
const r2 = r * r;
|
|
81
|
+
for (let x = 0; x < width; x++) {
|
|
82
|
+
for (let y = 0; y < height; y++) {
|
|
83
|
+
let found = false;
|
|
84
|
+
const minY = Math.max(0, y - r);
|
|
85
|
+
const maxY = Math.min(height - 1, y + r);
|
|
86
|
+
for (let dy = minY; dy <= maxY; dy++) {
|
|
87
|
+
const dY = dy - y;
|
|
88
|
+
const hDist = horizontalDist[dy * width + x];
|
|
89
|
+
if (hDist * hDist + dY * dY <= r2) {
|
|
90
|
+
found = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (found)
|
|
95
|
+
result[y * width + x] = 1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
};
|
|
100
|
+
const erode = (m, r) => {
|
|
101
|
+
const inverted = new Uint8Array(m.length);
|
|
102
|
+
for (let i = 0; i < m.length; i++)
|
|
103
|
+
inverted[i] = m[i] ? 0 : 1;
|
|
104
|
+
const dilatedInverted = dilate(inverted, r);
|
|
105
|
+
const result = new Uint8Array(m.length);
|
|
106
|
+
for (let i = 0; i < m.length; i++)
|
|
107
|
+
result[i] = dilatedInverted[i] ? 0 : 1;
|
|
108
|
+
return result;
|
|
109
|
+
};
|
|
110
|
+
switch (op) {
|
|
111
|
+
case "dilate":
|
|
112
|
+
return dilate(mask, radius);
|
|
113
|
+
case "erode":
|
|
114
|
+
return erode(mask, radius);
|
|
115
|
+
case "closing":
|
|
116
|
+
return erode(dilate(mask, radius), radius);
|
|
117
|
+
case "opening":
|
|
118
|
+
return dilate(erode(mask, radius), radius);
|
|
119
|
+
default:
|
|
120
|
+
return mask;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function fillHoles(mask, width, height) {
|
|
124
|
+
const background = new Uint8Array(width * height);
|
|
125
|
+
const queue = [];
|
|
126
|
+
for (let x = 0; x < width; x++) {
|
|
127
|
+
if (mask[x] === 0) {
|
|
128
|
+
background[x] = 1;
|
|
129
|
+
queue.push(x);
|
|
130
|
+
}
|
|
131
|
+
const lastRowIdx = (height - 1) * width + x;
|
|
132
|
+
if (mask[lastRowIdx] === 0) {
|
|
133
|
+
background[lastRowIdx] = 1;
|
|
134
|
+
queue.push(lastRowIdx);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (let y = 1; y < height - 1; y++) {
|
|
138
|
+
const leftIdx = y * width;
|
|
139
|
+
const rightIdx = y * width + (width - 1);
|
|
140
|
+
if (mask[leftIdx] === 0) {
|
|
141
|
+
background[leftIdx] = 1;
|
|
142
|
+
queue.push(leftIdx);
|
|
143
|
+
}
|
|
144
|
+
if (mask[rightIdx] === 0) {
|
|
145
|
+
background[rightIdx] = 1;
|
|
146
|
+
queue.push(rightIdx);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let head = 0;
|
|
150
|
+
while (head < queue.length) {
|
|
151
|
+
const idx = queue[head++];
|
|
152
|
+
const x = idx % width;
|
|
153
|
+
const y = (idx - x) / width;
|
|
154
|
+
const up = y > 0 ? idx - width : -1;
|
|
155
|
+
const down = y < height - 1 ? idx + width : -1;
|
|
156
|
+
const left = x > 0 ? idx - 1 : -1;
|
|
157
|
+
const right = x < width - 1 ? idx + 1 : -1;
|
|
158
|
+
if (up >= 0 && mask[up] === 0 && background[up] === 0) {
|
|
159
|
+
background[up] = 1;
|
|
160
|
+
queue.push(up);
|
|
161
|
+
}
|
|
162
|
+
if (down >= 0 && mask[down] === 0 && background[down] === 0) {
|
|
163
|
+
background[down] = 1;
|
|
164
|
+
queue.push(down);
|
|
165
|
+
}
|
|
166
|
+
if (left >= 0 && mask[left] === 0 && background[left] === 0) {
|
|
167
|
+
background[left] = 1;
|
|
168
|
+
queue.push(left);
|
|
169
|
+
}
|
|
170
|
+
if (right >= 0 && mask[right] === 0 && background[right] === 0) {
|
|
171
|
+
background[right] = 1;
|
|
172
|
+
queue.push(right);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const filledMask = new Uint8Array(width * height);
|
|
176
|
+
for (let i = 0; i < width * height; i++) {
|
|
177
|
+
filledMask[i] = background[i] === 0 ? 1 : 0;
|
|
178
|
+
}
|
|
179
|
+
return filledMask;
|
|
180
|
+
}
|
|
181
|
+
function countForeground(mask) {
|
|
182
|
+
let c = 0;
|
|
183
|
+
for (let i = 0; i < mask.length; i++)
|
|
184
|
+
c += mask[i] ? 1 : 0;
|
|
185
|
+
return c;
|
|
186
|
+
}
|
|
187
|
+
function isMaskConnected8(mask, width, height) {
|
|
188
|
+
const total = countForeground(mask);
|
|
189
|
+
if (total === 0)
|
|
190
|
+
return true;
|
|
191
|
+
let start = -1;
|
|
192
|
+
for (let i = 0; i < mask.length; i++) {
|
|
193
|
+
if (mask[i]) {
|
|
194
|
+
start = i;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (start === -1)
|
|
199
|
+
return true;
|
|
200
|
+
const visited = new Uint8Array(mask.length);
|
|
201
|
+
const queue = [start];
|
|
202
|
+
visited[start] = 1;
|
|
203
|
+
let seen = 1;
|
|
204
|
+
let head = 0;
|
|
205
|
+
while (head < queue.length) {
|
|
206
|
+
const idx = queue[head++];
|
|
207
|
+
const x = idx % width;
|
|
208
|
+
const y = (idx - x) / width;
|
|
209
|
+
for (let dy = -1; dy <= 1; dy++) {
|
|
210
|
+
const ny = y + dy;
|
|
211
|
+
if (ny < 0 || ny >= height)
|
|
212
|
+
continue;
|
|
213
|
+
for (let dx = -1; dx <= 1; dx++) {
|
|
214
|
+
if (dx === 0 && dy === 0)
|
|
215
|
+
continue;
|
|
216
|
+
const nx = x + dx;
|
|
217
|
+
if (nx < 0 || nx >= width)
|
|
218
|
+
continue;
|
|
219
|
+
const nidx = ny * width + nx;
|
|
220
|
+
if (mask[nidx] && !visited[nidx]) {
|
|
221
|
+
visited[nidx] = 1;
|
|
222
|
+
queue.push(nidx);
|
|
223
|
+
seen++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return seen === total;
|
|
229
|
+
}
|
|
230
|
+
function findMinimalConnectRadius(mask, width, height, maxRadius) {
|
|
231
|
+
if (maxRadius <= 0)
|
|
232
|
+
return 0;
|
|
233
|
+
if (isMaskConnected8(mask, width, height))
|
|
234
|
+
return 0;
|
|
235
|
+
let low = 0;
|
|
236
|
+
let high = 1;
|
|
237
|
+
while (high <= maxRadius) {
|
|
238
|
+
const closed = circularMorphology(mask, width, height, high, "closing");
|
|
239
|
+
if (isMaskConnected8(closed, width, height))
|
|
240
|
+
break;
|
|
241
|
+
high *= 2;
|
|
242
|
+
}
|
|
243
|
+
if (high > maxRadius)
|
|
244
|
+
high = maxRadius;
|
|
245
|
+
if (!isMaskConnected8(circularMorphology(mask, width, height, high, "closing"), width, height)) {
|
|
246
|
+
return high;
|
|
247
|
+
}
|
|
248
|
+
while (low + 1 < high) {
|
|
249
|
+
const mid = Math.floor((low + high) / 2);
|
|
250
|
+
const closed = circularMorphology(mask, width, height, mid, "closing");
|
|
251
|
+
if (isMaskConnected8(closed, width, height)) {
|
|
252
|
+
high = mid;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
low = mid;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return high;
|
|
259
|
+
}
|
|
260
|
+
function polygonSignedArea(points) {
|
|
261
|
+
if (points.length < 3)
|
|
262
|
+
return 0;
|
|
263
|
+
let sum = 0;
|
|
264
|
+
for (let i = 0; i < points.length; i++) {
|
|
265
|
+
const a = points[i];
|
|
266
|
+
const b = points[(i + 1) % points.length];
|
|
267
|
+
sum += a.x * b.y - b.x * a.y;
|
|
268
|
+
}
|
|
269
|
+
return sum / 2;
|
|
270
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MirrorTool = void 0;
|
|
4
|
+
const core_1 = require("@pooder/core");
|
|
5
|
+
class MirrorTool {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.id = "pooder.kit.mirror";
|
|
8
|
+
this.metadata = {
|
|
9
|
+
name: "MirrorTool",
|
|
10
|
+
};
|
|
11
|
+
this.enabled = false;
|
|
12
|
+
if (options) {
|
|
13
|
+
Object.assign(this, options);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
toJSON() {
|
|
17
|
+
return {
|
|
18
|
+
enabled: this.enabled,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
loadFromJSON(json) {
|
|
22
|
+
this.enabled = json.enabled;
|
|
23
|
+
}
|
|
24
|
+
activate(context) {
|
|
25
|
+
this.canvasService = context.services.get("CanvasService");
|
|
26
|
+
if (!this.canvasService) {
|
|
27
|
+
console.warn("CanvasService not found for MirrorTool");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const configService = context.services.get("ConfigurationService");
|
|
31
|
+
if (configService) {
|
|
32
|
+
// Load initial config
|
|
33
|
+
this.enabled = configService.get("mirror.enabled", this.enabled);
|
|
34
|
+
// Listen for changes
|
|
35
|
+
configService.onAnyChange((e) => {
|
|
36
|
+
if (e.key === "mirror.enabled") {
|
|
37
|
+
this.applyMirror(e.value);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Initialize with current state (if enabled was persisted)
|
|
42
|
+
if (this.enabled) {
|
|
43
|
+
this.applyMirror(true);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
deactivate(context) {
|
|
47
|
+
this.applyMirror(false);
|
|
48
|
+
this.canvasService = undefined;
|
|
49
|
+
}
|
|
50
|
+
contribute() {
|
|
51
|
+
return {
|
|
52
|
+
[core_1.ContributionPointIds.CONFIGURATIONS]: [
|
|
53
|
+
{
|
|
54
|
+
id: "mirror.enabled",
|
|
55
|
+
type: "boolean",
|
|
56
|
+
label: "Enable Mirror",
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
[core_1.ContributionPointIds.COMMANDS]: [
|
|
61
|
+
{
|
|
62
|
+
command: "setMirror",
|
|
63
|
+
title: "Set Mirror",
|
|
64
|
+
handler: (enabled) => {
|
|
65
|
+
this.applyMirror(enabled);
|
|
66
|
+
return true;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
applyMirror(enabled) {
|
|
73
|
+
if (!this.canvasService)
|
|
74
|
+
return;
|
|
75
|
+
const canvas = this.canvasService.canvas;
|
|
76
|
+
if (!canvas)
|
|
77
|
+
return;
|
|
78
|
+
const width = canvas.width || 800;
|
|
79
|
+
// Fabric.js v6+ uses viewportTransform property
|
|
80
|
+
let vpt = canvas.viewportTransform || [1, 0, 0, 1, 0, 0];
|
|
81
|
+
// Create a copy to avoid mutating the reference directly before setting
|
|
82
|
+
vpt = [...vpt];
|
|
83
|
+
// If we are enabling and currently not flipped (scaleX > 0)
|
|
84
|
+
// Or disabling and currently flipped (scaleX < 0)
|
|
85
|
+
const isFlipped = vpt[0] < 0;
|
|
86
|
+
if (enabled && !isFlipped) {
|
|
87
|
+
// Flip scale X
|
|
88
|
+
vpt[0] = -vpt[0]; // Flip scale
|
|
89
|
+
vpt[4] = width - vpt[4]; // Adjust pan X
|
|
90
|
+
canvas.setViewportTransform(vpt);
|
|
91
|
+
canvas.requestRenderAll();
|
|
92
|
+
this.enabled = true;
|
|
93
|
+
}
|
|
94
|
+
else if (!enabled && isFlipped) {
|
|
95
|
+
// Restore
|
|
96
|
+
vpt[0] = -vpt[0]; // Unflip scale
|
|
97
|
+
vpt[4] = width - vpt[4]; // Restore pan X
|
|
98
|
+
canvas.setViewportTransform(vpt);
|
|
99
|
+
canvas.requestRenderAll();
|
|
100
|
+
this.enabled = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.MirrorTool = MirrorTool;
|