mudlet-map-renderer 2.2.0 → 2.3.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/README.md +28 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +913 -485
- package/dist/index.mjs.map +1 -1
- package/dist/labelPlacement.d.ts +132 -0
- package/dist/overlay/RippleEffect.d.ts +48 -0
- package/dist/style/index.d.ts +14 -0
- package/dist/style/shape/DarkModernStyle.d.ts +15 -0
- package/dist/style/shape/TreasureMapStyle.d.ts +23 -0
- package/dist/style/shape/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as
|
|
2
|
-
import { n as
|
|
3
|
-
import
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as ee, p as te, r as C, s as w, u as ne, v as T, w as E, x as re, y as ie } from "./flushSceneShapes-Duhi0OQv.js";
|
|
2
|
+
import { n as ae, r as oe, t as se } from "./MapReader-Brzg-X7T.js";
|
|
3
|
+
import D from "konva";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
6
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
5
|
+
var ce = Object.create, le = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, de = Object.getOwnPropertyNames, fe = Object.getPrototypeOf, pe = Object.prototype.hasOwnProperty, O = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), me = (e, t, n, r) => {
|
|
6
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = de(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !pe.call(e, s) && s !== n && le(e, s, {
|
|
7
7
|
get: ((e) => t[e]).bind(null, s),
|
|
8
|
-
enumerable: !(r =
|
|
8
|
+
enumerable: !(r = ue(t, s)) || r.enumerable
|
|
9
9
|
});
|
|
10
10
|
return e;
|
|
11
|
-
},
|
|
11
|
+
}, he = (e, t, n) => (n = e == null ? {} : ce(fe(e)), me(t || !e || !e.__esModule ? le(n, "default", {
|
|
12
12
|
value: e,
|
|
13
13
|
enumerable: !0
|
|
14
|
-
}) : n, e)),
|
|
15
|
-
function
|
|
14
|
+
}) : n, e)), ge = .6, _e = .025, ve = "rgb(225, 255, 225)";
|
|
15
|
+
function ye() {
|
|
16
16
|
return {
|
|
17
|
-
roomSize:
|
|
18
|
-
lineWidth:
|
|
19
|
-
lineColor:
|
|
17
|
+
roomSize: ge,
|
|
18
|
+
lineWidth: _e,
|
|
19
|
+
lineColor: ve,
|
|
20
20
|
backgroundColor: "#000000",
|
|
21
21
|
instantMapMove: !1,
|
|
22
22
|
highlightCurrentRoom: !0,
|
|
@@ -64,7 +64,7 @@ function ve() {
|
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/MapState.ts
|
|
67
|
-
var
|
|
67
|
+
var be = class {
|
|
68
68
|
constructor(e, t) {
|
|
69
69
|
this.events = new y(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = n, this.mapReader = e, this.settings = t;
|
|
70
70
|
}
|
|
@@ -199,7 +199,7 @@ var ye = class {
|
|
|
199
199
|
};
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/scene/elements/GridLayout.ts
|
|
202
|
-
function
|
|
202
|
+
function xe(e, t, n = {}) {
|
|
203
203
|
if (!t.gridEnabled) return [];
|
|
204
204
|
let r = n.inverseTransform ?? ((e, t) => ({
|
|
205
205
|
x: e,
|
|
@@ -236,11 +236,11 @@ function be(e, t, n = {}) {
|
|
|
236
236
|
}
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region src/export/clipSceneToViewport.ts
|
|
239
|
-
function
|
|
239
|
+
function Se(e, t, n, r) {
|
|
240
240
|
if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
|
|
241
241
|
let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
|
|
242
242
|
if (l) {
|
|
243
|
-
let c =
|
|
243
|
+
let c = Ce(e, t, n, r, l);
|
|
244
244
|
return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
|
|
245
245
|
}
|
|
246
246
|
return n >= i && e <= a && r >= o && t <= s;
|
|
@@ -253,7 +253,7 @@ function xe(e, t, n, r) {
|
|
|
253
253
|
for (let { shape: t, bounds: n } of e.areaExitLabelShapeRefs) d.set(t, u(n.x, n.y, n.x + n.width, n.y + n.height));
|
|
254
254
|
return d;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function Ce(e, t, n, r, i) {
|
|
257
257
|
let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
|
|
258
258
|
return {
|
|
259
259
|
minX: Math.min(a.x, o.x, s.x, c.x),
|
|
@@ -262,13 +262,13 @@ function Se(e, t, n, r, i) {
|
|
|
262
262
|
maxY: Math.max(a.y, o.y, s.y, c.y)
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
let i =
|
|
265
|
+
function k(e, t, n, r) {
|
|
266
|
+
let i = xe(t, n, { inverseTransform: r?.inverse });
|
|
267
267
|
if (!n.cullingEnabled) return {
|
|
268
268
|
...e.sceneShapes,
|
|
269
269
|
grid: i
|
|
270
270
|
};
|
|
271
|
-
let a =
|
|
271
|
+
let a = Se(e, t, n, r);
|
|
272
272
|
return {
|
|
273
273
|
grid: i,
|
|
274
274
|
link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
|
|
@@ -278,12 +278,12 @@ function A(e, t, n, r) {
|
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region src/rendering/SceneManager.ts
|
|
281
|
-
var
|
|
281
|
+
var we = {
|
|
282
282
|
grid: [],
|
|
283
283
|
link: [],
|
|
284
284
|
room: [],
|
|
285
285
|
topLabel: []
|
|
286
|
-
},
|
|
286
|
+
}, Te = class {
|
|
287
287
|
constructor(e, t, n) {
|
|
288
288
|
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new g(n, t);
|
|
289
289
|
}
|
|
@@ -323,18 +323,18 @@ var Ce = {
|
|
|
323
323
|
cullInteractive(e = c) {
|
|
324
324
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
325
325
|
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === c ? void 0 : { forward: e };
|
|
326
|
-
return
|
|
326
|
+
return Se(this.lastBuildResult, t, this.settings, n);
|
|
327
327
|
}
|
|
328
328
|
cull(e = c) {
|
|
329
329
|
if (!this.lastBuildResult) return {
|
|
330
|
-
shapes:
|
|
330
|
+
shapes: we,
|
|
331
331
|
stats: {
|
|
332
332
|
visibleRooms: 0,
|
|
333
333
|
totalRooms: 0,
|
|
334
334
|
visibleExits: 0
|
|
335
335
|
}
|
|
336
336
|
};
|
|
337
|
-
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === c ? void 0 : { forward: e }, r =
|
|
337
|
+
let t = this.camera.getCullingViewport(this.settings.cullingBounds), n = e === c ? void 0 : { forward: e }, r = k(this.lastBuildResult, t, this.settings, n);
|
|
338
338
|
return {
|
|
339
339
|
shapes: r,
|
|
340
340
|
stats: {
|
|
@@ -347,7 +347,7 @@ var Ce = {
|
|
|
347
347
|
};
|
|
348
348
|
//#endregion
|
|
349
349
|
//#region src/render/canvasGradient.ts
|
|
350
|
-
function
|
|
350
|
+
function A(e, t) {
|
|
351
351
|
if (typeof t == "string") return t;
|
|
352
352
|
if (t.type === "linear") {
|
|
353
353
|
let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
|
|
@@ -360,13 +360,13 @@ function j(e, t) {
|
|
|
360
360
|
}
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region src/render/RecordingLayer.ts
|
|
363
|
-
function
|
|
363
|
+
function Ee(e, t) {
|
|
364
364
|
switch (t.type) {
|
|
365
365
|
case "rect":
|
|
366
|
-
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle =
|
|
366
|
+
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
367
367
|
break;
|
|
368
368
|
case "circle":
|
|
369
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
369
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, t.dash ? e.setLineDash(t.dash) : e.setLineDash([]), e.stroke());
|
|
370
370
|
break;
|
|
371
371
|
case "line": {
|
|
372
372
|
if (t.points.length < 4) break;
|
|
@@ -380,7 +380,7 @@ function Te(e, t) {
|
|
|
380
380
|
if (t.vertices.length < 4) break;
|
|
381
381
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
382
382
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
383
|
-
e.closePath(), t.fill && (e.fillStyle =
|
|
383
|
+
e.closePath(), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
384
384
|
break;
|
|
385
385
|
case "text": {
|
|
386
386
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -417,7 +417,7 @@ function Te(e, t) {
|
|
|
417
417
|
break;
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
var
|
|
420
|
+
var De = class {
|
|
421
421
|
constructor(e, t) {
|
|
422
422
|
this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
|
|
423
423
|
}
|
|
@@ -447,26 +447,26 @@ var Ee = class {
|
|
|
447
447
|
}
|
|
448
448
|
materialize() {
|
|
449
449
|
if (this._konvaGroup) return this._konvaGroup;
|
|
450
|
-
let e = new
|
|
450
|
+
let e = new D.Group({
|
|
451
451
|
x: this.x,
|
|
452
452
|
y: this.y,
|
|
453
453
|
listening: !1,
|
|
454
454
|
visible: this._visible
|
|
455
455
|
}), t = this.commands;
|
|
456
|
-
return e.add(new
|
|
456
|
+
return e.add(new D.Shape({
|
|
457
457
|
listening: !1,
|
|
458
458
|
perfectDrawEnabled: !1,
|
|
459
459
|
sceneFunc: (e) => {
|
|
460
460
|
let n = e._context;
|
|
461
|
-
for (let e of t)
|
|
461
|
+
for (let e of t) Ee(n, e);
|
|
462
462
|
}
|
|
463
463
|
})), this._konvaGroup = e, e;
|
|
464
464
|
}
|
|
465
|
-
},
|
|
465
|
+
}, Oe = class {
|
|
466
466
|
constructor(e) {
|
|
467
467
|
this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
|
|
468
468
|
let t = this;
|
|
469
|
-
this.konvaShape = new
|
|
469
|
+
this.konvaShape = new D.Shape({
|
|
470
470
|
listening: !1,
|
|
471
471
|
perfectDrawEnabled: !1,
|
|
472
472
|
sceneFunc: (e) => {
|
|
@@ -475,7 +475,7 @@ var Ee = class {
|
|
|
475
475
|
if (!e.visible) continue;
|
|
476
476
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
477
477
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
478
|
-
for (let t of e.commands)
|
|
478
|
+
for (let t of e.commands) Ee(n, t);
|
|
479
479
|
}
|
|
480
480
|
n.setTransform(r);
|
|
481
481
|
}
|
|
@@ -503,11 +503,11 @@ var Ee = class {
|
|
|
503
503
|
ensureShape() {
|
|
504
504
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
505
505
|
}
|
|
506
|
-
},
|
|
506
|
+
}, j = class {
|
|
507
507
|
constructor(e) {
|
|
508
508
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
509
509
|
let t = this;
|
|
510
|
-
this.konvaShape = new
|
|
510
|
+
this.konvaShape = new D.Shape({
|
|
511
511
|
listening: !1,
|
|
512
512
|
perfectDrawEnabled: !1,
|
|
513
513
|
sceneFunc: (e) => {
|
|
@@ -516,7 +516,7 @@ var Ee = class {
|
|
|
516
516
|
if (!e._visible) continue;
|
|
517
517
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
518
518
|
e.noScaling ? n.setTransform(75, 0, 0, 75, t, c) : n.setTransform(i, a, o, s, t, c);
|
|
519
|
-
for (let t of e.commands)
|
|
519
|
+
for (let t of e.commands) Ee(n, t);
|
|
520
520
|
}
|
|
521
521
|
n.setTransform(r);
|
|
522
522
|
}
|
|
@@ -534,7 +534,7 @@ var Ee = class {
|
|
|
534
534
|
ensureShape() {
|
|
535
535
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
536
536
|
}
|
|
537
|
-
},
|
|
537
|
+
}, ke = class {
|
|
538
538
|
constructor(e) {
|
|
539
539
|
this.konvaLayer = e;
|
|
540
540
|
}
|
|
@@ -550,14 +550,14 @@ var Ee = class {
|
|
|
550
550
|
};
|
|
551
551
|
//#endregion
|
|
552
552
|
//#region src/scene/Shape.ts
|
|
553
|
-
function
|
|
553
|
+
function Ae(e) {
|
|
554
554
|
return typeof e == "object" && !!e;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function je(e, t) {
|
|
557
557
|
return t !== !1 && e ? e : void 0;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
return
|
|
559
|
+
function M(e, t, n, r, i, a) {
|
|
560
|
+
return Ae(e) ? e.type === "linear" ? {
|
|
561
561
|
type: "linear",
|
|
562
562
|
x0: (t + e.x0) * r + i,
|
|
563
563
|
y0: (n + e.y0) * r + a,
|
|
@@ -577,14 +577,14 @@ function N(e, t, n, r, i, a) {
|
|
|
577
577
|
}
|
|
578
578
|
//#endregion
|
|
579
579
|
//#region src/render/shapeToRecording.ts
|
|
580
|
-
function
|
|
581
|
-
let t = new
|
|
582
|
-
return e.noScale && (t.noScaling = !0),
|
|
583
|
-
}
|
|
584
|
-
function Me(e, t, n, r) {
|
|
585
|
-
for (let i of t) Ne(e, i, n, r);
|
|
580
|
+
function Me(e) {
|
|
581
|
+
let t = new De(e.x, e.y);
|
|
582
|
+
return e.noScale && (t.noScaling = !0), Ne(t, e.children, 0, 0), t;
|
|
586
583
|
}
|
|
587
584
|
function Ne(e, t, n, r) {
|
|
585
|
+
for (let i of t) Pe(e, i, n, r);
|
|
586
|
+
}
|
|
587
|
+
function Pe(e, t, n, r) {
|
|
588
588
|
switch (t.type) {
|
|
589
589
|
case "rect":
|
|
590
590
|
e.commands.push({
|
|
@@ -593,11 +593,11 @@ function Ne(e, t, n, r) {
|
|
|
593
593
|
y: t.y + r,
|
|
594
594
|
w: t.width,
|
|
595
595
|
h: t.height,
|
|
596
|
-
fill:
|
|
596
|
+
fill: M(t.paint.fill, n, r, 1, 0, 0),
|
|
597
597
|
stroke: t.paint.stroke,
|
|
598
598
|
sw: t.paint.strokeWidth ?? 0,
|
|
599
599
|
cr: t.cornerRadius ?? 0,
|
|
600
|
-
dash:
|
|
600
|
+
dash: je(t.paint.dash, t.paint.dashEnabled)
|
|
601
601
|
});
|
|
602
602
|
return;
|
|
603
603
|
case "circle":
|
|
@@ -606,20 +606,20 @@ function Ne(e, t, n, r) {
|
|
|
606
606
|
cx: t.cx + n,
|
|
607
607
|
cy: t.cy + r,
|
|
608
608
|
r: t.radius,
|
|
609
|
-
fill:
|
|
609
|
+
fill: M(t.paint.fill, n, r, 1, 0, 0),
|
|
610
610
|
stroke: t.paint.stroke,
|
|
611
611
|
sw: t.paint.strokeWidth ?? 0,
|
|
612
|
-
dash:
|
|
612
|
+
dash: je(t.paint.dash, t.paint.dashEnabled)
|
|
613
613
|
});
|
|
614
614
|
return;
|
|
615
615
|
case "line": {
|
|
616
|
-
let i = n === 0 && r === 0 ? t.points :
|
|
616
|
+
let i = n === 0 && r === 0 ? t.points : Fe(t.points, n, r);
|
|
617
617
|
e.commands.push({
|
|
618
618
|
type: "line",
|
|
619
619
|
points: i,
|
|
620
620
|
stroke: t.paint.stroke,
|
|
621
621
|
sw: t.paint.strokeWidth ?? 0,
|
|
622
|
-
dash:
|
|
622
|
+
dash: je(t.paint.dash, t.paint.dashEnabled),
|
|
623
623
|
lineCap: t.lineCap,
|
|
624
624
|
lineJoin: t.lineJoin,
|
|
625
625
|
alpha: t.paint.alpha
|
|
@@ -629,8 +629,8 @@ function Ne(e, t, n, r) {
|
|
|
629
629
|
case "polygon":
|
|
630
630
|
e.commands.push({
|
|
631
631
|
type: "polygon",
|
|
632
|
-
vertices: n === 0 && r === 0 ? t.vertices :
|
|
633
|
-
fill:
|
|
632
|
+
vertices: n === 0 && r === 0 ? t.vertices : Fe(t.vertices, n, r),
|
|
633
|
+
fill: M(t.paint.fill, n, r, 1, 0, 0),
|
|
634
634
|
stroke: t.paint.stroke,
|
|
635
635
|
sw: t.paint.strokeWidth ?? 0
|
|
636
636
|
});
|
|
@@ -656,7 +656,7 @@ function Ne(e, t, n, r) {
|
|
|
656
656
|
});
|
|
657
657
|
return;
|
|
658
658
|
case "image": {
|
|
659
|
-
let i =
|
|
659
|
+
let i = Ie(t.src);
|
|
660
660
|
e.commands.push({
|
|
661
661
|
type: "image",
|
|
662
662
|
x: t.x + n,
|
|
@@ -669,37 +669,37 @@ function Ne(e, t, n, r) {
|
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
671
|
case "group":
|
|
672
|
-
|
|
672
|
+
Ne(e, t.children, n + t.x, r + t.y);
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function Fe(e, t, n) {
|
|
677
677
|
let r = Array(e.length);
|
|
678
678
|
for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
|
|
679
679
|
return r;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
let t =
|
|
681
|
+
function Ie(e) {
|
|
682
|
+
let t = D === void 0 ? typeof Image < "u" ? new Image() : null : D.Util.createImageElement();
|
|
683
683
|
return t && (t.src = e), t;
|
|
684
684
|
}
|
|
685
685
|
//#endregion
|
|
686
686
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
687
|
-
var
|
|
687
|
+
var N = "rgb(120, 72, 0)", Le = class {
|
|
688
688
|
get coordinateTransform() {
|
|
689
689
|
return this._coordinateTransform;
|
|
690
690
|
}
|
|
691
691
|
constructor(e, t) {
|
|
692
|
-
this.gridCachedBounds = null, this.currentStyle = u, this.hitTester = new
|
|
692
|
+
this.gridCachedBounds = null, this.currentStyle = u, this.hitTester = new ee(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = c, this.coordinateInverse = c, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = e, this.container = t, t ? (this.stage = new D.Stage({
|
|
693
693
|
container: t,
|
|
694
694
|
width: t.clientWidth,
|
|
695
695
|
height: t.clientHeight,
|
|
696
696
|
draggable: !1
|
|
697
|
-
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new r(t.clientWidth, t.clientHeight)) : (this.stage = new
|
|
697
|
+
}), t.style.backgroundColor = e.settings.backgroundColor, this.camera = new r(t.clientWidth, t.clientHeight)) : (this.stage = new D.Stage({
|
|
698
698
|
width: 1,
|
|
699
699
|
height: 1
|
|
700
|
-
}), this.camera = new r(1, 1)), this.gridLayer = new
|
|
701
|
-
let n = new
|
|
702
|
-
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new
|
|
700
|
+
}), this.camera = new r(1, 1)), this.gridLayer = new D.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
701
|
+
let n = new D.Layer({ listening: !1 });
|
|
702
|
+
if (this.linkLayer = n, this.roomLayer = n, this.stage.add(n), this.positionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new D.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new D.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new ke(this.positionLayer), this.overlayLayerNode = new ke(this.overlayLayer), this.sceneNode = new Oe(n), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.sceneManager = new Te(this.camera, e.settings, e.mapReader), this.events = new y(t), this.culling = new E(e.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), t) {
|
|
703
703
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
704
704
|
let n = this.origSetSize;
|
|
705
705
|
this.camera.setSize = (e, t) => {
|
|
@@ -712,7 +712,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
712
712
|
this.applyStyleTransforms(), this.subscribeToState(e);
|
|
713
713
|
}
|
|
714
714
|
setStyle(e) {
|
|
715
|
-
this.currentStyle = e, this.sceneNode = new
|
|
715
|
+
this.currentStyle = e, this.sceneNode = new Oe(this.linkLayer), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.gridCachedBounds = null, this.sceneManager.resetPipeline(this.state.mapReader), this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup.clear(), this.lastHitShapes = [], this.hitTester.clear(), this.applyStyleTransforms(), this.refresh();
|
|
716
716
|
}
|
|
717
717
|
applyStyleTransforms() {
|
|
718
718
|
let e = this.currentStyle, t = e.worldToScene ? (t, n) => e.worldToScene(t, n) : c, n = e.sceneToWorld ? (t, n) => e.sceneToWorld(t, n) : c, r = this.coordinateInverse, i = e.sceneLayerOffset ? (t) => e.sceneLayerOffset(t) : void 0;
|
|
@@ -870,7 +870,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
870
870
|
for (let e of r.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
|
|
871
871
|
}
|
|
872
872
|
addStyledShape(e, t, n = !1) {
|
|
873
|
-
let r = n || this.currentStyle === u ? [e] :
|
|
873
|
+
let r = n || this.currentStyle === u ? [e] : C([e], this.currentStyle, this.styleContext());
|
|
874
874
|
if (r.length === 0) return;
|
|
875
875
|
let i;
|
|
876
876
|
i = r.length === 1 && r[0].type === "group" ? r[0] : {
|
|
@@ -881,7 +881,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
881
881
|
layer: e.layer,
|
|
882
882
|
noScale: e.noScale
|
|
883
883
|
};
|
|
884
|
-
let a =
|
|
884
|
+
let a = Me(i);
|
|
885
885
|
return t.addNode(a), a;
|
|
886
886
|
}
|
|
887
887
|
refreshGrid(e) {
|
|
@@ -893,7 +893,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
893
893
|
let n = this.coordinateInverse, r = n(e.minX, e.minY), i = n(e.maxX, e.minY), a = n(e.maxX, e.maxY), o = n(e.minX, e.maxY), s = Math.min(r.x, i.x, a.x, o.x), c = Math.max(r.x, i.x, a.x, o.x), l = Math.min(r.y, i.y, a.y, o.y), u = Math.max(r.y, i.y, a.y, o.y), d = t.gridSize * 2, f = Math.floor((s - d) / t.gridSize) * t.gridSize, p = Math.ceil((c + d) / t.gridSize) * t.gridSize, m = Math.floor((l - d) / t.gridSize) * t.gridSize, h = Math.ceil((u + d) / t.gridSize) * t.gridSize, g = this.gridCachedBounds;
|
|
894
894
|
if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
|
|
895
895
|
this.gridLayerNode.destroyChildren();
|
|
896
|
-
let _ =
|
|
896
|
+
let _ = xe(e, t, { inverseTransform: this.coordinateInverse });
|
|
897
897
|
for (let e of _) this.addStyledShape(e, this.gridLayerNode);
|
|
898
898
|
this.gridCachedBounds = {
|
|
899
899
|
left: f,
|
|
@@ -963,11 +963,11 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
963
963
|
n.set(e.id, e);
|
|
964
964
|
let r = [], i = this.sceneManager.exitRenderer, a = this.state.lens;
|
|
965
965
|
this.state.currentAreaInstance && this.state.currentZIndex !== void 0 && this.state.currentAreaInstance.getLinkExits(this.state.currentZIndex).filter((t) => t.a === e.id || t.b === e.id).forEach((e) => {
|
|
966
|
-
let t = i.renderDataWithColor(e,
|
|
966
|
+
let t = i.renderDataWithColor(e, N, this.state.currentZIndex);
|
|
967
967
|
t && r.push(this.sceneManager.buildExitShape(t));
|
|
968
968
|
});
|
|
969
|
-
for (let n of d(e, t,
|
|
970
|
-
for (let n of
|
|
969
|
+
for (let n of d(e, t, N)) r.push(l(n, e.id));
|
|
970
|
+
for (let n of re(e, t, N)) r.push(h(n));
|
|
971
971
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
972
972
|
let t = this.state.mapReader.getRoom(e);
|
|
973
973
|
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && a.isVisible(t) && n.set(e, t);
|
|
@@ -975,11 +975,11 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
975
975
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
976
976
|
t && this.currentRoomOverlay.push(t);
|
|
977
977
|
}), n.forEach((n, r) => {
|
|
978
|
-
let i = r === e.id, a =
|
|
979
|
-
strokeOverride: i ?
|
|
978
|
+
let i = r === e.id, a = ie(n, this.state.mapReader, t, {
|
|
979
|
+
strokeOverride: i ? N : t.lineColor,
|
|
980
980
|
flatPipeline: !0
|
|
981
981
|
});
|
|
982
|
-
a.children.push(...
|
|
982
|
+
a.children.push(...T(n, this.state.mapReader, t));
|
|
983
983
|
let o = this.addStyledShape(a, this.positionLayerNode);
|
|
984
984
|
o && this.currentRoomOverlay.push(o);
|
|
985
985
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
@@ -989,7 +989,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
989
989
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
990
990
|
let n = this.state.mapReader.getRoom(e);
|
|
991
991
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
992
|
-
let r =
|
|
992
|
+
let r = ne(n, t, this.state.settings), i = this.addStyledShape(w(r), this.overlayLayerNode);
|
|
993
993
|
i && this.highlightShapes.set(e, i);
|
|
994
994
|
}
|
|
995
995
|
}
|
|
@@ -1002,7 +1002,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
1002
1002
|
if (t.area !== this.state.currentArea || t.z !== this.state.currentZIndex) continue;
|
|
1003
1003
|
let n = this.state.mapReader.getRoom(e);
|
|
1004
1004
|
if (!n) continue;
|
|
1005
|
-
let r =
|
|
1005
|
+
let r = ne(n, t.colors, this.state.settings), i = this.addStyledShape(w(r), this.overlayLayerNode);
|
|
1006
1006
|
i && this.highlightShapes.set(e, i);
|
|
1007
1007
|
}
|
|
1008
1008
|
this.overlayLayerNode.batchDraw();
|
|
@@ -1032,7 +1032,7 @@ var P = "rgb(120, 72, 0)", Ie = class {
|
|
|
1032
1032
|
};
|
|
1033
1033
|
//#endregion
|
|
1034
1034
|
//#region src/style/shape/paintMap.ts
|
|
1035
|
-
function
|
|
1035
|
+
function P(e, t) {
|
|
1036
1036
|
if (e !== void 0) return typeof e == "string" ? t(e) : {
|
|
1037
1037
|
...e,
|
|
1038
1038
|
stops: e.stops.map((e) => ({
|
|
@@ -1041,7 +1041,7 @@ function F(e, t) {
|
|
|
1041
1041
|
}))
|
|
1042
1042
|
};
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function F(e) {
|
|
1045
1045
|
let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
1046
1046
|
return t ? {
|
|
1047
1047
|
r: parseInt(t[1]),
|
|
@@ -1055,13 +1055,13 @@ function I(e) {
|
|
|
1055
1055
|
a: 1
|
|
1056
1056
|
} : null;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function I(e, t, n, r = 1) {
|
|
1059
1059
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function L(e) {
|
|
1062
1062
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Re(e, t, n) {
|
|
1065
1065
|
e /= 255, t /= 255, n /= 255;
|
|
1066
1066
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1067
1067
|
if (r === i) return [
|
|
@@ -1076,99 +1076,99 @@ function Le(e, t, n) {
|
|
|
1076
1076
|
a
|
|
1077
1077
|
];
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1079
|
+
function ze(e, t, n, r = 1) {
|
|
1080
1080
|
e = (e % 360 + 360) % 360;
|
|
1081
1081
|
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
|
|
1082
|
-
return e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a),
|
|
1082
|
+
return e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a), I(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
|
|
1083
1083
|
}
|
|
1084
1084
|
//#endregion
|
|
1085
1085
|
//#region src/style/shape/ParchmentStyle.ts
|
|
1086
|
-
var
|
|
1087
|
-
function qe(e) {
|
|
1088
|
-
let t = I(e);
|
|
1089
|
-
if (!t) return L(We, Ge, Ke);
|
|
1090
|
-
let n = R(t);
|
|
1091
|
-
return L(Math.round(Ve + (We - Ve) * n), Math.round(He + (Ge - He) * n), Math.round(Ue + (Ke - Ue) * n), t.a);
|
|
1092
|
-
}
|
|
1086
|
+
var Be = "#4a3728", Ve = "#3b2a1a", He = 139, Ue = 115, We = 85, Ge = 244, Ke = 228, qe = 193;
|
|
1093
1087
|
function Je(e) {
|
|
1094
|
-
let t =
|
|
1095
|
-
if (!t
|
|
1096
|
-
let n =
|
|
1097
|
-
return
|
|
1088
|
+
let t = F(e);
|
|
1089
|
+
if (!t) return I(Ge, Ke, qe);
|
|
1090
|
+
let n = L(t);
|
|
1091
|
+
return I(Math.round(He + (Ge - He) * n), Math.round(Ue + (Ke - Ue) * n), Math.round(We + (qe - We) * n), t.a);
|
|
1098
1092
|
}
|
|
1099
1093
|
function Ye(e) {
|
|
1094
|
+
let t = F(e);
|
|
1095
|
+
if (!t || t.a >= 1) return Be;
|
|
1096
|
+
let n = F(Be);
|
|
1097
|
+
return I(n.r, n.g, n.b, t.a);
|
|
1098
|
+
}
|
|
1099
|
+
function Xe(e) {
|
|
1100
1100
|
return {
|
|
1101
1101
|
...e,
|
|
1102
|
-
fill:
|
|
1103
|
-
stroke: e.stroke ?
|
|
1102
|
+
fill: P(e.fill, Je),
|
|
1103
|
+
stroke: e.stroke ? Ye(e.stroke) : e.stroke
|
|
1104
1104
|
};
|
|
1105
1105
|
}
|
|
1106
|
-
var
|
|
1106
|
+
var Ze = { transform(e) {
|
|
1107
1107
|
switch (e.type) {
|
|
1108
1108
|
case "rect":
|
|
1109
1109
|
case "circle":
|
|
1110
1110
|
case "polygon": return {
|
|
1111
1111
|
...e,
|
|
1112
|
-
paint:
|
|
1112
|
+
paint: Xe(e.paint)
|
|
1113
1113
|
};
|
|
1114
1114
|
case "line": return {
|
|
1115
1115
|
...e,
|
|
1116
1116
|
paint: e.paint.stroke ? {
|
|
1117
1117
|
...e.paint,
|
|
1118
|
-
stroke:
|
|
1118
|
+
stroke: Ye(e.paint.stroke)
|
|
1119
1119
|
} : e.paint
|
|
1120
1120
|
};
|
|
1121
1121
|
case "text": return {
|
|
1122
1122
|
...e,
|
|
1123
|
-
fill:
|
|
1123
|
+
fill: Ve
|
|
1124
1124
|
};
|
|
1125
1125
|
case "image":
|
|
1126
1126
|
case "group": return e;
|
|
1127
1127
|
}
|
|
1128
|
-
} },
|
|
1129
|
-
function at(e) {
|
|
1130
|
-
let t = I(e);
|
|
1131
|
-
if (!t) return L(nt, rt, it);
|
|
1132
|
-
let n = R(t);
|
|
1133
|
-
return L(Math.round($e + (nt - $e) * n), Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), t.a);
|
|
1134
|
-
}
|
|
1128
|
+
} }, Qe = "#c0deff", $e = "#e0f0ff", et = 20, tt = 40, nt = 80, rt = 60, it = 100, at = 160;
|
|
1135
1129
|
function ot(e) {
|
|
1136
|
-
let t =
|
|
1137
|
-
if (!t
|
|
1138
|
-
let n =
|
|
1139
|
-
return
|
|
1130
|
+
let t = F(e);
|
|
1131
|
+
if (!t) return I(rt, it, at);
|
|
1132
|
+
let n = L(t);
|
|
1133
|
+
return I(Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), Math.round(nt + (at - nt) * n), t.a);
|
|
1140
1134
|
}
|
|
1141
1135
|
function st(e) {
|
|
1136
|
+
let t = F(e);
|
|
1137
|
+
if (!t || t.a >= 1) return Qe;
|
|
1138
|
+
let n = F(Qe);
|
|
1139
|
+
return I(n.r, n.g, n.b, t.a);
|
|
1140
|
+
}
|
|
1141
|
+
function ct(e) {
|
|
1142
1142
|
return {
|
|
1143
1143
|
...e,
|
|
1144
|
-
fill:
|
|
1145
|
-
stroke: e.stroke ?
|
|
1144
|
+
fill: P(e.fill, ot),
|
|
1145
|
+
stroke: e.stroke ? st(e.stroke) : e.stroke
|
|
1146
1146
|
};
|
|
1147
1147
|
}
|
|
1148
|
-
var
|
|
1148
|
+
var lt = { transform(e) {
|
|
1149
1149
|
switch (e.type) {
|
|
1150
1150
|
case "rect":
|
|
1151
1151
|
case "circle":
|
|
1152
1152
|
case "polygon": return {
|
|
1153
1153
|
...e,
|
|
1154
|
-
paint:
|
|
1154
|
+
paint: ct(e.paint)
|
|
1155
1155
|
};
|
|
1156
1156
|
case "line": return {
|
|
1157
1157
|
...e,
|
|
1158
1158
|
paint: e.paint.stroke ? {
|
|
1159
1159
|
...e.paint,
|
|
1160
|
-
stroke:
|
|
1160
|
+
stroke: st(e.paint.stroke)
|
|
1161
1161
|
} : e.paint
|
|
1162
1162
|
};
|
|
1163
1163
|
case "text": return {
|
|
1164
1164
|
...e,
|
|
1165
|
-
fill:
|
|
1165
|
+
fill: $e
|
|
1166
1166
|
};
|
|
1167
1167
|
case "image":
|
|
1168
1168
|
case "group": return e;
|
|
1169
1169
|
}
|
|
1170
|
-
} },
|
|
1171
|
-
function
|
|
1170
|
+
} }, ut = "#00ffd0", dt = .3, ft = 3;
|
|
1171
|
+
function pt(e, t, n) {
|
|
1172
1172
|
e /= 255, t /= 255, n /= 255;
|
|
1173
1173
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1174
1174
|
if (r === i) return [
|
|
@@ -1183,68 +1183,68 @@ function ft(e, t, n) {
|
|
|
1183
1183
|
a
|
|
1184
1184
|
];
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function mt(e, t, n, r = 1) {
|
|
1187
1187
|
e = (e % 360 + 360) % 360;
|
|
1188
1188
|
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
|
|
1189
1189
|
e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
|
|
1190
1190
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
1191
1191
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1194
|
-
let t =
|
|
1193
|
+
function ht(e) {
|
|
1194
|
+
let t = F(e);
|
|
1195
1195
|
if (!t) return {
|
|
1196
1196
|
h: 150,
|
|
1197
1197
|
a: 1
|
|
1198
1198
|
};
|
|
1199
|
-
let [n] =
|
|
1199
|
+
let [n] = pt(t.r, t.g, t.b);
|
|
1200
1200
|
return {
|
|
1201
1201
|
h: n,
|
|
1202
1202
|
a: t.a
|
|
1203
1203
|
};
|
|
1204
1204
|
}
|
|
1205
|
-
function ht(e) {
|
|
1206
|
-
let { h: t, a: n } = mt(e);
|
|
1207
|
-
return pt(t, .95, .65, n);
|
|
1208
|
-
}
|
|
1209
1205
|
function gt(e) {
|
|
1210
|
-
let t =
|
|
1211
|
-
|
|
1212
|
-
let [n] = ft(t.r, t.g, t.b);
|
|
1213
|
-
return pt(n, .4, .1, t.a);
|
|
1206
|
+
let { h: t, a: n } = ht(e);
|
|
1207
|
+
return mt(t, .95, .65, n);
|
|
1214
1208
|
}
|
|
1215
1209
|
function _t(e) {
|
|
1216
|
-
let
|
|
1217
|
-
|
|
1210
|
+
let t = F(e);
|
|
1211
|
+
if (!t) return "rgb(8, 12, 10)";
|
|
1212
|
+
let [n] = pt(t.r, t.g, t.b);
|
|
1213
|
+
return mt(n, .4, .1, t.a);
|
|
1218
1214
|
}
|
|
1219
1215
|
function vt(e) {
|
|
1216
|
+
let { h: t, a: n } = ht(e);
|
|
1217
|
+
return mt(t, .95, .65, Math.min(n, dt));
|
|
1218
|
+
}
|
|
1219
|
+
function yt(e) {
|
|
1220
1220
|
return {
|
|
1221
1221
|
...e,
|
|
1222
|
-
fill:
|
|
1223
|
-
stroke: e.stroke ?
|
|
1222
|
+
fill: P(e.fill, _t),
|
|
1223
|
+
stroke: e.stroke ? gt(e.stroke) : e.stroke
|
|
1224
1224
|
};
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function bt(e, t = !1) {
|
|
1227
1227
|
if (!e.stroke) return e;
|
|
1228
|
-
let n = (e.strokeWidth ?? 1) *
|
|
1228
|
+
let n = (e.strokeWidth ?? 1) * ft;
|
|
1229
1229
|
return {
|
|
1230
|
-
stroke:
|
|
1230
|
+
stroke: vt(e.stroke),
|
|
1231
1231
|
strokeWidth: n,
|
|
1232
1232
|
dash: e.dash,
|
|
1233
1233
|
dashEnabled: e.dashEnabled,
|
|
1234
|
-
alpha: t ?
|
|
1234
|
+
alpha: t ? dt : e.alpha
|
|
1235
1235
|
};
|
|
1236
1236
|
}
|
|
1237
|
-
var
|
|
1237
|
+
var xt = { transform(e) {
|
|
1238
1238
|
switch (e.type) {
|
|
1239
1239
|
case "rect": {
|
|
1240
1240
|
let t = {
|
|
1241
1241
|
...e,
|
|
1242
|
-
paint:
|
|
1242
|
+
paint: yt(e.paint)
|
|
1243
1243
|
};
|
|
1244
1244
|
return e.paint.stroke ? [{
|
|
1245
1245
|
...e,
|
|
1246
1246
|
paint: {
|
|
1247
|
-
...
|
|
1247
|
+
...bt(e.paint),
|
|
1248
1248
|
fill: void 0
|
|
1249
1249
|
}
|
|
1250
1250
|
}, t] : t;
|
|
@@ -1252,12 +1252,12 @@ var bt = { transform(e) {
|
|
|
1252
1252
|
case "circle": {
|
|
1253
1253
|
let t = {
|
|
1254
1254
|
...e,
|
|
1255
|
-
paint:
|
|
1255
|
+
paint: yt(e.paint)
|
|
1256
1256
|
};
|
|
1257
1257
|
return e.paint.stroke ? [{
|
|
1258
1258
|
...e,
|
|
1259
1259
|
paint: {
|
|
1260
|
-
...
|
|
1260
|
+
...bt(e.paint),
|
|
1261
1261
|
fill: void 0
|
|
1262
1262
|
}
|
|
1263
1263
|
}, t] : t;
|
|
@@ -1267,21 +1267,21 @@ var bt = { transform(e) {
|
|
|
1267
1267
|
...e,
|
|
1268
1268
|
paint: e.paint.stroke ? {
|
|
1269
1269
|
...e.paint,
|
|
1270
|
-
stroke:
|
|
1270
|
+
stroke: gt(e.paint.stroke)
|
|
1271
1271
|
} : e.paint
|
|
1272
1272
|
};
|
|
1273
1273
|
return e.paint.stroke ? [{
|
|
1274
1274
|
...e,
|
|
1275
|
-
paint:
|
|
1275
|
+
paint: bt(e.paint, !0)
|
|
1276
1276
|
}, t] : t;
|
|
1277
1277
|
}
|
|
1278
1278
|
case "polygon": return {
|
|
1279
1279
|
...e,
|
|
1280
|
-
paint:
|
|
1280
|
+
paint: yt(e.paint)
|
|
1281
1281
|
};
|
|
1282
1282
|
case "text": return {
|
|
1283
1283
|
...e,
|
|
1284
|
-
fill:
|
|
1284
|
+
fill: ut
|
|
1285
1285
|
};
|
|
1286
1286
|
case "image":
|
|
1287
1287
|
case "group": return e;
|
|
@@ -1289,16 +1289,16 @@ var bt = { transform(e) {
|
|
|
1289
1289
|
} };
|
|
1290
1290
|
//#endregion
|
|
1291
1291
|
//#region src/style/shape/wobble.ts
|
|
1292
|
-
function
|
|
1292
|
+
function R(e) {
|
|
1293
1293
|
let t = e | 0 || 1;
|
|
1294
1294
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1296
|
+
function z(...e) {
|
|
1297
1297
|
let t = 2654435769;
|
|
1298
1298
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
1299
1299
|
return t;
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function St(e, t, n, r, i, a) {
|
|
1302
1302
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
1303
1303
|
if (c < .001) return [
|
|
1304
1304
|
e,
|
|
@@ -1313,17 +1313,17 @@ function V(e, t, n, r, i, a) {
|
|
|
1313
1313
|
}
|
|
1314
1314
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1316
|
+
function Ct(e, t, n) {
|
|
1317
1317
|
if (e.length < 4) return e;
|
|
1318
1318
|
let r = [];
|
|
1319
1319
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
1320
|
-
let a =
|
|
1320
|
+
let a = St(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
1321
1321
|
if (i === 0) r.push(...a);
|
|
1322
1322
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
1323
1323
|
}
|
|
1324
1324
|
return r;
|
|
1325
1325
|
}
|
|
1326
|
-
function
|
|
1326
|
+
function B(e, t, n, r, i, a) {
|
|
1327
1327
|
let o = [
|
|
1328
1328
|
e,
|
|
1329
1329
|
t,
|
|
@@ -1335,12 +1335,12 @@ function H(e, t, n, r, i, a) {
|
|
|
1335
1335
|
t + r
|
|
1336
1336
|
], s = [];
|
|
1337
1337
|
for (let e = 0; e < 4; e++) {
|
|
1338
|
-
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u =
|
|
1338
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = St(t, n, c, l, i, a);
|
|
1339
1339
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
1340
1340
|
}
|
|
1341
1341
|
return s;
|
|
1342
1342
|
}
|
|
1343
|
-
function
|
|
1343
|
+
function V(e, t, n, r, i) {
|
|
1344
1344
|
let a = [];
|
|
1345
1345
|
for (let o = 0; o < 24; o++) {
|
|
1346
1346
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -1348,31 +1348,31 @@ function U(e, t, n, r, i) {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
return a;
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function H(e, t, n) {
|
|
1352
1352
|
let r = e.length / 2;
|
|
1353
1353
|
if (r < 2) return e;
|
|
1354
1354
|
let i = [];
|
|
1355
1355
|
for (let a = 0; a < r; a++) {
|
|
1356
|
-
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d =
|
|
1356
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = St(o, s, l, u, t, n);
|
|
1357
1357
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
1358
1358
|
}
|
|
1359
1359
|
return i;
|
|
1360
1360
|
}
|
|
1361
1361
|
//#endregion
|
|
1362
1362
|
//#region src/style/shape/SketchyStyle.ts
|
|
1363
|
-
function
|
|
1363
|
+
function wt(e, t) {
|
|
1364
1364
|
if (!t) return e;
|
|
1365
1365
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
1366
1366
|
if (!n) return e;
|
|
1367
1367
|
let r = parseFloat(n[1]);
|
|
1368
1368
|
return r >= 1 ? e : `rgba(${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}, ${r})`;
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function Tt(e) {
|
|
1371
1371
|
let { jitter: t, color: n } = e;
|
|
1372
1372
|
return { transform(e) {
|
|
1373
1373
|
switch (e.type) {
|
|
1374
1374
|
case "rect": {
|
|
1375
|
-
let r = z(
|
|
1375
|
+
let r = R(z(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
|
|
1376
1376
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
1377
1377
|
let n = [];
|
|
1378
1378
|
if (i && n.push({
|
|
@@ -1385,7 +1385,7 @@ function Ct(e) {
|
|
|
1385
1385
|
}), a && e.paint.strokeWidth) {
|
|
1386
1386
|
let i = {
|
|
1387
1387
|
type: "polygon",
|
|
1388
|
-
vertices:
|
|
1388
|
+
vertices: B(e.x, e.y, e.width, e.height, t, r),
|
|
1389
1389
|
paint: {
|
|
1390
1390
|
stroke: a,
|
|
1391
1391
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -1400,7 +1400,7 @@ function Ct(e) {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
return {
|
|
1402
1402
|
type: "polygon",
|
|
1403
|
-
vertices:
|
|
1403
|
+
vertices: B(e.x, e.y, e.width, e.height, t, r),
|
|
1404
1404
|
paint: {
|
|
1405
1405
|
fill: i,
|
|
1406
1406
|
stroke: a,
|
|
@@ -1412,10 +1412,10 @@ function Ct(e) {
|
|
|
1412
1412
|
};
|
|
1413
1413
|
}
|
|
1414
1414
|
case "circle": {
|
|
1415
|
-
let r = z(
|
|
1415
|
+
let r = R(z(e.cx, e.cy, e.radius));
|
|
1416
1416
|
return {
|
|
1417
1417
|
type: "polygon",
|
|
1418
|
-
vertices:
|
|
1418
|
+
vertices: V(e.cx, e.cy, e.radius, t, r),
|
|
1419
1419
|
paint: {
|
|
1420
1420
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
1421
1421
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -1427,7 +1427,7 @@ function Ct(e) {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
case "line": {
|
|
1430
|
-
let r = z(
|
|
1430
|
+
let r = R(z(...e.points.slice(0, 4))), i = Ct(e.points, t, r), a = wt(n, e.paint.stroke), o = {
|
|
1431
1431
|
...e.paint,
|
|
1432
1432
|
stroke: a
|
|
1433
1433
|
};
|
|
@@ -1438,7 +1438,7 @@ function Ct(e) {
|
|
|
1438
1438
|
};
|
|
1439
1439
|
}
|
|
1440
1440
|
case "polygon": {
|
|
1441
|
-
let r = z(
|
|
1441
|
+
let r = R(z(...e.vertices.slice(0, 4))), i = H(e.vertices, t, r);
|
|
1442
1442
|
return {
|
|
1443
1443
|
...e,
|
|
1444
1444
|
vertices: i,
|
|
@@ -1460,10 +1460,10 @@ function Ct(e) {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
//#endregion
|
|
1462
1462
|
//#region src/style/shape/IsometricStyle.ts
|
|
1463
|
-
function
|
|
1464
|
-
return
|
|
1463
|
+
function U(e, t) {
|
|
1464
|
+
return P(e, (e) => v(e, t));
|
|
1465
1465
|
}
|
|
1466
|
-
function
|
|
1466
|
+
function W(e, t) {
|
|
1467
1467
|
if (!t || typeof t == "string") return t;
|
|
1468
1468
|
if (t.type === "linear") {
|
|
1469
1469
|
let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
|
|
@@ -1486,16 +1486,16 @@ function K(e, t) {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
return i;
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function Et(e) {
|
|
1490
1490
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1491
1491
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Dt(e) {
|
|
1494
1494
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1495
1495
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
1496
1496
|
}
|
|
1497
|
-
var
|
|
1498
|
-
function
|
|
1497
|
+
var G = 32;
|
|
1498
|
+
function Ot(e, t) {
|
|
1499
1499
|
let n = Array(t.length);
|
|
1500
1500
|
for (let r = 0; r < t.length; r += 2) {
|
|
1501
1501
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -1503,7 +1503,7 @@ function Et(e, t) {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
return n;
|
|
1505
1505
|
}
|
|
1506
|
-
function
|
|
1506
|
+
function kt(e, t, n, r, i) {
|
|
1507
1507
|
let [a, o] = e(t, n), [s, c] = e(t + r, n), [l, u] = e(t + r, n + i), [d, f] = e(t, n + i);
|
|
1508
1508
|
return [
|
|
1509
1509
|
a,
|
|
@@ -1516,8 +1516,8 @@ function Dt(e, t, n, r, i) {
|
|
|
1516
1516
|
f
|
|
1517
1517
|
];
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1520
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
1519
|
+
function At(e = {}) {
|
|
1520
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = Et(t), i = Dt(t);
|
|
1521
1521
|
function a(e, t, n, i) {
|
|
1522
1522
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
1523
1523
|
return [
|
|
@@ -1530,7 +1530,7 @@ function Ot(e = {}) {
|
|
|
1530
1530
|
];
|
|
1531
1531
|
}
|
|
1532
1532
|
function o(e) {
|
|
1533
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
1533
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = kt(r, t, i, a, o);
|
|
1534
1534
|
if (s.dash || s.dashEnabled) {
|
|
1535
1535
|
let t = [];
|
|
1536
1536
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -1556,7 +1556,7 @@ function Ot(e = {}) {
|
|
|
1556
1556
|
if (n > 0 && s.fill) {
|
|
1557
1557
|
let t = [], i = 0;
|
|
1558
1558
|
for (let e = 1; e < 4; e++) c[e * 2 + 1] > c[i * 2 + 1] && (i = e);
|
|
1559
|
-
let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v =
|
|
1559
|
+
let a = c[i * 2], o = c[i * 2 + 1], l = (i + 3) % 4, u = c[l * 2], d = c[l * 2 + 1], f = (i + 1) % 4, p = c[f * 2], m = c[f * 2 + 1], h = (i + 2) % 4, g = c[h * 2], _ = c[h * 2 + 1], v = W(r, s.fill);
|
|
1560
1560
|
if (t.push({
|
|
1561
1561
|
type: "polygon",
|
|
1562
1562
|
vertices: [
|
|
@@ -1569,7 +1569,7 @@ function Ot(e = {}) {
|
|
|
1569
1569
|
u,
|
|
1570
1570
|
d + n
|
|
1571
1571
|
],
|
|
1572
|
-
paint: { fill:
|
|
1572
|
+
paint: { fill: U(v, .2) },
|
|
1573
1573
|
layer: e.layer
|
|
1574
1574
|
}), t.push({
|
|
1575
1575
|
type: "polygon",
|
|
@@ -1583,7 +1583,7 @@ function Ot(e = {}) {
|
|
|
1583
1583
|
a,
|
|
1584
1584
|
o + n
|
|
1585
1585
|
],
|
|
1586
|
-
paint: { fill:
|
|
1586
|
+
paint: { fill: U(v, .4) },
|
|
1587
1587
|
layer: e.layer
|
|
1588
1588
|
}), t.push({
|
|
1589
1589
|
type: "polygon",
|
|
@@ -1639,7 +1639,7 @@ function Ot(e = {}) {
|
|
|
1639
1639
|
type: "polygon",
|
|
1640
1640
|
vertices: c,
|
|
1641
1641
|
paint: {
|
|
1642
|
-
fill:
|
|
1642
|
+
fill: W(r, s.fill),
|
|
1643
1643
|
stroke: s.stroke,
|
|
1644
1644
|
strokeWidth: s.strokeWidth
|
|
1645
1645
|
},
|
|
@@ -1649,15 +1649,15 @@ function Ot(e = {}) {
|
|
|
1649
1649
|
};
|
|
1650
1650
|
}
|
|
1651
1651
|
function s(e) {
|
|
1652
|
-
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(
|
|
1653
|
-
for (let e = 0; e <
|
|
1654
|
-
let n = e /
|
|
1652
|
+
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(G * 2);
|
|
1653
|
+
for (let e = 0; e < G; e++) {
|
|
1654
|
+
let n = e / G * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
|
|
1655
1655
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
1656
1656
|
}
|
|
1657
1657
|
if (o.dash || o.dashEnabled) {
|
|
1658
1658
|
let t = [];
|
|
1659
|
-
for (let n = 0; n <
|
|
1660
|
-
let r = (n + 1) %
|
|
1659
|
+
for (let n = 0; n < G; n++) {
|
|
1660
|
+
let r = (n + 1) % G;
|
|
1661
1661
|
t.push({
|
|
1662
1662
|
type: "line",
|
|
1663
1663
|
points: [
|
|
@@ -1676,18 +1676,18 @@ function Ot(e = {}) {
|
|
|
1676
1676
|
}
|
|
1677
1677
|
return t;
|
|
1678
1678
|
}
|
|
1679
|
-
let c = [], l =
|
|
1679
|
+
let c = [], l = W(r, o.fill);
|
|
1680
1680
|
if (n > 0 && o.fill) {
|
|
1681
1681
|
let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
|
|
1682
|
-
for (let e = 0; e <
|
|
1682
|
+
for (let e = 0; e < G; e++) s[e * 2] > a && (a = s[e * 2], t = e), s[e * 2] < u && (u = s[e * 2], r = e), s[e * 2 + 1] > d && (d = s[e * 2 + 1], i = e);
|
|
1683
1683
|
let f = [], p = t;
|
|
1684
|
-
for (let e = 0; e <=
|
|
1684
|
+
for (let e = 0; e <= G && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % G;
|
|
1685
1685
|
for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
|
|
1686
1686
|
c.push({
|
|
1687
1687
|
type: "polygon",
|
|
1688
1688
|
vertices: f,
|
|
1689
1689
|
paint: {
|
|
1690
|
-
fill:
|
|
1690
|
+
fill: U(l, .2),
|
|
1691
1691
|
stroke: o.stroke,
|
|
1692
1692
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
1693
1693
|
},
|
|
@@ -1695,13 +1695,13 @@ function Ot(e = {}) {
|
|
|
1695
1695
|
});
|
|
1696
1696
|
let m = [];
|
|
1697
1697
|
p = i;
|
|
1698
|
-
for (let e = 0; e <=
|
|
1698
|
+
for (let e = 0; e <= G && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % G;
|
|
1699
1699
|
for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
|
|
1700
1700
|
c.push({
|
|
1701
1701
|
type: "polygon",
|
|
1702
1702
|
vertices: m,
|
|
1703
1703
|
paint: {
|
|
1704
|
-
fill:
|
|
1704
|
+
fill: U(l, .4),
|
|
1705
1705
|
stroke: o.stroke,
|
|
1706
1706
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
1707
1707
|
},
|
|
@@ -1729,14 +1729,14 @@ function Ot(e = {}) {
|
|
|
1729
1729
|
case "circle": return s(e);
|
|
1730
1730
|
case "line": return {
|
|
1731
1731
|
...e,
|
|
1732
|
-
points:
|
|
1732
|
+
points: Ot(r, e.points)
|
|
1733
1733
|
};
|
|
1734
1734
|
case "polygon": return {
|
|
1735
1735
|
...e,
|
|
1736
|
-
vertices:
|
|
1736
|
+
vertices: Ot(r, e.vertices),
|
|
1737
1737
|
paint: {
|
|
1738
1738
|
...e.paint,
|
|
1739
|
-
fill:
|
|
1739
|
+
fill: W(r, e.paint.fill)
|
|
1740
1740
|
}
|
|
1741
1741
|
};
|
|
1742
1742
|
case "text": {
|
|
@@ -1801,21 +1801,21 @@ function Ot(e = {}) {
|
|
|
1801
1801
|
}
|
|
1802
1802
|
//#endregion
|
|
1803
1803
|
//#region src/style/shape/ConstructionStyle.ts
|
|
1804
|
-
var
|
|
1805
|
-
function
|
|
1806
|
-
let t =
|
|
1807
|
-
if (!t) return
|
|
1808
|
-
let n =
|
|
1809
|
-
return
|
|
1804
|
+
var K = "#1a1a1a", jt = "#ffc200", Mt = "#ff6600", Nt = 26, Pt = 26, Ft = 26, It = 255, Lt = 194, Rt = 0;
|
|
1805
|
+
function zt(e) {
|
|
1806
|
+
let t = F(e);
|
|
1807
|
+
if (!t) return I(It, Lt, Rt);
|
|
1808
|
+
let n = L(t);
|
|
1809
|
+
return I(Math.round(Nt + (It - Nt) * n), Math.round(Pt + (Lt - Pt) * n), Math.round(Ft + (Rt - Ft) * n), t.a);
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function Bt(e) {
|
|
1812
1812
|
return {
|
|
1813
1813
|
...e,
|
|
1814
|
-
fill:
|
|
1815
|
-
stroke: e.stroke ?
|
|
1814
|
+
fill: P(e.fill, zt),
|
|
1815
|
+
stroke: e.stroke ? K : e.stroke
|
|
1816
1816
|
};
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1818
|
+
function Vt(e, t, n, r) {
|
|
1819
1819
|
let i = [], a = e.length;
|
|
1820
1820
|
for (let o = 0; o < a; o++) {
|
|
1821
1821
|
let s = e[o], c = e[(o + 1) % a], l = t * s[0] + n * s[1] - r, u = t * c[0] + n * c[1] - r;
|
|
@@ -1826,7 +1826,7 @@ function zt(e, t, n, r) {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
return i;
|
|
1828
1828
|
}
|
|
1829
|
-
function
|
|
1829
|
+
function Ht(e, t, n, r, i) {
|
|
1830
1830
|
let a = [
|
|
1831
1831
|
[e, t],
|
|
1832
1832
|
[e + n, t],
|
|
@@ -1834,37 +1834,37 @@ function Bt(e, t, n, r, i) {
|
|
|
1834
1834
|
[e, t + r]
|
|
1835
1835
|
], o = i * .4, s = o * .35, c = e + t, l = e + n + t + r, u = Math.floor(c / o) - 1, d = Math.ceil(l / o) + 1, f = [];
|
|
1836
1836
|
for (let e = u; e <= d; e++) {
|
|
1837
|
-
let t = e * o, n = t + s, r =
|
|
1838
|
-
r =
|
|
1837
|
+
let t = e * o, n = t + s, r = Vt(a, 1, 1, t);
|
|
1838
|
+
r = Vt(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
1839
1839
|
}
|
|
1840
1840
|
return f;
|
|
1841
1841
|
}
|
|
1842
|
-
var
|
|
1842
|
+
var Ut = { transform(e, t) {
|
|
1843
1843
|
switch (e.type) {
|
|
1844
1844
|
case "rect": {
|
|
1845
1845
|
if (!e.paint.fill) return {
|
|
1846
1846
|
...e,
|
|
1847
|
-
paint:
|
|
1847
|
+
paint: Bt(e.paint)
|
|
1848
1848
|
};
|
|
1849
1849
|
let n = {
|
|
1850
1850
|
...e,
|
|
1851
1851
|
paint: {
|
|
1852
|
-
fill:
|
|
1852
|
+
fill: K,
|
|
1853
1853
|
strokeWidth: e.paint.strokeWidth
|
|
1854
1854
|
}
|
|
1855
|
-
}, r =
|
|
1855
|
+
}, r = Ht(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
1856
1856
|
type: "polygon",
|
|
1857
1857
|
vertices: t,
|
|
1858
1858
|
layer: e.layer,
|
|
1859
1859
|
paint: {
|
|
1860
|
-
fill:
|
|
1860
|
+
fill: jt,
|
|
1861
1861
|
alpha: .65
|
|
1862
1862
|
}
|
|
1863
1863
|
})), i = {
|
|
1864
1864
|
...e,
|
|
1865
1865
|
hit: void 0,
|
|
1866
1866
|
paint: {
|
|
1867
|
-
stroke:
|
|
1867
|
+
stroke: K,
|
|
1868
1868
|
strokeWidth: e.paint.strokeWidth
|
|
1869
1869
|
}
|
|
1870
1870
|
};
|
|
@@ -1876,38 +1876,38 @@ var Vt = { transform(e, t) {
|
|
|
1876
1876
|
}
|
|
1877
1877
|
case "circle": return {
|
|
1878
1878
|
...e,
|
|
1879
|
-
paint:
|
|
1879
|
+
paint: Bt(e.paint)
|
|
1880
1880
|
};
|
|
1881
1881
|
case "polygon": return {
|
|
1882
1882
|
...e,
|
|
1883
1883
|
paint: {
|
|
1884
1884
|
...e.paint,
|
|
1885
|
-
fill: e.paint.fill ?
|
|
1886
|
-
stroke: e.paint.stroke ?
|
|
1885
|
+
fill: e.paint.fill ? Mt : e.paint.fill,
|
|
1886
|
+
stroke: e.paint.stroke ? K : e.paint.stroke
|
|
1887
1887
|
}
|
|
1888
1888
|
};
|
|
1889
1889
|
case "line": return {
|
|
1890
1890
|
...e,
|
|
1891
1891
|
paint: e.paint.stroke ? {
|
|
1892
1892
|
...e.paint,
|
|
1893
|
-
stroke:
|
|
1893
|
+
stroke: Mt
|
|
1894
1894
|
} : e.paint
|
|
1895
1895
|
};
|
|
1896
1896
|
case "text": return {
|
|
1897
1897
|
...e,
|
|
1898
|
-
fill:
|
|
1899
|
-
stroke:
|
|
1898
|
+
fill: Mt,
|
|
1899
|
+
stroke: K,
|
|
1900
1900
|
strokeWidth: t.roomSize * .25
|
|
1901
1901
|
};
|
|
1902
1902
|
case "image":
|
|
1903
1903
|
case "group": return e;
|
|
1904
1904
|
}
|
|
1905
|
-
} },
|
|
1906
|
-
function
|
|
1905
|
+
} }, Wt = "#c8eeff", Gt = "#00c8ff", Kt = "#00ffaa", qt = .2, Jt = 5, Yt = 190;
|
|
1906
|
+
function Xt(e, t, n) {
|
|
1907
1907
|
e /= 255, t /= 255, n /= 255;
|
|
1908
1908
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1909
1909
|
if (r === i) return [
|
|
1910
|
-
|
|
1910
|
+
Yt,
|
|
1911
1911
|
0,
|
|
1912
1912
|
a
|
|
1913
1913
|
];
|
|
@@ -1918,54 +1918,54 @@ function Jt(e, t, n) {
|
|
|
1918
1918
|
a
|
|
1919
1919
|
];
|
|
1920
1920
|
}
|
|
1921
|
-
function
|
|
1921
|
+
function Zt(e, t, n, r = 1) {
|
|
1922
1922
|
e = (e % 360 + 360) % 360;
|
|
1923
1923
|
let i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(e / 60 % 2 - 1)), o = n - i / 2, s, c, l;
|
|
1924
1924
|
e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
|
|
1925
1925
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
1926
1926
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let t =
|
|
1930
|
-
if (!t) return Yt
|
|
1931
|
-
let [n, r] =
|
|
1932
|
-
return
|
|
1928
|
+
function Qt(e) {
|
|
1929
|
+
let t = F(e);
|
|
1930
|
+
if (!t) return Zt(Yt, .55, .18);
|
|
1931
|
+
let [n, r] = Xt(t.r, t.g, t.b);
|
|
1932
|
+
return Zt(r < .08 ? Yt : n, .55, .18, t.a);
|
|
1933
1933
|
}
|
|
1934
|
-
function
|
|
1934
|
+
function $t(e) {
|
|
1935
1935
|
return {
|
|
1936
1936
|
...e,
|
|
1937
|
-
fill:
|
|
1938
|
-
stroke: e.stroke ?
|
|
1937
|
+
fill: P(e.fill, Qt),
|
|
1938
|
+
stroke: e.stroke ? Gt : e.stroke
|
|
1939
1939
|
};
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function en(e) {
|
|
1942
1942
|
return {
|
|
1943
|
-
stroke:
|
|
1944
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
1945
|
-
alpha:
|
|
1943
|
+
stroke: Gt,
|
|
1944
|
+
strokeWidth: (e.strokeWidth ?? 1) * Jt,
|
|
1945
|
+
alpha: qt
|
|
1946
1946
|
};
|
|
1947
1947
|
}
|
|
1948
|
-
function
|
|
1948
|
+
function tn(e) {
|
|
1949
1949
|
return {
|
|
1950
|
-
stroke:
|
|
1951
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
1952
|
-
alpha:
|
|
1950
|
+
stroke: Kt,
|
|
1951
|
+
strokeWidth: (e.strokeWidth ?? 1) * Jt,
|
|
1952
|
+
alpha: qt,
|
|
1953
1953
|
dash: e.dash,
|
|
1954
1954
|
dashEnabled: e.dashEnabled
|
|
1955
1955
|
};
|
|
1956
1956
|
}
|
|
1957
|
-
var
|
|
1957
|
+
var nn = { transform(e) {
|
|
1958
1958
|
switch (e.type) {
|
|
1959
1959
|
case "rect": {
|
|
1960
1960
|
let t = {
|
|
1961
1961
|
...e,
|
|
1962
|
-
paint:
|
|
1962
|
+
paint: $t(e.paint)
|
|
1963
1963
|
};
|
|
1964
1964
|
return e.paint.stroke ? [{
|
|
1965
1965
|
...e,
|
|
1966
1966
|
hit: void 0,
|
|
1967
1967
|
paint: {
|
|
1968
|
-
...
|
|
1968
|
+
...en(e.paint),
|
|
1969
1969
|
fill: void 0
|
|
1970
1970
|
}
|
|
1971
1971
|
}, t] : t;
|
|
@@ -1973,13 +1973,13 @@ var en = { transform(e) {
|
|
|
1973
1973
|
case "circle": {
|
|
1974
1974
|
let t = {
|
|
1975
1975
|
...e,
|
|
1976
|
-
paint:
|
|
1976
|
+
paint: $t(e.paint)
|
|
1977
1977
|
};
|
|
1978
1978
|
return e.paint.stroke ? [{
|
|
1979
1979
|
...e,
|
|
1980
1980
|
hit: void 0,
|
|
1981
1981
|
paint: {
|
|
1982
|
-
...
|
|
1982
|
+
...en(e.paint),
|
|
1983
1983
|
fill: void 0
|
|
1984
1984
|
}
|
|
1985
1985
|
}, t] : t;
|
|
@@ -1996,36 +1996,36 @@ var en = { transform(e) {
|
|
|
1996
1996
|
...e,
|
|
1997
1997
|
paint: e.paint.stroke ? {
|
|
1998
1998
|
...e.paint,
|
|
1999
|
-
stroke:
|
|
1999
|
+
stroke: Kt
|
|
2000
2000
|
} : e.paint
|
|
2001
2001
|
};
|
|
2002
2002
|
return e.paint.stroke ? [{
|
|
2003
2003
|
...e,
|
|
2004
2004
|
hit: void 0,
|
|
2005
|
-
paint:
|
|
2005
|
+
paint: tn(e.paint)
|
|
2006
2006
|
}, t] : t;
|
|
2007
2007
|
}
|
|
2008
2008
|
case "polygon": return {
|
|
2009
2009
|
...e,
|
|
2010
2010
|
paint: {
|
|
2011
2011
|
...e.paint,
|
|
2012
|
-
fill: e.paint.fill ?
|
|
2012
|
+
fill: e.paint.fill ? Kt : e.paint.fill,
|
|
2013
2013
|
stroke: void 0
|
|
2014
2014
|
}
|
|
2015
2015
|
};
|
|
2016
2016
|
case "text": return {
|
|
2017
2017
|
...e,
|
|
2018
|
-
fill:
|
|
2018
|
+
fill: Wt
|
|
2019
2019
|
};
|
|
2020
2020
|
case "image":
|
|
2021
2021
|
case "group": return e;
|
|
2022
2022
|
}
|
|
2023
|
-
} },
|
|
2023
|
+
} }, rn = {
|
|
2024
2024
|
lighten: .35,
|
|
2025
2025
|
darken: .25
|
|
2026
2026
|
};
|
|
2027
|
-
function
|
|
2028
|
-
let t = e.lighten ??
|
|
2027
|
+
function an(e = {}) {
|
|
2028
|
+
let t = e.lighten ?? rn.lighten, n = e.darken ?? rn.darken;
|
|
2029
2029
|
function r(e, r, i, o, s) {
|
|
2030
2030
|
let c = e.fill;
|
|
2031
2031
|
if (typeof c != "string") return e;
|
|
@@ -2076,124 +2076,124 @@ function nn(e = {}) {
|
|
|
2076
2076
|
}
|
|
2077
2077
|
//#endregion
|
|
2078
2078
|
//#region src/style/shape/StainedGlassStyle.ts
|
|
2079
|
-
var
|
|
2080
|
-
function
|
|
2081
|
-
let t =
|
|
2079
|
+
var on = "#0a0a0a", sn = "#f4f0e0", cn = .6, ln = .4, un = .62, dn = 2.2, fn = .06;
|
|
2080
|
+
function pn(e) {
|
|
2081
|
+
let t = F(e);
|
|
2082
2082
|
if (!t) return e;
|
|
2083
|
-
let [n, r, i] =
|
|
2084
|
-
return
|
|
2083
|
+
let [n, r, i] = Re(t.r, t.g, t.b);
|
|
2084
|
+
return ze(n, r < .08 ? r : Math.max(r, cn), Math.min(un, Math.max(ln, i)), t.a);
|
|
2085
2085
|
}
|
|
2086
|
-
function
|
|
2087
|
-
return Math.max((e ?? .04) *
|
|
2086
|
+
function mn(e) {
|
|
2087
|
+
return Math.max((e ?? .04) * dn, fn);
|
|
2088
2088
|
}
|
|
2089
|
-
function
|
|
2090
|
-
let t =
|
|
2089
|
+
function hn(e) {
|
|
2090
|
+
let t = P(e.fill, pn), n = t !== void 0 || e.stroke !== void 0;
|
|
2091
2091
|
return {
|
|
2092
2092
|
...e,
|
|
2093
2093
|
fill: t,
|
|
2094
|
-
stroke: n ?
|
|
2095
|
-
strokeWidth: n ?
|
|
2094
|
+
stroke: n ? on : void 0,
|
|
2095
|
+
strokeWidth: n ? mn(e.strokeWidth) : e.strokeWidth,
|
|
2096
2096
|
dash: void 0,
|
|
2097
2097
|
dashEnabled: void 0
|
|
2098
2098
|
};
|
|
2099
2099
|
}
|
|
2100
|
-
var
|
|
2100
|
+
var gn = { transform(e) {
|
|
2101
2101
|
switch (e.type) {
|
|
2102
2102
|
case "rect":
|
|
2103
2103
|
case "circle":
|
|
2104
2104
|
case "polygon": return {
|
|
2105
2105
|
...e,
|
|
2106
|
-
paint:
|
|
2106
|
+
paint: hn(e.paint)
|
|
2107
2107
|
};
|
|
2108
2108
|
case "line": return {
|
|
2109
2109
|
...e,
|
|
2110
2110
|
paint: e.paint.stroke ? {
|
|
2111
2111
|
...e.paint,
|
|
2112
|
-
stroke:
|
|
2113
|
-
strokeWidth:
|
|
2112
|
+
stroke: on,
|
|
2113
|
+
strokeWidth: mn(e.paint.strokeWidth)
|
|
2114
2114
|
} : e.paint
|
|
2115
2115
|
};
|
|
2116
2116
|
case "text": return {
|
|
2117
2117
|
...e,
|
|
2118
|
-
fill:
|
|
2118
|
+
fill: sn
|
|
2119
2119
|
};
|
|
2120
2120
|
case "image":
|
|
2121
2121
|
case "group": return e;
|
|
2122
2122
|
}
|
|
2123
|
-
} },
|
|
2124
|
-
function wn(e) {
|
|
2125
|
-
let t = I(e);
|
|
2126
|
-
if (!t) return L(xn, Sn, Cn);
|
|
2127
|
-
let n = R(t);
|
|
2128
|
-
return L(Math.round(vn + (xn - vn) * n), Math.round(yn + (Sn - yn) * n), Math.round(bn + (Cn - bn) * n), t.a);
|
|
2129
|
-
}
|
|
2130
|
-
function Tn(e) {
|
|
2131
|
-
let t = I(e);
|
|
2132
|
-
if (!t || t.a >= 1) return hn;
|
|
2133
|
-
let n = I(hn);
|
|
2134
|
-
return L(n.r, n.g, n.b, t.a);
|
|
2135
|
-
}
|
|
2123
|
+
} }, _n = "#1c3f6e", vn = 1.4, yn = .05, bn = 198, xn = 212, Sn = 230, Cn = 248, wn = 250, Tn = 255;
|
|
2136
2124
|
function En(e) {
|
|
2137
|
-
|
|
2125
|
+
let t = F(e);
|
|
2126
|
+
if (!t) return I(Cn, wn, Tn);
|
|
2127
|
+
let n = L(t);
|
|
2128
|
+
return I(Math.round(bn + (Cn - bn) * n), Math.round(xn + (wn - xn) * n), Math.round(Sn + (Tn - Sn) * n), t.a);
|
|
2138
2129
|
}
|
|
2139
2130
|
function Dn(e) {
|
|
2131
|
+
let t = F(e);
|
|
2132
|
+
if (!t || t.a >= 1) return _n;
|
|
2133
|
+
let n = F(_n);
|
|
2134
|
+
return I(n.r, n.g, n.b, t.a);
|
|
2135
|
+
}
|
|
2136
|
+
function On(e) {
|
|
2137
|
+
return Math.max((e ?? .04) * vn, yn);
|
|
2138
|
+
}
|
|
2139
|
+
function kn(e) {
|
|
2140
2140
|
return {
|
|
2141
2141
|
...e,
|
|
2142
|
-
fill:
|
|
2143
|
-
stroke: e.stroke ?
|
|
2144
|
-
strokeWidth: e.stroke ?
|
|
2142
|
+
fill: P(e.fill, En),
|
|
2143
|
+
stroke: e.stroke ? Dn(e.stroke) : e.stroke,
|
|
2144
|
+
strokeWidth: e.stroke ? On(e.strokeWidth) : e.strokeWidth
|
|
2145
2145
|
};
|
|
2146
2146
|
}
|
|
2147
|
-
var
|
|
2147
|
+
var An = { transform(e) {
|
|
2148
2148
|
switch (e.type) {
|
|
2149
2149
|
case "rect":
|
|
2150
2150
|
case "circle":
|
|
2151
2151
|
case "polygon": return {
|
|
2152
2152
|
...e,
|
|
2153
|
-
paint:
|
|
2153
|
+
paint: kn(e.paint)
|
|
2154
2154
|
};
|
|
2155
2155
|
case "line": return e.paint.stroke ? {
|
|
2156
2156
|
...e,
|
|
2157
2157
|
paint: {
|
|
2158
2158
|
...e.paint,
|
|
2159
|
-
stroke:
|
|
2160
|
-
strokeWidth: e.grid ? e.paint.strokeWidth :
|
|
2159
|
+
stroke: Dn(e.paint.stroke),
|
|
2160
|
+
strokeWidth: e.grid ? e.paint.strokeWidth : On(e.paint.strokeWidth)
|
|
2161
2161
|
}
|
|
2162
2162
|
} : e;
|
|
2163
2163
|
case "text": return {
|
|
2164
2164
|
...e,
|
|
2165
|
-
fill:
|
|
2165
|
+
fill: _n
|
|
2166
2166
|
};
|
|
2167
2167
|
case "image":
|
|
2168
2168
|
case "group": return e;
|
|
2169
2169
|
}
|
|
2170
|
-
} },
|
|
2171
|
-
function
|
|
2172
|
-
let t =
|
|
2173
|
-
if (!t) return
|
|
2174
|
-
let n =
|
|
2175
|
-
return
|
|
2170
|
+
} }, jn = "#7a6a48", Mn = "#8a7a55", Nn = "#4a3f28", Pn = 78, Fn = 93, In = 52, Ln = 221, Rn = 207, zn = 166, Bn = 2, Vn = .26, Hn = .02;
|
|
2171
|
+
function Un(e) {
|
|
2172
|
+
let t = F(e);
|
|
2173
|
+
if (!t) return I(Ln, Rn, zn);
|
|
2174
|
+
let n = L(t);
|
|
2175
|
+
return I(Math.round(Pn + (Ln - Pn) * n), Math.round(Fn + (Rn - Fn) * n), Math.round(In + (zn - In) * n), t.a);
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2177
|
+
function Wn(e) {
|
|
2178
2178
|
return {
|
|
2179
2179
|
...e,
|
|
2180
|
-
fill:
|
|
2181
|
-
stroke: e.stroke ?
|
|
2180
|
+
fill: P(e.fill, Un),
|
|
2181
|
+
stroke: e.stroke ? jn : e.stroke
|
|
2182
2182
|
};
|
|
2183
2183
|
}
|
|
2184
|
-
var
|
|
2185
|
-
stroke:
|
|
2186
|
-
strokeWidth:
|
|
2187
|
-
},
|
|
2184
|
+
var Gn = {
|
|
2185
|
+
stroke: jn,
|
|
2186
|
+
strokeWidth: Hn
|
|
2187
|
+
}, Kn = { transform(e) {
|
|
2188
2188
|
switch (e.type) {
|
|
2189
2189
|
case "rect": {
|
|
2190
2190
|
let t = {
|
|
2191
2191
|
...e,
|
|
2192
|
-
paint:
|
|
2192
|
+
paint: Wn(e.paint)
|
|
2193
2193
|
};
|
|
2194
2194
|
if (!e.paint.fill) return t;
|
|
2195
|
-
let n = [t], r = Math.min(e.width, e.height) / 2 *
|
|
2196
|
-
for (let t = 1; t <=
|
|
2195
|
+
let n = [t], r = Math.min(e.width, e.height) / 2 * Vn, i = Math.min(e.width, e.height) * .12;
|
|
2196
|
+
for (let t = 1; t <= Bn; t++) {
|
|
2197
2197
|
let a = r * t, o = e.width - a * 2, s = e.height - a * 2;
|
|
2198
2198
|
if (o <= i || s <= i) break;
|
|
2199
2199
|
n.push({
|
|
@@ -2203,7 +2203,7 @@ var Un = {
|
|
|
2203
2203
|
width: o,
|
|
2204
2204
|
height: s,
|
|
2205
2205
|
cornerRadius: e.cornerRadius,
|
|
2206
|
-
paint:
|
|
2206
|
+
paint: Gn,
|
|
2207
2207
|
layer: e.layer,
|
|
2208
2208
|
noScale: e.noScale
|
|
2209
2209
|
});
|
|
@@ -2213,11 +2213,11 @@ var Un = {
|
|
|
2213
2213
|
case "circle": {
|
|
2214
2214
|
let t = {
|
|
2215
2215
|
...e,
|
|
2216
|
-
paint:
|
|
2216
|
+
paint: Wn(e.paint)
|
|
2217
2217
|
};
|
|
2218
2218
|
if (!e.paint.fill) return t;
|
|
2219
|
-
let n = [t], r = e.radius *
|
|
2220
|
-
for (let t = 1; t <=
|
|
2219
|
+
let n = [t], r = e.radius * Vn;
|
|
2220
|
+
for (let t = 1; t <= Bn; t++) {
|
|
2221
2221
|
let i = e.radius - r * t;
|
|
2222
2222
|
if (i <= e.radius * .12) break;
|
|
2223
2223
|
n.push({
|
|
@@ -2225,7 +2225,7 @@ var Un = {
|
|
|
2225
2225
|
cx: e.cx,
|
|
2226
2226
|
cy: e.cy,
|
|
2227
2227
|
radius: i,
|
|
2228
|
-
paint:
|
|
2228
|
+
paint: Gn,
|
|
2229
2229
|
layer: e.layer,
|
|
2230
2230
|
noScale: e.noScale
|
|
2231
2231
|
});
|
|
@@ -2235,21 +2235,21 @@ var Un = {
|
|
|
2235
2235
|
case "polygon": {
|
|
2236
2236
|
let t = {
|
|
2237
2237
|
...e,
|
|
2238
|
-
paint:
|
|
2238
|
+
paint: Wn(e.paint)
|
|
2239
2239
|
};
|
|
2240
2240
|
if (!e.paint.fill) return t;
|
|
2241
2241
|
let n = [t], r = e.vertices.length / 2, i = 0, a = 0;
|
|
2242
2242
|
for (let t = 0; t < r; t++) i += e.vertices[t * 2], a += e.vertices[t * 2 + 1];
|
|
2243
2243
|
i /= r, a /= r;
|
|
2244
|
-
for (let t = 1; t <=
|
|
2245
|
-
let o = 1 -
|
|
2244
|
+
for (let t = 1; t <= Bn; t++) {
|
|
2245
|
+
let o = 1 - Vn * t;
|
|
2246
2246
|
if (o <= .15) break;
|
|
2247
2247
|
let s = [];
|
|
2248
2248
|
for (let t = 0; t < r; t++) s.push(i + (e.vertices[t * 2] - i) * o, a + (e.vertices[t * 2 + 1] - a) * o);
|
|
2249
2249
|
n.push({
|
|
2250
2250
|
type: "polygon",
|
|
2251
2251
|
vertices: s,
|
|
2252
|
-
paint:
|
|
2252
|
+
paint: Gn,
|
|
2253
2253
|
layer: e.layer,
|
|
2254
2254
|
noScale: e.noScale
|
|
2255
2255
|
});
|
|
@@ -2260,29 +2260,29 @@ var Un = {
|
|
|
2260
2260
|
...e,
|
|
2261
2261
|
paint: {
|
|
2262
2262
|
...e.paint,
|
|
2263
|
-
stroke:
|
|
2263
|
+
stroke: Mn
|
|
2264
2264
|
}
|
|
2265
2265
|
} : e;
|
|
2266
2266
|
case "text": return {
|
|
2267
2267
|
...e,
|
|
2268
|
-
fill:
|
|
2268
|
+
fill: Nn
|
|
2269
2269
|
};
|
|
2270
2270
|
case "image":
|
|
2271
2271
|
case "group": return e;
|
|
2272
2272
|
}
|
|
2273
|
-
} },
|
|
2274
|
-
function
|
|
2275
|
-
return
|
|
2276
|
-
let n =
|
|
2273
|
+
} }, qn = "#3a3a44";
|
|
2274
|
+
function Jn(e, t) {
|
|
2275
|
+
return P(e, (e) => {
|
|
2276
|
+
let n = F(e);
|
|
2277
2277
|
return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${(n.a * t).toFixed(3)})` : e;
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
|
-
function
|
|
2280
|
+
function Yn(e = {}) {
|
|
2281
2281
|
let t = e.bleed ?? .05, n = Math.max(1, Math.min(4, e.layers ?? 2)), r = e.alpha ?? .4;
|
|
2282
2282
|
function i(e, t, i, a, o, s) {
|
|
2283
|
-
let c =
|
|
2283
|
+
let c = Jn(t.fill, r), l = [];
|
|
2284
2284
|
for (let t = 0; t < n; t++) {
|
|
2285
|
-
let n =
|
|
2285
|
+
let n = R(i + t * 2654435769);
|
|
2286
2286
|
l.push({
|
|
2287
2287
|
type: "polygon",
|
|
2288
2288
|
vertices: e(n),
|
|
@@ -2301,10 +2301,10 @@ function qn(e = {}) {
|
|
|
2301
2301
|
switch (e.type) {
|
|
2302
2302
|
case "rect":
|
|
2303
2303
|
if (!e.paint.fill) {
|
|
2304
|
-
let n = z(
|
|
2304
|
+
let n = R(z(e.x, e.y, e.width, e.height));
|
|
2305
2305
|
return {
|
|
2306
2306
|
type: "polygon",
|
|
2307
|
-
vertices:
|
|
2307
|
+
vertices: B(e.x, e.y, e.width, e.height, t, n),
|
|
2308
2308
|
paint: {
|
|
2309
2309
|
stroke: e.paint.stroke,
|
|
2310
2310
|
strokeWidth: e.paint.strokeWidth ?? 0,
|
|
@@ -2315,13 +2315,13 @@ function qn(e = {}) {
|
|
|
2315
2315
|
noScale: e.noScale
|
|
2316
2316
|
};
|
|
2317
2317
|
}
|
|
2318
|
-
return i((n) =>
|
|
2318
|
+
return i((n) => B(e.x, e.y, e.width, e.height, t, n), e.paint, z(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
|
|
2319
2319
|
case "circle":
|
|
2320
2320
|
if (!e.paint.fill) {
|
|
2321
|
-
let n = z(
|
|
2321
|
+
let n = R(z(e.cx, e.cy, e.radius));
|
|
2322
2322
|
return {
|
|
2323
2323
|
type: "polygon",
|
|
2324
|
-
vertices:
|
|
2324
|
+
vertices: V(e.cx, e.cy, e.radius, t, n),
|
|
2325
2325
|
paint: {
|
|
2326
2326
|
stroke: e.paint.stroke,
|
|
2327
2327
|
strokeWidth: e.paint.strokeWidth ?? 0,
|
|
@@ -2332,20 +2332,20 @@ function qn(e = {}) {
|
|
|
2332
2332
|
noScale: e.noScale
|
|
2333
2333
|
};
|
|
2334
2334
|
}
|
|
2335
|
-
return i((n) =>
|
|
2335
|
+
return i((n) => V(e.cx, e.cy, e.radius, t, n), e.paint, z(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
|
|
2336
2336
|
case "polygon":
|
|
2337
2337
|
if (!e.paint.fill) {
|
|
2338
|
-
let n = z(
|
|
2338
|
+
let n = R(z(...e.vertices.slice(0, 4)));
|
|
2339
2339
|
return {
|
|
2340
2340
|
...e,
|
|
2341
|
-
vertices:
|
|
2341
|
+
vertices: H(e.vertices, t, n),
|
|
2342
2342
|
paint: {
|
|
2343
2343
|
...e.paint,
|
|
2344
2344
|
alpha: .5
|
|
2345
2345
|
}
|
|
2346
2346
|
};
|
|
2347
2347
|
}
|
|
2348
|
-
return i((n) =>
|
|
2348
|
+
return i((n) => H(e.vertices, t, n), e.paint, z(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
|
|
2349
2349
|
case "line": return {
|
|
2350
2350
|
...e,
|
|
2351
2351
|
paint: {
|
|
@@ -2355,7 +2355,7 @@ function qn(e = {}) {
|
|
|
2355
2355
|
};
|
|
2356
2356
|
case "text": return {
|
|
2357
2357
|
...e,
|
|
2358
|
-
fill:
|
|
2358
|
+
fill: qn
|
|
2359
2359
|
};
|
|
2360
2360
|
case "image":
|
|
2361
2361
|
case "group": return e;
|
|
@@ -2363,25 +2363,216 @@ function qn(e = {}) {
|
|
|
2363
2363
|
} };
|
|
2364
2364
|
}
|
|
2365
2365
|
//#endregion
|
|
2366
|
-
//#region src/style/
|
|
2367
|
-
var
|
|
2368
|
-
function
|
|
2369
|
-
|
|
2366
|
+
//#region src/style/shape/DarkModernStyle.ts
|
|
2367
|
+
var Xn = "rgba(255, 255, 255, 0.14)", Zn = "#5b6573", Qn = "#e6e8ec", $n = "rgba(0, 0, 0, 0.38)", er = .08, tr = .34;
|
|
2368
|
+
function nr(e) {
|
|
2369
|
+
let t = F(e);
|
|
2370
|
+
if (!t) return "rgb(38, 42, 48)";
|
|
2371
|
+
let [n, r, i] = Re(t.r, t.g, t.b);
|
|
2372
|
+
return ze(n, Math.min(r, tr), .22 + i * .18, t.a);
|
|
2373
|
+
}
|
|
2374
|
+
function rr(e) {
|
|
2375
|
+
return {
|
|
2376
|
+
...e,
|
|
2377
|
+
fill: P(e.fill, nr),
|
|
2378
|
+
stroke: e.stroke ? Xn : e.stroke
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
function ir(e) {
|
|
2382
|
+
return e.hit?.kind === "room" && e.paint.fill !== void 0;
|
|
2383
|
+
}
|
|
2384
|
+
var ar = { transform(e, t) {
|
|
2385
|
+
switch (e.type) {
|
|
2386
|
+
case "rect": {
|
|
2387
|
+
let n = {
|
|
2388
|
+
...e,
|
|
2389
|
+
paint: rr(e.paint)
|
|
2390
|
+
};
|
|
2391
|
+
if (!ir(e)) return n;
|
|
2392
|
+
let r = t.roomSize * er;
|
|
2393
|
+
return [{
|
|
2394
|
+
type: "rect",
|
|
2395
|
+
x: e.x + r,
|
|
2396
|
+
y: e.y + r,
|
|
2397
|
+
width: e.width,
|
|
2398
|
+
height: e.height,
|
|
2399
|
+
cornerRadius: e.cornerRadius,
|
|
2400
|
+
paint: { fill: $n },
|
|
2401
|
+
layer: e.layer,
|
|
2402
|
+
noScale: e.noScale
|
|
2403
|
+
}, n];
|
|
2404
|
+
}
|
|
2405
|
+
case "circle": {
|
|
2406
|
+
let n = {
|
|
2407
|
+
...e,
|
|
2408
|
+
paint: rr(e.paint)
|
|
2409
|
+
};
|
|
2410
|
+
if (!ir(e)) return n;
|
|
2411
|
+
let r = t.roomSize * er;
|
|
2412
|
+
return [{
|
|
2413
|
+
type: "circle",
|
|
2414
|
+
cx: e.cx + r,
|
|
2415
|
+
cy: e.cy + r,
|
|
2416
|
+
radius: e.radius,
|
|
2417
|
+
paint: { fill: $n },
|
|
2418
|
+
layer: e.layer,
|
|
2419
|
+
noScale: e.noScale
|
|
2420
|
+
}, n];
|
|
2421
|
+
}
|
|
2422
|
+
case "polygon": return {
|
|
2423
|
+
...e,
|
|
2424
|
+
paint: rr(e.paint)
|
|
2425
|
+
};
|
|
2426
|
+
case "line": return {
|
|
2427
|
+
...e,
|
|
2428
|
+
paint: e.paint.stroke ? {
|
|
2429
|
+
...e.paint,
|
|
2430
|
+
stroke: Zn
|
|
2431
|
+
} : e.paint
|
|
2432
|
+
};
|
|
2433
|
+
case "text": return {
|
|
2434
|
+
...e,
|
|
2435
|
+
fill: Qn
|
|
2436
|
+
};
|
|
2437
|
+
case "image":
|
|
2438
|
+
case "group": return e;
|
|
2439
|
+
}
|
|
2440
|
+
} }, q = "#5a3a22", or = "#43301c", sr = 120, cr = 86, lr = 50, ur = 232, J = 205, dr = 158;
|
|
2441
|
+
function fr(e) {
|
|
2442
|
+
let t = F(e);
|
|
2443
|
+
if (!t) return I(ur, J, dr);
|
|
2444
|
+
let n = L(t);
|
|
2445
|
+
return I(Math.round(sr + (ur - sr) * n), Math.round(cr + (J - cr) * n), Math.round(lr + (dr - lr) * n), t.a);
|
|
2370
2446
|
}
|
|
2371
|
-
function
|
|
2372
|
-
|
|
2447
|
+
function pr(e) {
|
|
2448
|
+
let t = F(e);
|
|
2449
|
+
if (!t || t.a >= 1) return q;
|
|
2450
|
+
let n = F(q);
|
|
2451
|
+
return I(n.r, n.g, n.b, t.a);
|
|
2373
2452
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2453
|
+
function mr(e) {
|
|
2454
|
+
return {
|
|
2455
|
+
...e,
|
|
2456
|
+
fill: P(e.fill, fr),
|
|
2457
|
+
stroke: e.stroke ? pr(e.stroke) : e.stroke
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
var hr = { transform(e) {
|
|
2461
|
+
switch (e.type) {
|
|
2462
|
+
case "rect":
|
|
2463
|
+
case "circle":
|
|
2464
|
+
case "polygon": return {
|
|
2465
|
+
...e,
|
|
2466
|
+
paint: mr(e.paint)
|
|
2467
|
+
};
|
|
2468
|
+
case "line": return {
|
|
2469
|
+
...e,
|
|
2470
|
+
paint: e.paint.stroke ? {
|
|
2471
|
+
...e.paint,
|
|
2472
|
+
stroke: pr(e.paint.stroke)
|
|
2473
|
+
} : e.paint
|
|
2474
|
+
};
|
|
2475
|
+
case "text": return {
|
|
2476
|
+
...e,
|
|
2477
|
+
fill: or
|
|
2478
|
+
};
|
|
2479
|
+
case "image":
|
|
2480
|
+
case "group": return e;
|
|
2481
|
+
}
|
|
2482
|
+
} };
|
|
2483
|
+
function gr(e, t, n) {
|
|
2484
|
+
let r = [], i = n * .42;
|
|
2485
|
+
for (let a = 0; a < 8; a++) {
|
|
2486
|
+
let o = (-90 + a * 45) * (Math.PI / 180), s = a % 2 == 0 ? n : i;
|
|
2487
|
+
r.push(e + s * Math.cos(o), t + s * Math.sin(o));
|
|
2488
|
+
}
|
|
2489
|
+
return r;
|
|
2377
2490
|
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
return
|
|
2491
|
+
function _r() {
|
|
2492
|
+
let e;
|
|
2493
|
+
return {
|
|
2494
|
+
attach(t) {
|
|
2495
|
+
e = t.onViewportChange(() => t.invalidate());
|
|
2496
|
+
},
|
|
2497
|
+
detach() {
|
|
2498
|
+
e?.(), e = void 0;
|
|
2499
|
+
},
|
|
2500
|
+
render(e, t) {
|
|
2501
|
+
let n = t.maxX - t.minX, r = t.maxY - t.minY;
|
|
2502
|
+
if (n <= 0 || r <= 0) return [];
|
|
2503
|
+
let i = Math.min(n, r), a = i * .05, o = i * .012, s = i * .006, c = [];
|
|
2504
|
+
for (let e of [a, a + o]) c.push({
|
|
2505
|
+
type: "rect",
|
|
2506
|
+
x: t.minX + e,
|
|
2507
|
+
y: t.minY + e,
|
|
2508
|
+
width: n - e * 2,
|
|
2509
|
+
height: r - e * 2,
|
|
2510
|
+
paint: {
|
|
2511
|
+
stroke: q,
|
|
2512
|
+
strokeWidth: s
|
|
2513
|
+
},
|
|
2514
|
+
layer: "top"
|
|
2515
|
+
});
|
|
2516
|
+
let l = i * .07, u = t.maxX - a - o - l * 1.4, d = t.minY + a + o + l * 1.6;
|
|
2517
|
+
return c.push({
|
|
2518
|
+
type: "circle",
|
|
2519
|
+
cx: u,
|
|
2520
|
+
cy: d,
|
|
2521
|
+
radius: l * 1.25,
|
|
2522
|
+
paint: {
|
|
2523
|
+
stroke: q,
|
|
2524
|
+
strokeWidth: s
|
|
2525
|
+
},
|
|
2526
|
+
layer: "top"
|
|
2527
|
+
}), c.push({
|
|
2528
|
+
type: "polygon",
|
|
2529
|
+
vertices: gr(u, d, l),
|
|
2530
|
+
paint: {
|
|
2531
|
+
fill: I(ur, J, dr, .85),
|
|
2532
|
+
stroke: q,
|
|
2533
|
+
strokeWidth: s
|
|
2534
|
+
},
|
|
2535
|
+
layer: "top"
|
|
2536
|
+
}), c.push({
|
|
2537
|
+
type: "circle",
|
|
2538
|
+
cx: u,
|
|
2539
|
+
cy: d,
|
|
2540
|
+
radius: l * .16,
|
|
2541
|
+
paint: { fill: q },
|
|
2542
|
+
layer: "top"
|
|
2543
|
+
}), c.push({
|
|
2544
|
+
type: "text",
|
|
2545
|
+
x: u,
|
|
2546
|
+
y: d - l * 1.25 - l * .55,
|
|
2547
|
+
text: "N",
|
|
2548
|
+
fontSize: l * .5,
|
|
2549
|
+
fontStyle: "bold",
|
|
2550
|
+
fill: or,
|
|
2551
|
+
align: "center",
|
|
2552
|
+
verticalAlign: "middle",
|
|
2553
|
+
layer: "top"
|
|
2554
|
+
}), c;
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2381
2557
|
}
|
|
2382
2558
|
//#endregion
|
|
2383
|
-
//#region src/
|
|
2384
|
-
var
|
|
2559
|
+
//#region src/style/index.ts
|
|
2560
|
+
var vr = Ze, yr = lt, br = xt;
|
|
2561
|
+
function xr(e) {
|
|
2562
|
+
return Tt(e);
|
|
2563
|
+
}
|
|
2564
|
+
function Sr(e = {}) {
|
|
2565
|
+
return At(e);
|
|
2566
|
+
}
|
|
2567
|
+
var Cr = Ut, wr = nn;
|
|
2568
|
+
function Tr(e = {}) {
|
|
2569
|
+
return an(e);
|
|
2570
|
+
}
|
|
2571
|
+
var Er = gn, Dr = An, Or = Kn;
|
|
2572
|
+
function kr(e = {}) {
|
|
2573
|
+
return Yn(e);
|
|
2574
|
+
}
|
|
2575
|
+
var Ar = ar, jr = hr, Mr = class {
|
|
2385
2576
|
get settings() {
|
|
2386
2577
|
return this.state.settings;
|
|
2387
2578
|
}
|
|
@@ -2398,7 +2589,7 @@ var or = class {
|
|
|
2398
2589
|
return this.backend.events;
|
|
2399
2590
|
}
|
|
2400
2591
|
constructor(e, t, n, r) {
|
|
2401
|
-
this.currentStyle = u, this.state = new
|
|
2592
|
+
this.currentStyle = u, this.state = new be(e, t ?? ye()), this.backend = r ? r(this.state) : new Le(this.state, n);
|
|
2402
2593
|
}
|
|
2403
2594
|
destroy() {
|
|
2404
2595
|
this.backend.destroy();
|
|
@@ -2554,15 +2745,15 @@ var or = class {
|
|
|
2554
2745
|
getCullingMode() {
|
|
2555
2746
|
return this.state.settings.cullingMode;
|
|
2556
2747
|
}
|
|
2557
|
-
},
|
|
2558
|
-
function
|
|
2748
|
+
}, Nr = "room";
|
|
2749
|
+
function Pr(e, t) {
|
|
2559
2750
|
let n = /* @__PURE__ */ new Map();
|
|
2560
2751
|
function r(e) {
|
|
2561
2752
|
let t = n.get(e);
|
|
2562
2753
|
return t || (t = [], n.set(e, t)), t;
|
|
2563
2754
|
}
|
|
2564
2755
|
function i(e, t, n, i, o, s, c) {
|
|
2565
|
-
let l = e.layer ?? c ??
|
|
2756
|
+
let l = e.layer ?? c ?? Nr;
|
|
2566
2757
|
switch (e.type) {
|
|
2567
2758
|
case "rect": {
|
|
2568
2759
|
let a = {
|
|
@@ -2571,11 +2762,11 @@ function cr(e, t) {
|
|
|
2571
2762
|
y: (n + e.y) * i + s,
|
|
2572
2763
|
w: e.width * i,
|
|
2573
2764
|
h: e.height * i,
|
|
2574
|
-
fill:
|
|
2765
|
+
fill: M(e.paint.fill, t, n, i, o, s),
|
|
2575
2766
|
stroke: e.paint.stroke,
|
|
2576
2767
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2577
2768
|
cr: (e.cornerRadius ?? 0) * i,
|
|
2578
|
-
dash:
|
|
2769
|
+
dash: Ir(e.paint.dash, i, e.paint.dashEnabled)
|
|
2579
2770
|
};
|
|
2580
2771
|
r(l).push(a);
|
|
2581
2772
|
return;
|
|
@@ -2586,19 +2777,19 @@ function cr(e, t) {
|
|
|
2586
2777
|
cx: (t + e.cx) * i + o,
|
|
2587
2778
|
cy: (n + e.cy) * i + s,
|
|
2588
2779
|
r: e.radius * i,
|
|
2589
|
-
fill:
|
|
2780
|
+
fill: M(e.paint.fill, t, n, i, o, s),
|
|
2590
2781
|
stroke: e.paint.stroke,
|
|
2591
2782
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2592
|
-
dash:
|
|
2783
|
+
dash: Ir(e.paint.dash, i, e.paint.dashEnabled)
|
|
2593
2784
|
});
|
|
2594
2785
|
return;
|
|
2595
2786
|
case "line": {
|
|
2596
2787
|
let a = {
|
|
2597
2788
|
type: "line",
|
|
2598
|
-
points:
|
|
2789
|
+
points: Fr(e.points, t, n, i, o, s),
|
|
2599
2790
|
stroke: e.paint.stroke,
|
|
2600
2791
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2601
|
-
dash:
|
|
2792
|
+
dash: Ir(e.paint.dash, i, e.paint.dashEnabled),
|
|
2602
2793
|
lineCap: e.lineCap,
|
|
2603
2794
|
lineJoin: e.lineJoin,
|
|
2604
2795
|
alpha: e.paint.alpha
|
|
@@ -2609,8 +2800,8 @@ function cr(e, t) {
|
|
|
2609
2800
|
case "polygon": {
|
|
2610
2801
|
let a = {
|
|
2611
2802
|
type: "polygon",
|
|
2612
|
-
vertices:
|
|
2613
|
-
fill:
|
|
2803
|
+
vertices: Fr(e.vertices, t, n, i, o, s),
|
|
2804
|
+
fill: M(e.paint.fill, t, n, i, o, s),
|
|
2614
2805
|
stroke: e.paint.stroke,
|
|
2615
2806
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
2616
2807
|
};
|
|
@@ -2618,7 +2809,7 @@ function cr(e, t) {
|
|
|
2618
2809
|
return;
|
|
2619
2810
|
}
|
|
2620
2811
|
case "text": {
|
|
2621
|
-
let a =
|
|
2812
|
+
let a = Lr(e.transform, t, n, i, o, s), c = {
|
|
2622
2813
|
type: "text",
|
|
2623
2814
|
x: a ? 0 : (t + e.x) * i + o,
|
|
2624
2815
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -2641,7 +2832,7 @@ function cr(e, t) {
|
|
|
2641
2832
|
return;
|
|
2642
2833
|
}
|
|
2643
2834
|
case "image": {
|
|
2644
|
-
let a =
|
|
2835
|
+
let a = Lr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
2645
2836
|
r(l).push({
|
|
2646
2837
|
type: "image",
|
|
2647
2838
|
x: c,
|
|
@@ -2661,7 +2852,7 @@ function cr(e, t) {
|
|
|
2661
2852
|
function a(e, t, n, a, o, s, c) {
|
|
2662
2853
|
let l = e.layer ?? c;
|
|
2663
2854
|
if (e.noScale) {
|
|
2664
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
2855
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? Nr);
|
|
2665
2856
|
d.push({
|
|
2666
2857
|
type: "pushTransform",
|
|
2667
2858
|
matrix: [
|
|
@@ -2688,19 +2879,19 @@ function cr(e, t) {
|
|
|
2688
2879
|
});
|
|
2689
2880
|
return o;
|
|
2690
2881
|
}
|
|
2691
|
-
function
|
|
2882
|
+
function Fr(e, t, n, r, i, a) {
|
|
2692
2883
|
let o = Array(e.length);
|
|
2693
2884
|
for (let s = 0; s < e.length; s += 2) o[s] = (t + e[s]) * r + i, o[s + 1] = (n + e[s + 1]) * r + a;
|
|
2694
2885
|
return o;
|
|
2695
2886
|
}
|
|
2696
|
-
function
|
|
2887
|
+
function Ir(e, t, n) {
|
|
2697
2888
|
if (n === !1) return;
|
|
2698
2889
|
if (!e || e.length === 0) return e;
|
|
2699
2890
|
let r = Array(e.length);
|
|
2700
2891
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
2701
2892
|
return r;
|
|
2702
2893
|
}
|
|
2703
|
-
function
|
|
2894
|
+
function Lr(e, t, n, r, i, a) {
|
|
2704
2895
|
if (!e) return;
|
|
2705
2896
|
let [o, s, c, l, u, d] = e;
|
|
2706
2897
|
return [
|
|
@@ -2720,33 +2911,33 @@ function Y(e) {
|
|
|
2720
2911
|
function X(e, t) {
|
|
2721
2912
|
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? Y(t) : t}"`;
|
|
2722
2913
|
}
|
|
2723
|
-
function
|
|
2914
|
+
function Rr(e) {
|
|
2724
2915
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
2725
2916
|
}
|
|
2726
|
-
var
|
|
2727
|
-
function
|
|
2728
|
-
return `mmr-grad-${++
|
|
2917
|
+
var zr = 0;
|
|
2918
|
+
function Br() {
|
|
2919
|
+
return `mmr-grad-${++zr}`;
|
|
2729
2920
|
}
|
|
2730
|
-
function
|
|
2921
|
+
function Vr(e, t) {
|
|
2731
2922
|
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join("");
|
|
2732
2923
|
return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
|
|
2733
2924
|
}
|
|
2734
|
-
function
|
|
2925
|
+
function Hr(e, t) {
|
|
2735
2926
|
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join(""), r = (t.fx === void 0 ? "" : ` fx="${t.fx}"`) + (t.fy === void 0 ? "" : ` fy="${t.fy}"`) + (t.fr === void 0 ? "" : ` fr="${t.fr}"`);
|
|
2736
2927
|
return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
|
|
2737
2928
|
}
|
|
2738
|
-
function
|
|
2929
|
+
function Ur(e, t) {
|
|
2739
2930
|
if (e === void 0) return;
|
|
2740
2931
|
if (typeof e == "string") return e;
|
|
2741
|
-
let n =
|
|
2742
|
-
return t.push(e.type === "linear" ?
|
|
2932
|
+
let n = Br();
|
|
2933
|
+
return t.push(e.type === "linear" ? Vr(n, e) : Hr(n, e)), `url(#${n})`;
|
|
2743
2934
|
}
|
|
2744
|
-
function
|
|
2935
|
+
function Wr(e) {
|
|
2745
2936
|
let t = [];
|
|
2746
|
-
for (let n of e)
|
|
2937
|
+
for (let n of e) Gr(n.commands, t);
|
|
2747
2938
|
return t;
|
|
2748
2939
|
}
|
|
2749
|
-
function
|
|
2940
|
+
function Gr(e, t) {
|
|
2750
2941
|
let n = [];
|
|
2751
2942
|
for (let r of e) switch (r.type) {
|
|
2752
2943
|
case "pushTransform": {
|
|
@@ -2764,21 +2955,21 @@ function vr(e, t) {
|
|
|
2764
2955
|
break;
|
|
2765
2956
|
}
|
|
2766
2957
|
default:
|
|
2767
|
-
|
|
2958
|
+
Kr(r, t);
|
|
2768
2959
|
break;
|
|
2769
2960
|
}
|
|
2770
2961
|
for (; n.length > 0;) t.push(n.pop());
|
|
2771
2962
|
}
|
|
2772
|
-
function
|
|
2963
|
+
function Kr(e, t) {
|
|
2773
2964
|
switch (e.type) {
|
|
2774
2965
|
case "rect": {
|
|
2775
|
-
let n =
|
|
2776
|
-
t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${
|
|
2966
|
+
let n = Ur(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
|
|
2967
|
+
t.push(`<rect${X("x", e.x)}${X("y", e.y)}${X("width", e.w)}${X("height", e.h)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${r}${Rr(e.dash)}/>`);
|
|
2777
2968
|
return;
|
|
2778
2969
|
}
|
|
2779
2970
|
case "circle": {
|
|
2780
|
-
let n =
|
|
2781
|
-
t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${
|
|
2971
|
+
let n = Ur(e.fill, t) ?? "none";
|
|
2972
|
+
t.push(`<circle${X("cx", e.cx)}${X("cy", e.cy)}${X("r", e.r)}${X("fill", n)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Rr(e.dash)}/>`);
|
|
2782
2973
|
return;
|
|
2783
2974
|
}
|
|
2784
2975
|
case "line": {
|
|
@@ -2786,7 +2977,7 @@ function yr(e, t) {
|
|
|
2786
2977
|
if (n.length < 2) return;
|
|
2787
2978
|
let r = [];
|
|
2788
2979
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
2789
|
-
t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${
|
|
2980
|
+
t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Rr(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
|
|
2790
2981
|
return;
|
|
2791
2982
|
}
|
|
2792
2983
|
case "polygon": {
|
|
@@ -2794,7 +2985,7 @@ function yr(e, t) {
|
|
|
2794
2985
|
if (n.length < 4) return;
|
|
2795
2986
|
let r = [];
|
|
2796
2987
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
2797
|
-
let i =
|
|
2988
|
+
let i = Ur(e.fill, t);
|
|
2798
2989
|
t.push(`<polygon points="${r.join(" ")}"${X("fill", i)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}/>`);
|
|
2799
2990
|
return;
|
|
2800
2991
|
}
|
|
@@ -2817,18 +3008,18 @@ function yr(e, t) {
|
|
|
2817
3008
|
}
|
|
2818
3009
|
//#endregion
|
|
2819
3010
|
//#region src/render/CanvasRenderer.ts
|
|
2820
|
-
var
|
|
3011
|
+
var qr = (e) => {
|
|
2821
3012
|
if (typeof Image < "u") {
|
|
2822
3013
|
let t = new Image();
|
|
2823
3014
|
return t.src = e, t;
|
|
2824
3015
|
}
|
|
2825
3016
|
return null;
|
|
2826
3017
|
};
|
|
2827
|
-
function
|
|
2828
|
-
let r = n.imageFactory ??
|
|
2829
|
-
for (let n of t)
|
|
3018
|
+
function Jr(e, t, n = {}) {
|
|
3019
|
+
let r = n.imageFactory ?? qr;
|
|
3020
|
+
for (let n of t) Yr(e, n.commands, r);
|
|
2830
3021
|
}
|
|
2831
|
-
function
|
|
3022
|
+
function Yr(e, t, n) {
|
|
2832
3023
|
let r = 0;
|
|
2833
3024
|
for (let i of t) switch (i.type) {
|
|
2834
3025
|
case "pushTransform":
|
|
@@ -2842,18 +3033,18 @@ function Sr(e, t, n) {
|
|
|
2842
3033
|
r > 0 && (e.restore(), r--);
|
|
2843
3034
|
break;
|
|
2844
3035
|
default:
|
|
2845
|
-
|
|
3036
|
+
Xr(e, i, n);
|
|
2846
3037
|
break;
|
|
2847
3038
|
}
|
|
2848
3039
|
for (; r > 0;) e.restore(), r--;
|
|
2849
3040
|
}
|
|
2850
|
-
function
|
|
3041
|
+
function Xr(e, t, n) {
|
|
2851
3042
|
switch (t.type) {
|
|
2852
3043
|
case "rect":
|
|
2853
|
-
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle =
|
|
3044
|
+
e.beginPath(), t.cr > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.w, t.h, t.cr) : e.rect(t.x, t.y, t.w, t.h), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
2854
3045
|
break;
|
|
2855
3046
|
case "circle":
|
|
2856
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
3047
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
2857
3048
|
break;
|
|
2858
3049
|
case "line": {
|
|
2859
3050
|
if (t.points.length < 4) break;
|
|
@@ -2867,7 +3058,7 @@ function Cr(e, t, n) {
|
|
|
2867
3058
|
if (t.vertices.length < 4) break;
|
|
2868
3059
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
2869
3060
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
2870
|
-
e.closePath(), t.fill && (e.fillStyle =
|
|
3061
|
+
e.closePath(), t.fill && (e.fillStyle = A(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
2871
3062
|
break;
|
|
2872
3063
|
case "text": {
|
|
2873
3064
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -2908,7 +3099,7 @@ function Cr(e, t, n) {
|
|
|
2908
3099
|
}
|
|
2909
3100
|
//#endregion
|
|
2910
3101
|
//#region src/export/sceneBounds.ts
|
|
2911
|
-
function
|
|
3102
|
+
function Zr(e, t, n = 0) {
|
|
2912
3103
|
if (!t.worldToScene) return e;
|
|
2913
3104
|
let r = [
|
|
2914
3105
|
t.worldToScene(e.x, e.y),
|
|
@@ -2926,15 +3117,15 @@ function wr(e, t, n = 0) {
|
|
|
2926
3117
|
}
|
|
2927
3118
|
//#endregion
|
|
2928
3119
|
//#region src/export/SvgExporter.ts
|
|
2929
|
-
var
|
|
3120
|
+
var Qr = {
|
|
2930
3121
|
scale: 1,
|
|
2931
3122
|
offsetX: 0,
|
|
2932
3123
|
offsetY: 0
|
|
2933
3124
|
};
|
|
2934
|
-
function
|
|
3125
|
+
function $r(e) {
|
|
2935
3126
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2936
3127
|
}
|
|
2937
|
-
var
|
|
3128
|
+
var ei = class {
|
|
2938
3129
|
constructor(e = {}) {
|
|
2939
3130
|
this.options = e;
|
|
2940
3131
|
}
|
|
@@ -2943,30 +3134,30 @@ var Dr = class {
|
|
|
2943
3134
|
if (i === void 0 || a === void 0 || !o) return;
|
|
2944
3135
|
let s = o, c = s.getPlane(a);
|
|
2945
3136
|
if (!c) return;
|
|
2946
|
-
let l = e.settings, d = this.options.padding ?? 3, f = e.computeExportBounds(s, c, this.options.roomId, d), p = r.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(), m =
|
|
3137
|
+
let l = e.settings, d = this.options.padding ?? 3, f = e.computeExportBounds(s, c, this.options.roomId, d), p = r.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(), m = k(new g(e.mapReader, l).buildScene(s, c, a, e.lens), p, l, {
|
|
2947
3138
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
2948
3139
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
2949
3140
|
}), h = {
|
|
2950
3141
|
scale: 1,
|
|
2951
3142
|
roomSize: l.roomSize
|
|
2952
|
-
}, _ = (e) => t === u ? e :
|
|
2953
|
-
return y.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${v.x} ${v.y} ${v.w} ${v.h}">`), y.push(`<rect x="${v.x}" y="${v.y}" width="${v.w}" height="${v.h}" fill="${
|
|
3143
|
+
}, _ = (e) => t === u ? e : C(e, t, h), v = Zr(f, t, l.roomSize * .5), y = [];
|
|
3144
|
+
return y.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${v.x} ${v.y} ${v.w} ${v.h}">`), y.push(`<rect x="${v.x}" y="${v.y}" width="${v.w}" height="${v.h}" fill="${$r(l.backgroundColor)}"/>`), S(m, {
|
|
2954
3145
|
state: e,
|
|
2955
3146
|
viewportBounds: p,
|
|
2956
3147
|
sceneOverlays: n,
|
|
2957
3148
|
overlays: this.options.overlays
|
|
2958
3149
|
}, (e, t) => {
|
|
2959
|
-
e.length !== 0 && y.push(...
|
|
3150
|
+
e.length !== 0 && y.push(...Wr(Pr(t ? e : _(e), Qr)));
|
|
2960
3151
|
}), y.push("</svg>"), y.join("\n");
|
|
2961
3152
|
}
|
|
2962
|
-
},
|
|
3153
|
+
}, ti = class {
|
|
2963
3154
|
constructor(e = {}) {
|
|
2964
3155
|
this.options = e;
|
|
2965
3156
|
}
|
|
2966
3157
|
render({ backend: e }) {
|
|
2967
3158
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
2968
3159
|
}
|
|
2969
|
-
},
|
|
3160
|
+
}, ni = class {
|
|
2970
3161
|
constructor(e = {}) {
|
|
2971
3162
|
this.options = e;
|
|
2972
3163
|
}
|
|
@@ -2983,14 +3174,14 @@ var Dr = class {
|
|
|
2983
3174
|
};
|
|
2984
3175
|
//#endregion
|
|
2985
3176
|
//#region src/export/canvasToBytes.ts
|
|
2986
|
-
function
|
|
3177
|
+
function ri(e, t = "image/png", n) {
|
|
2987
3178
|
let r = e.toDataURL(t, n), i = r.indexOf(","), a = i >= 0 ? r.slice(i + 1) : r, o = atob(a), s = new Uint8Array(o.length);
|
|
2988
3179
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
2989
3180
|
return s;
|
|
2990
3181
|
}
|
|
2991
3182
|
//#endregion
|
|
2992
3183
|
//#region src/export/CanvasExporter.ts
|
|
2993
|
-
var
|
|
3184
|
+
var ii = class {
|
|
2994
3185
|
constructor(e) {
|
|
2995
3186
|
this.options = e;
|
|
2996
3187
|
}
|
|
@@ -2999,71 +3190,71 @@ var jr = class {
|
|
|
2999
3190
|
if (i === void 0 || a === void 0 || !o) return;
|
|
3000
3191
|
let s = o, c = s.getPlane(a);
|
|
3001
3192
|
if (!c) return;
|
|
3002
|
-
let l = e.settings, { width: d, height: f } = this.options, p = this.options.padding ?? 3, m = e.computeExportBounds(s, c, this.options.roomId, p), h =
|
|
3193
|
+
let l = e.settings, { width: d, height: f } = this.options, p = this.options.padding ?? 3, m = e.computeExportBounds(s, c, this.options.roomId, p), h = Zr(m, t, l.roomSize * .5), _ = Math.min(d / h.w, f / h.h), v = h.w * _, y = h.h * _, b = (d - v) / 2 - h.x * _, x = (f - y) / 2 - h.y * _, ee = {
|
|
3003
3194
|
scale: _,
|
|
3004
3195
|
offsetX: b,
|
|
3005
3196
|
offsetY: x
|
|
3006
|
-
},
|
|
3197
|
+
}, te = r.forRenderCamera(d, f, _, b, x), w = {
|
|
3007
3198
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
3008
3199
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
3009
|
-
},
|
|
3010
|
-
|
|
3011
|
-
let
|
|
3012
|
-
if (!
|
|
3013
|
-
|
|
3014
|
-
let
|
|
3200
|
+
}, ne = k(new g(e.mapReader, l).buildScene(s, c, a, e.lens), te.getViewportBounds(), l, w), T = D.Util.createCanvasElement();
|
|
3201
|
+
T.width = d, T.height = f;
|
|
3202
|
+
let E = T.getContext("2d");
|
|
3203
|
+
if (!E) return;
|
|
3204
|
+
E.fillStyle = l.backgroundColor, E.fillRect(0, 0, d, f);
|
|
3205
|
+
let re = {
|
|
3015
3206
|
scale: _,
|
|
3016
3207
|
roomSize: l.roomSize
|
|
3017
|
-
},
|
|
3018
|
-
return S(
|
|
3208
|
+
}, ie = (e) => t === u ? e : C(e, t, re);
|
|
3209
|
+
return S(ne, {
|
|
3019
3210
|
state: e,
|
|
3020
3211
|
viewportBounds: r.forMapBounds(m.x, m.x + m.w, m.y, m.y + m.h).getViewportBounds(),
|
|
3021
3212
|
sceneOverlays: n,
|
|
3022
3213
|
overlays: this.options.overlays
|
|
3023
3214
|
}, (e, t) => {
|
|
3024
|
-
e.length !== 0 &&
|
|
3025
|
-
}),
|
|
3215
|
+
e.length !== 0 && Jr(E, Pr(t ? e : ie(e), ee));
|
|
3216
|
+
}), T;
|
|
3026
3217
|
}
|
|
3027
|
-
},
|
|
3218
|
+
}, ai = class {
|
|
3028
3219
|
constructor(e) {
|
|
3029
|
-
this.options = e, this.canvasExporter = new
|
|
3220
|
+
this.options = e, this.canvasExporter = new ii(e);
|
|
3030
3221
|
}
|
|
3031
3222
|
render(e) {
|
|
3032
3223
|
let t = this.canvasExporter.render(e);
|
|
3033
|
-
if (t) return
|
|
3224
|
+
if (t) return ri(t, this.options.mimeType, this.options.quality);
|
|
3034
3225
|
}
|
|
3035
|
-
},
|
|
3036
|
-
function
|
|
3226
|
+
}, Z, oi, si = 256;
|
|
3227
|
+
function ci(e, t, n) {
|
|
3037
3228
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
3038
|
-
if (
|
|
3039
|
-
let i =
|
|
3229
|
+
if (oi === r && Z) return Z;
|
|
3230
|
+
let i = si, a = i / 2, o = document.createElement("canvas");
|
|
3040
3231
|
o.width = i, o.height = i;
|
|
3041
3232
|
let s = o.getContext("2d");
|
|
3042
3233
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
3043
3234
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
3044
3235
|
c.addColorStop(0, "rgba(0, 0, 0, 1)"), c.addColorStop(l * .25, "rgba(0, 0, 0, 0.97)"), c.addColorStop(l * .5, "rgba(0, 0, 0, 0.82)"), c.addColorStop(l * .7, "rgba(0, 0, 0, 0.50)"), c.addColorStop(l * .85, "rgba(0, 0, 0, 0.22)"), c.addColorStop(l * .95, "rgba(0, 0, 0, 0.06)"), c.addColorStop(l, "rgba(0, 0, 0, 0)"), l < .98 && c.addColorStop(1, "rgba(0, 0, 0, 0)"), s.fillStyle = c, s.beginPath(), s.arc(a, a, a, 0, Math.PI * 2), s.fill(), s.globalCompositeOperation = "source-over";
|
|
3045
3236
|
let u = parseInt(t.slice(1, 3), 16), d = parseInt(t.slice(3, 5), 16), f = parseInt(t.slice(5, 7), 16), p = s.createRadialGradient(a, a, 0, a, a, a * l);
|
|
3046
|
-
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i),
|
|
3237
|
+
return p.addColorStop(0, `rgba(${u}, ${d}, ${f}, 0.05)`), p.addColorStop(1, `rgba(${u}, ${d}, ${f}, 0)`), s.fillStyle = p, s.fillRect(0, 0, i, i), Z = o.toDataURL(), oi = r, Z;
|
|
3047
3238
|
}
|
|
3048
|
-
function
|
|
3239
|
+
function li(e, t, n, r) {
|
|
3049
3240
|
let { radius: i, intensity: a, color: o } = r, s = n.maxX - n.minX, c = n.maxY - n.minY, l = Math.sqrt(s * s + c * c), u = Math.max(l * 2.5, i * 4);
|
|
3050
3241
|
return {
|
|
3051
3242
|
cx: e,
|
|
3052
3243
|
cy: t,
|
|
3053
3244
|
displaySize: u,
|
|
3054
|
-
src:
|
|
3245
|
+
src: ci(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
3055
3246
|
};
|
|
3056
3247
|
}
|
|
3057
3248
|
//#endregion
|
|
3058
3249
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
3059
|
-
var
|
|
3250
|
+
var ui = {
|
|
3060
3251
|
color: "#ffcc44",
|
|
3061
3252
|
radius: 12,
|
|
3062
3253
|
intensity: .7
|
|
3063
|
-
},
|
|
3254
|
+
}, di = class {
|
|
3064
3255
|
constructor(e) {
|
|
3065
3256
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
3066
|
-
...
|
|
3257
|
+
...ui,
|
|
3067
3258
|
...e
|
|
3068
3259
|
};
|
|
3069
3260
|
}
|
|
@@ -3086,7 +3277,7 @@ var Lr = {
|
|
|
3086
3277
|
if (e.positionRoomId === void 0) return;
|
|
3087
3278
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
3088
3279
|
if (!n) return;
|
|
3089
|
-
let r =
|
|
3280
|
+
let r = li(n.x, n.y, t, this.params);
|
|
3090
3281
|
return {
|
|
3091
3282
|
type: "image",
|
|
3092
3283
|
x: r.cx - r.displaySize / 2,
|
|
@@ -3097,7 +3288,244 @@ var Lr = {
|
|
|
3097
3288
|
layer: "overlay"
|
|
3098
3289
|
};
|
|
3099
3290
|
}
|
|
3100
|
-
},
|
|
3291
|
+
}, fi = () => typeof performance < "u" ? performance.now() : Date.now(), pi = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(fi()), 16), mi = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), hi = class {
|
|
3292
|
+
constructor(e, t, n = {}) {
|
|
3293
|
+
this.worldX = e, this.worldY = t, this.cancelled = !1, this.transform = (e, t) => ({
|
|
3294
|
+
x: e,
|
|
3295
|
+
y: t
|
|
3296
|
+
}), this.duration = n.duration ?? 400, this.color = n.color ?? "#00e5b2", this.startRadius = n.startRadius ?? .3, this.endRadius = n.endRadius ?? 1.2, this.strokeWidth = n.strokeWidth ?? .08, this.onComplete = n.onComplete;
|
|
3297
|
+
}
|
|
3298
|
+
attach(e) {
|
|
3299
|
+
let t = this.transform(this.worldX, this.worldY);
|
|
3300
|
+
this.ring = new D.Circle({
|
|
3301
|
+
x: t.x,
|
|
3302
|
+
y: t.y,
|
|
3303
|
+
radius: this.startRadius,
|
|
3304
|
+
stroke: this.color,
|
|
3305
|
+
strokeWidth: this.strokeWidth,
|
|
3306
|
+
listening: !1
|
|
3307
|
+
}), e.add(this.ring), e.batchDraw();
|
|
3308
|
+
let n = (t) => {
|
|
3309
|
+
this.ring && (this.ring.radius(this.startRadius + (this.endRadius - this.startRadius) * t), this.ring.opacity(1 - t), e.batchDraw());
|
|
3310
|
+
};
|
|
3311
|
+
if (this.duration <= 0) {
|
|
3312
|
+
n(1), this.onComplete?.();
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
3315
|
+
let r = fi(), i = (e) => {
|
|
3316
|
+
if (this.cancelled) return;
|
|
3317
|
+
let t = Math.min((e - r) / this.duration, 1);
|
|
3318
|
+
n(t), t < 1 ? this.rafId = pi(i) : (this.rafId = void 0, this.onComplete?.());
|
|
3319
|
+
};
|
|
3320
|
+
this.rafId = pi(i);
|
|
3321
|
+
}
|
|
3322
|
+
updateViewport(e, t, n) {
|
|
3323
|
+
if (this.transform = n, this.ring) {
|
|
3324
|
+
let e = n(this.worldX, this.worldY);
|
|
3325
|
+
this.ring.position({
|
|
3326
|
+
x: e.x,
|
|
3327
|
+
y: e.y
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
destroy() {
|
|
3332
|
+
this.cancelled = !0, this.rafId !== void 0 && (mi(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
|
|
3333
|
+
}
|
|
3334
|
+
}, gi = {
|
|
3335
|
+
n: {
|
|
3336
|
+
x: 0,
|
|
3337
|
+
y: -1
|
|
3338
|
+
},
|
|
3339
|
+
s: {
|
|
3340
|
+
x: 0,
|
|
3341
|
+
y: 1
|
|
3342
|
+
},
|
|
3343
|
+
e: {
|
|
3344
|
+
x: 1,
|
|
3345
|
+
y: 0
|
|
3346
|
+
},
|
|
3347
|
+
w: {
|
|
3348
|
+
x: -1,
|
|
3349
|
+
y: 0
|
|
3350
|
+
},
|
|
3351
|
+
ne: {
|
|
3352
|
+
x: Math.SQRT1_2,
|
|
3353
|
+
y: -Math.SQRT1_2
|
|
3354
|
+
},
|
|
3355
|
+
nw: {
|
|
3356
|
+
x: -Math.SQRT1_2,
|
|
3357
|
+
y: -Math.SQRT1_2
|
|
3358
|
+
},
|
|
3359
|
+
se: {
|
|
3360
|
+
x: Math.SQRT1_2,
|
|
3361
|
+
y: Math.SQRT1_2
|
|
3362
|
+
},
|
|
3363
|
+
sw: {
|
|
3364
|
+
x: -Math.SQRT1_2,
|
|
3365
|
+
y: Math.SQRT1_2
|
|
3366
|
+
}
|
|
3367
|
+
}, _i = [
|
|
3368
|
+
"n",
|
|
3369
|
+
"s",
|
|
3370
|
+
"e",
|
|
3371
|
+
"w",
|
|
3372
|
+
"ne",
|
|
3373
|
+
"nw",
|
|
3374
|
+
"se",
|
|
3375
|
+
"sw"
|
|
3376
|
+
], vi = new Set([
|
|
3377
|
+
"ne",
|
|
3378
|
+
"nw",
|
|
3379
|
+
"se",
|
|
3380
|
+
"sw"
|
|
3381
|
+
]), yi = {
|
|
3382
|
+
clear: 10,
|
|
3383
|
+
diagonal: .3,
|
|
3384
|
+
preferred: 1,
|
|
3385
|
+
distance: .05
|
|
3386
|
+
}, bi = [
|
|
3387
|
+
"n",
|
|
3388
|
+
"s",
|
|
3389
|
+
"e",
|
|
3390
|
+
"w"
|
|
3391
|
+
], xi = [
|
|
3392
|
+
"n",
|
|
3393
|
+
"s",
|
|
3394
|
+
"e",
|
|
3395
|
+
"w",
|
|
3396
|
+
"ne",
|
|
3397
|
+
"nw",
|
|
3398
|
+
"se",
|
|
3399
|
+
"sw"
|
|
3400
|
+
];
|
|
3401
|
+
function Si(e, t) {
|
|
3402
|
+
return Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)) * Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
|
|
3403
|
+
}
|
|
3404
|
+
function Ci(e, t) {
|
|
3405
|
+
let n = Math.max(e.x - (t.x + t.width), t.x - (e.x + e.width), 0), r = Math.max(e.y - (t.y + t.height), t.y - (e.y + e.height), 0);
|
|
3406
|
+
return Math.hypot(n, r);
|
|
3407
|
+
}
|
|
3408
|
+
function Q(e, t, n) {
|
|
3409
|
+
let r = gi[t];
|
|
3410
|
+
if (vi.has(t)) {
|
|
3411
|
+
let t = e.x + r.x * n, i = e.y + r.y * n;
|
|
3412
|
+
return {
|
|
3413
|
+
x: r.x < 0 ? t - e.width : t,
|
|
3414
|
+
y: r.y < 0 ? i - e.height : i,
|
|
3415
|
+
width: e.width,
|
|
3416
|
+
height: e.height
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
let i = n + (Math.abs(r.x) * e.width / 2 + Math.abs(r.y) * e.height / 2), a = e.x + r.x * i, o = e.y + r.y * i;
|
|
3420
|
+
return {
|
|
3421
|
+
x: a - e.width / 2,
|
|
3422
|
+
y: o - e.height / 2,
|
|
3423
|
+
width: e.width,
|
|
3424
|
+
height: e.height
|
|
3425
|
+
};
|
|
3426
|
+
}
|
|
3427
|
+
function wi(e, t, n = {}) {
|
|
3428
|
+
let r = n.offset ?? .6, i = n.slots === 4 ? bi : _i, a = {
|
|
3429
|
+
...yi,
|
|
3430
|
+
...n.weights
|
|
3431
|
+
}, o = [], s = [];
|
|
3432
|
+
for (let c of e) {
|
|
3433
|
+
let e = n.extend ?? 0, l = n.clearCap ?? Math.max(c.width, c.height), u = Math.max(.1, Math.min(c.width, c.height) * .5), d = t.concat(o), f = r + Math.max(c.width, c.height) + e + l, p = d.filter((e) => !(e.kind !== "exit" && c.x >= e.x && c.x <= e.x + e.width && c.y >= e.y && c.y <= e.y + e.height) && e.x < c.x + f && e.x + e.width > c.x - f && e.y < c.y + f && e.y + e.height > c.y - f), m, h = [];
|
|
3434
|
+
for (let t of i) {
|
|
3435
|
+
let i;
|
|
3436
|
+
for (let n = r; n <= r + e + 1e-9; n += u) {
|
|
3437
|
+
let e = Q(c, t, n), r = !1, o = Infinity;
|
|
3438
|
+
for (let t of p) {
|
|
3439
|
+
if (t.kind !== "exit" && Si(e, t) > 0) {
|
|
3440
|
+
r = !0;
|
|
3441
|
+
break;
|
|
3442
|
+
}
|
|
3443
|
+
let n = Ci(e, t);
|
|
3444
|
+
n < o && (o = n);
|
|
3445
|
+
}
|
|
3446
|
+
if (r) {
|
|
3447
|
+
if (i) break;
|
|
3448
|
+
continue;
|
|
3449
|
+
}
|
|
3450
|
+
let s = Math.min(o, l) - n * a.distance;
|
|
3451
|
+
(!i || s > i.value) && (i = {
|
|
3452
|
+
box: e,
|
|
3453
|
+
off: n,
|
|
3454
|
+
value: s,
|
|
3455
|
+
clearance: o
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
if (!i) {
|
|
3459
|
+
n.onScored && h.push({
|
|
3460
|
+
dir: t,
|
|
3461
|
+
valid: !1,
|
|
3462
|
+
clearance: 0,
|
|
3463
|
+
off: r,
|
|
3464
|
+
cost: Infinity,
|
|
3465
|
+
box: Q(c, t, r)
|
|
3466
|
+
});
|
|
3467
|
+
continue;
|
|
3468
|
+
}
|
|
3469
|
+
let o = 0;
|
|
3470
|
+
c.preferred ? t === c.preferred && (o -= a.preferred) : vi.has(t) && (o += a.diagonal);
|
|
3471
|
+
let s = -i.value * a.clear + o;
|
|
3472
|
+
n.onScored && h.push({
|
|
3473
|
+
dir: t,
|
|
3474
|
+
valid: !0,
|
|
3475
|
+
clearance: i.clearance,
|
|
3476
|
+
off: i.off,
|
|
3477
|
+
cost: s,
|
|
3478
|
+
box: i.box
|
|
3479
|
+
}), (!m || s < m.cost) && (m = {
|
|
3480
|
+
box: i.box,
|
|
3481
|
+
dir: t,
|
|
3482
|
+
off: i.off,
|
|
3483
|
+
cost: s,
|
|
3484
|
+
clearance: i.clearance
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
if (m ||= {
|
|
3488
|
+
box: Q(c, i[0], r),
|
|
3489
|
+
dir: i[0],
|
|
3490
|
+
off: r,
|
|
3491
|
+
cost: 0,
|
|
3492
|
+
clearance: 0
|
|
3493
|
+
}, m.clearance < (n.minClearance ?? 0)) for (let e of xi) {
|
|
3494
|
+
let t = Q(c, e, r);
|
|
3495
|
+
if (!p.some((e) => e.kind !== "exit" && Si(t, e) > 0)) {
|
|
3496
|
+
m = {
|
|
3497
|
+
box: t,
|
|
3498
|
+
dir: e,
|
|
3499
|
+
off: r,
|
|
3500
|
+
cost: m.cost,
|
|
3501
|
+
clearance: m.clearance
|
|
3502
|
+
};
|
|
3503
|
+
break;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
n.onScored?.(c, h, m.dir);
|
|
3507
|
+
let g = gi[m.dir];
|
|
3508
|
+
s.push({
|
|
3509
|
+
id: c.id,
|
|
3510
|
+
x: m.box.x,
|
|
3511
|
+
y: m.box.y,
|
|
3512
|
+
width: c.width,
|
|
3513
|
+
height: c.height,
|
|
3514
|
+
direction: m.dir,
|
|
3515
|
+
leader: {
|
|
3516
|
+
x: c.x + g.x * m.off,
|
|
3517
|
+
y: c.y + g.y * m.off
|
|
3518
|
+
}
|
|
3519
|
+
}), o.push({
|
|
3520
|
+
...m.box,
|
|
3521
|
+
kind: "label"
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
return s;
|
|
3525
|
+
}
|
|
3526
|
+
//#endregion
|
|
3527
|
+
//#region node_modules/node-dijkstra/libs/PriorityQueue.js
|
|
3528
|
+
var Ti = /* @__PURE__ */ O(((e, t) => {
|
|
3101
3529
|
t.exports = class {
|
|
3102
3530
|
constructor() {
|
|
3103
3531
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -3127,14 +3555,14 @@ var Lr = {
|
|
|
3127
3555
|
return this.queue.find((t) => t.key === e);
|
|
3128
3556
|
}
|
|
3129
3557
|
};
|
|
3130
|
-
})),
|
|
3558
|
+
})), Ei = /* @__PURE__ */ O(((e, t) => {
|
|
3131
3559
|
function n(e, t) {
|
|
3132
3560
|
let r = /* @__PURE__ */ new Map();
|
|
3133
3561
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
3134
3562
|
return r;
|
|
3135
3563
|
}
|
|
3136
3564
|
t.exports = n;
|
|
3137
|
-
})),
|
|
3565
|
+
})), Di = /* @__PURE__ */ O(((e, t) => {
|
|
3138
3566
|
function n(e) {
|
|
3139
3567
|
let t = Number(e);
|
|
3140
3568
|
return !(isNaN(t) || t <= 0);
|
|
@@ -3149,7 +3577,7 @@ var Lr = {
|
|
|
3149
3577
|
}), t;
|
|
3150
3578
|
}
|
|
3151
3579
|
t.exports = r;
|
|
3152
|
-
})),
|
|
3580
|
+
})), Oi = /* @__PURE__ */ O(((e, t) => {
|
|
3153
3581
|
function n(e) {
|
|
3154
3582
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
3155
3583
|
e.forEach((e, t) => {
|
|
@@ -3161,8 +3589,8 @@ var Lr = {
|
|
|
3161
3589
|
});
|
|
3162
3590
|
}
|
|
3163
3591
|
t.exports = n;
|
|
3164
|
-
})),
|
|
3165
|
-
var n =
|
|
3592
|
+
})), ki = /* @__PURE__ */ he((/* @__PURE__ */ O(((e, t) => {
|
|
3593
|
+
var n = Ti(), r = Ei(), i = Di(), a = Oi();
|
|
3166
3594
|
t.exports = class {
|
|
3167
3595
|
constructor(e) {
|
|
3168
3596
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -3212,7 +3640,7 @@ var Lr = {
|
|
|
3212
3640
|
return this.path(...e);
|
|
3213
3641
|
}
|
|
3214
3642
|
};
|
|
3215
|
-
})))(), 1),
|
|
3643
|
+
})))(), 1), Ai = {
|
|
3216
3644
|
1: "north",
|
|
3217
3645
|
2: "northeast",
|
|
3218
3646
|
3: "northwest",
|
|
@@ -3225,7 +3653,7 @@ var Lr = {
|
|
|
3225
3653
|
10: "down",
|
|
3226
3654
|
11: "in",
|
|
3227
3655
|
12: "out"
|
|
3228
|
-
},
|
|
3656
|
+
}, ji = {
|
|
3229
3657
|
north: "n",
|
|
3230
3658
|
northeast: "ne",
|
|
3231
3659
|
northwest: "nw",
|
|
@@ -3238,7 +3666,7 @@ var Lr = {
|
|
|
3238
3666
|
down: "down",
|
|
3239
3667
|
in: "in",
|
|
3240
3668
|
out: "out"
|
|
3241
|
-
},
|
|
3669
|
+
}, Mi = class {
|
|
3242
3670
|
constructor(e) {
|
|
3243
3671
|
this.mapReader = e, this.data = this.buildGraph();
|
|
3244
3672
|
}
|
|
@@ -3264,12 +3692,12 @@ var Lr = {
|
|
|
3264
3692
|
buildGraph() {
|
|
3265
3693
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
3266
3694
|
return this.mapReader.getRooms().forEach((i) => {
|
|
3267
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
3695
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Ai[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
3268
3696
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
3269
3697
|
if (s.has(e)) return;
|
|
3270
3698
|
let c = this.mapReader.getRoom(t);
|
|
3271
3699
|
if (c) {
|
|
3272
|
-
let s =
|
|
3700
|
+
let s = ji[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
3273
3701
|
a.push({
|
|
3274
3702
|
id: t,
|
|
3275
3703
|
weight: l
|
|
@@ -3300,7 +3728,7 @@ var Lr = {
|
|
|
3300
3728
|
};
|
|
3301
3729
|
//#endregion
|
|
3302
3730
|
//#region src/PathFinder.ts
|
|
3303
|
-
function
|
|
3731
|
+
function Ni(e, t) {
|
|
3304
3732
|
e.push(t);
|
|
3305
3733
|
let n = e.length - 1;
|
|
3306
3734
|
for (; n > 0;) {
|
|
@@ -3309,7 +3737,7 @@ function qr(e, t) {
|
|
|
3309
3737
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
3310
3738
|
}
|
|
3311
3739
|
}
|
|
3312
|
-
function
|
|
3740
|
+
function Pi(e) {
|
|
3313
3741
|
if (e.length === 0) return;
|
|
3314
3742
|
let t = e[0], n = e.pop();
|
|
3315
3743
|
if (e.length > 0) {
|
|
@@ -3323,16 +3751,16 @@ function Jr(e) {
|
|
|
3323
3751
|
}
|
|
3324
3752
|
return t;
|
|
3325
3753
|
}
|
|
3326
|
-
function
|
|
3754
|
+
function Fi(e, t, n) {
|
|
3327
3755
|
let r = [n], i = n;
|
|
3328
3756
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
3329
3757
|
return r.reverse(), r;
|
|
3330
3758
|
}
|
|
3331
|
-
function
|
|
3759
|
+
function Ii(e, t, n) {
|
|
3332
3760
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
3333
3761
|
return i ? i.map((e) => Number(e)) : null;
|
|
3334
3762
|
}
|
|
3335
|
-
function
|
|
3763
|
+
function Li(e, t, n, r) {
|
|
3336
3764
|
let i = r.getRoom(n);
|
|
3337
3765
|
if (!i) return null;
|
|
3338
3766
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -3341,16 +3769,16 @@ function Zr(e, t, n, r) {
|
|
|
3341
3769
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
3342
3770
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
3343
3771
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
3344
|
-
for (d.set(t, 0),
|
|
3772
|
+
for (d.set(t, 0), Ni(p, {
|
|
3345
3773
|
id: t,
|
|
3346
3774
|
priority: u(t)
|
|
3347
3775
|
}); p.length > 0;) {
|
|
3348
|
-
let { id: r } =
|
|
3349
|
-
if (r === n) return
|
|
3776
|
+
let { id: r } = Pi(p);
|
|
3777
|
+
if (r === n) return Fi(f, t, n);
|
|
3350
3778
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
3351
3779
|
if (a) for (let e of a) {
|
|
3352
3780
|
let t = i + e.weight;
|
|
3353
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
3781
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Ni(p, {
|
|
3354
3782
|
id: e.id,
|
|
3355
3783
|
priority: t + u(e.id)
|
|
3356
3784
|
}));
|
|
@@ -3358,9 +3786,9 @@ function Zr(e, t, n, r) {
|
|
|
3358
3786
|
}
|
|
3359
3787
|
return null;
|
|
3360
3788
|
}
|
|
3361
|
-
var
|
|
3789
|
+
var Ri = class {
|
|
3362
3790
|
constructor(e, t = "dijkstra") {
|
|
3363
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
3791
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Mi(e), this.dijkstraGraph = new ki.default(this.mapGraph.getGraphDefinition());
|
|
3364
3792
|
}
|
|
3365
3793
|
get algorithm() {
|
|
3366
3794
|
return this._algorithm;
|
|
@@ -3379,10 +3807,10 @@ var Qr = class {
|
|
|
3379
3807
|
let r;
|
|
3380
3808
|
switch (this._algorithm) {
|
|
3381
3809
|
case "dijkstra":
|
|
3382
|
-
r =
|
|
3810
|
+
r = Ii(this.dijkstraGraph, e, t);
|
|
3383
3811
|
break;
|
|
3384
3812
|
case "astar":
|
|
3385
|
-
r =
|
|
3813
|
+
r = Li(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
3386
3814
|
break;
|
|
3387
3815
|
}
|
|
3388
3816
|
return this.cache.set(n, r), r;
|
|
@@ -3392,10 +3820,10 @@ var Qr = class {
|
|
|
3392
3820
|
stub: 1,
|
|
3393
3821
|
full: 0
|
|
3394
3822
|
};
|
|
3395
|
-
function
|
|
3823
|
+
function zi(e, t, n) {
|
|
3396
3824
|
return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
|
|
3397
3825
|
}
|
|
3398
|
-
function
|
|
3826
|
+
function Bi(e, ...t) {
|
|
3399
3827
|
let n = {}, r;
|
|
3400
3828
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
3401
3829
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -3411,7 +3839,7 @@ function ei(e, ...t) {
|
|
|
3411
3839
|
for (let s of r) {
|
|
3412
3840
|
let r = s.getExitTreatment ? s.getExitTreatment(e, t, n) : o(s, e, t, n);
|
|
3413
3841
|
if (a === void 0) a = r;
|
|
3414
|
-
else if (a =
|
|
3842
|
+
else if (a = zi(a, r, i), i === "first") break;
|
|
3415
3843
|
}
|
|
3416
3844
|
return a ?? "full";
|
|
3417
3845
|
},
|
|
@@ -3424,7 +3852,7 @@ function ei(e, ...t) {
|
|
|
3424
3852
|
}
|
|
3425
3853
|
//#endregion
|
|
3426
3854
|
//#region src/lens/ExplorationLens.ts
|
|
3427
|
-
var
|
|
3855
|
+
var Vi = class {
|
|
3428
3856
|
constructor(e) {
|
|
3429
3857
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
3430
3858
|
}
|
|
@@ -3459,7 +3887,7 @@ var ti = class {
|
|
|
3459
3887
|
clear() {
|
|
3460
3888
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
3461
3889
|
}
|
|
3462
|
-
},
|
|
3890
|
+
}, Hi = {
|
|
3463
3891
|
1: "north",
|
|
3464
3892
|
2: "northeast",
|
|
3465
3893
|
3: "northwest",
|
|
@@ -3473,7 +3901,7 @@ var ti = class {
|
|
|
3473
3901
|
11: "in",
|
|
3474
3902
|
12: "out"
|
|
3475
3903
|
};
|
|
3476
|
-
function
|
|
3904
|
+
function Ui() {
|
|
3477
3905
|
return {
|
|
3478
3906
|
areaWidth: 150,
|
|
3479
3907
|
areaHeight: 80,
|
|
@@ -3487,14 +3915,14 @@ function ri() {
|
|
|
3487
3915
|
highlightColor: "#ff9900"
|
|
3488
3916
|
};
|
|
3489
3917
|
}
|
|
3490
|
-
var
|
|
3918
|
+
var Wi = class {
|
|
3491
3919
|
constructor(e, t, n) {
|
|
3492
|
-
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ??
|
|
3920
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? Ui(), this.stage = new D.Stage({
|
|
3493
3921
|
container: e,
|
|
3494
3922
|
width: e.clientWidth,
|
|
3495
3923
|
height: e.clientHeight,
|
|
3496
3924
|
draggable: !0
|
|
3497
|
-
}), this.backgroundLayer = new
|
|
3925
|
+
}), this.backgroundLayer = new D.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new D.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new D.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
|
|
3498
3926
|
}
|
|
3499
3927
|
initResize(e) {
|
|
3500
3928
|
new ResizeObserver(() => {
|
|
@@ -3586,7 +4014,7 @@ var ii = class {
|
|
|
3586
4014
|
if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
|
|
3587
4015
|
let e = new Image();
|
|
3588
4016
|
e.crossOrigin = "anonymous", e.onload = () => {
|
|
3589
|
-
this.backgroundImage = new
|
|
4017
|
+
this.backgroundImage = new D.Image({
|
|
3590
4018
|
x: this.backgroundConfig.x,
|
|
3591
4019
|
y: this.backgroundConfig.y,
|
|
3592
4020
|
image: e,
|
|
@@ -3679,7 +4107,7 @@ var ii = class {
|
|
|
3679
4107
|
}
|
|
3680
4108
|
}
|
|
3681
4109
|
getLockedDirections(e) {
|
|
3682
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
4110
|
+
return new Set((e.exitLocks ?? []).map((e) => Hi[e]).filter((e) => !!e));
|
|
3683
4111
|
}
|
|
3684
4112
|
createConnection(e, t, n) {
|
|
3685
4113
|
let r = this.toPlanarDirection(n);
|
|
@@ -4141,7 +4569,7 @@ var ii = class {
|
|
|
4141
4569
|
y: n.y + n.height / 2
|
|
4142
4570
|
}, a, o;
|
|
4143
4571
|
if (this.dotsMode ? (a = r, o = i) : (a = this.getEdgePoint(t, i), o = this.getEdgePoint(n, r)), !isFinite(a.x) || !isFinite(a.y) || !isFinite(o.x) || !isFinite(o.y)) continue;
|
|
4144
|
-
let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new
|
|
4572
|
+
let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new D.Line({
|
|
4145
4573
|
points: [
|
|
4146
4574
|
a.x,
|
|
4147
4575
|
a.y,
|
|
@@ -4174,16 +4602,16 @@ var ii = class {
|
|
|
4174
4602
|
if (!isFinite(e.x) || !isFinite(e.y)) continue;
|
|
4175
4603
|
let t = e.areaId === this.highlightedArea;
|
|
4176
4604
|
if (this.dotsMode) {
|
|
4177
|
-
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new
|
|
4605
|
+
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new D.Group({
|
|
4178
4606
|
x: n,
|
|
4179
4607
|
y: r,
|
|
4180
4608
|
draggable: !0
|
|
4181
|
-
}), a = new
|
|
4609
|
+
}), a = new D.Circle({
|
|
4182
4610
|
radius: 6,
|
|
4183
4611
|
fill: t ? this.settings.highlightColor : "#ffffff",
|
|
4184
4612
|
stroke: t ? this.settings.highlightColor : "#ffffff",
|
|
4185
4613
|
strokeWidth: 1
|
|
4186
|
-
}), o = new
|
|
4614
|
+
}), o = new D.Text({
|
|
4187
4615
|
text: e.name,
|
|
4188
4616
|
fontSize: 10,
|
|
4189
4617
|
fill: "#ffffff",
|
|
@@ -4204,18 +4632,18 @@ var ii = class {
|
|
|
4204
4632
|
this.stage.container().style.cursor = "pointer";
|
|
4205
4633
|
}), this.areaLayer.add(i);
|
|
4206
4634
|
} else {
|
|
4207
|
-
let n = new
|
|
4635
|
+
let n = new D.Group({
|
|
4208
4636
|
x: e.x,
|
|
4209
4637
|
y: e.y,
|
|
4210
4638
|
draggable: !0
|
|
4211
|
-
}), r = new
|
|
4639
|
+
}), r = new D.Rect({
|
|
4212
4640
|
width: e.width,
|
|
4213
4641
|
height: e.height,
|
|
4214
4642
|
fill: this.settings.areaFillColor,
|
|
4215
4643
|
stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
|
|
4216
4644
|
strokeWidth: t ? 3 : 2,
|
|
4217
4645
|
cornerRadius: 8
|
|
4218
|
-
}), i = new
|
|
4646
|
+
}), i = new D.Text({
|
|
4219
4647
|
text: e.name,
|
|
4220
4648
|
fontSize: this.settings.fontSize,
|
|
4221
4649
|
fill: this.settings.textColor,
|
|
@@ -4227,7 +4655,7 @@ var ii = class {
|
|
|
4227
4655
|
verticalAlign: "middle",
|
|
4228
4656
|
ellipsis: !0,
|
|
4229
4657
|
wrap: "word"
|
|
4230
|
-
}), a = new
|
|
4658
|
+
}), a = new D.Text({
|
|
4231
4659
|
text: `${e.roomCount} rooms`,
|
|
4232
4660
|
fontSize: 10,
|
|
4233
4661
|
fill: this.settings.connectionColor,
|
|
@@ -4291,6 +4719,6 @@ var ii = class {
|
|
|
4291
4719
|
}
|
|
4292
4720
|
};
|
|
4293
4721
|
//#endregion
|
|
4294
|
-
export { n as ALL_VISIBLE,
|
|
4722
|
+
export { n as ALL_VISIBLE, di as AmbientLightOverlay, ae as Area, Wi as AreaMapRenderer, yr as Blueprint, r as Camera, ii as CanvasExporter, Cr as Construction, E as CullingManager, Ar as DarkModern, Oe as DrawCommandLayerNode, Vi as ExplorationLens, Tr as GradientRooms, Dr as GraphPaper, ee as HitTester, c as IDENTITY_TRANSFORM, Sr as Isometric, Mi as MapGraph, se as MapReader, Mr as MapRenderer, be as MapState, ke as MaterializingLayerNode, br as Neon, vr as Parchment, Ri as PathFinder, oe as Plane, ni as PngBlobExporter, ai as PngBytesExporter, ti as PngExporter, De as RecordingGroupNode, j as RecordingLayerNode, hi as RippleEffect, wr as SciFi, xr as Sketchy, Er as StainedGlass, ei as SvgExporter, Or as Topographic, jr as TreasureMap, kr as Watercolor, C as applyStyleToShapes, Pr as buildDrawCommands, ri as canvasToBytes, e as colorLightness, _ as compose, Bi as composeLenses, te as computePathData, Ui as createAreaMapSettings, ye as createSettings, v as darkenColor, o as defaultExitTreatment, i as hexToRgba, u as identityStyle, Ae as isGradientFill, wi as placeLabels, Jr as renderToCanvas, Me as shapeToRecording, Wr as svgFromBatches, M as transformFill, _r as treasureMapDecorations };
|
|
4295
4723
|
|
|
4296
4724
|
//# sourceMappingURL=index.mjs.map
|