mudlet-map-renderer 2.2.0 → 2.3.1
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 +7 -1
- package/dist/index.mjs +1033 -457
- package/dist/index.mjs.map +1 -1
- package/dist/labelPlacement.d.ts +132 -0
- package/dist/overlay/RippleEffect.d.ts +48 -0
- package/dist/overlay/WaypointOverlay.d.ts +70 -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 C, p as ee, r as w, s 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 C, p as ee, r as w, s as te, 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 we(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 Te = {
|
|
282
282
|
grid: [],
|
|
283
283
|
link: [],
|
|
284
284
|
room: [],
|
|
285
285
|
topLabel: []
|
|
286
|
-
},
|
|
286
|
+
}, Ee = 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: Te,
|
|
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 = we(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 k(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 De(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 = k(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 = k(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 = k(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 Oe = 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) De(n, e);
|
|
462
462
|
}
|
|
463
463
|
})), this._konvaGroup = e, e;
|
|
464
464
|
}
|
|
465
|
-
},
|
|
465
|
+
}, A = 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) De(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) De(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 Oe(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 C(), 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
|
|
692
|
+
this.gridCachedBounds = null, this.currentStyle = u, this.hitTester = new C(), 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 A(n), this.gridLayerNode = new j(this.gridLayer), this.topLabelLayerNode = new j(this.topLabelLayer), this.sceneManager = new Ee(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 A(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;
|
|
@@ -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(te(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(te(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,7 +1183,7 @@ function ft(e, t, n) {
|
|
|
1183
1183
|
a
|
|
1184
1184
|
];
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function R(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);
|
|
@@ -1191,12 +1191,12 @@ function pt(e, t, n, r = 1) {
|
|
|
1191
1191
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
1192
1192
|
}
|
|
1193
1193
|
function mt(e) {
|
|
1194
|
-
let t =
|
|
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
|
|
@@ -1204,34 +1204,34 @@ function mt(e) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
function ht(e) {
|
|
1206
1206
|
let { h: t, a: n } = mt(e);
|
|
1207
|
-
return
|
|
1207
|
+
return R(t, .95, .65, n);
|
|
1208
1208
|
}
|
|
1209
1209
|
function gt(e) {
|
|
1210
|
-
let t =
|
|
1210
|
+
let t = F(e);
|
|
1211
1211
|
if (!t) return "rgb(8, 12, 10)";
|
|
1212
|
-
let [n] =
|
|
1213
|
-
return
|
|
1212
|
+
let [n] = pt(t.r, t.g, t.b);
|
|
1213
|
+
return R(n, .4, .1, t.a);
|
|
1214
1214
|
}
|
|
1215
1215
|
function _t(e) {
|
|
1216
1216
|
let { h: t, a: n } = mt(e);
|
|
1217
|
-
return
|
|
1217
|
+
return R(t, .95, .65, Math.min(n, dt));
|
|
1218
1218
|
}
|
|
1219
1219
|
function vt(e) {
|
|
1220
1220
|
return {
|
|
1221
1221
|
...e,
|
|
1222
|
-
fill:
|
|
1222
|
+
fill: P(e.fill, gt),
|
|
1223
1223
|
stroke: e.stroke ? ht(e.stroke) : e.stroke
|
|
1224
1224
|
};
|
|
1225
1225
|
}
|
|
1226
1226
|
function yt(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
1230
|
stroke: _t(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
1237
|
var bt = { transform(e) {
|
|
@@ -1281,7 +1281,7 @@ var bt = { transform(e) {
|
|
|
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;
|
|
@@ -1298,7 +1298,7 @@ function B(...e) {
|
|
|
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 xt(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 St(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 = xt(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 V(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 = xt(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 Ct(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,26 +1348,26 @@ 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 = xt(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) {
|
|
@@ -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: V(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: V(e.x, e.y, e.width, e.height, t, r),
|
|
1404
1404
|
paint: {
|
|
1405
1405
|
fill: i,
|
|
1406
1406
|
stroke: a,
|
|
@@ -1415,7 +1415,7 @@ function Ct(e) {
|
|
|
1415
1415
|
let r = z(B(e.cx, e.cy, e.radius));
|
|
1416
1416
|
return {
|
|
1417
1417
|
type: "polygon",
|
|
1418
|
-
vertices:
|
|
1418
|
+
vertices: Ct(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(B(...e.points.slice(0, 4))), i =
|
|
1430
|
+
let r = z(B(...e.points.slice(0, 4))), i = St(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(B(...e.vertices.slice(0, 4))), i =
|
|
1441
|
+
let r = z(B(...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, q = 190;
|
|
1906
|
+
function Yt(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
|
+
q,
|
|
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 Xt(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 Xt(e) {
|
|
1929
|
-
let t = I(e);
|
|
1930
|
-
if (!t) return Yt(qt, .55, .18);
|
|
1931
|
-
let [n, r] = Jt(t.r, t.g, t.b);
|
|
1932
|
-
return Yt(r < .08 ? qt : n, .55, .18, t.a);
|
|
1933
|
-
}
|
|
1934
1928
|
function Zt(e) {
|
|
1929
|
+
let t = F(e);
|
|
1930
|
+
if (!t) return Xt(q, .55, .18);
|
|
1931
|
+
let [n, r] = Yt(t.r, t.g, t.b);
|
|
1932
|
+
return Xt(r < .08 ? q : n, .55, .18, t.a);
|
|
1933
|
+
}
|
|
1934
|
+
function Qt(e) {
|
|
1935
1935
|
return {
|
|
1936
1936
|
...e,
|
|
1937
|
-
fill:
|
|
1938
|
-
stroke: e.stroke ?
|
|
1937
|
+
fill: P(e.fill, Zt),
|
|
1938
|
+
stroke: e.stroke ? Gt : e.stroke
|
|
1939
1939
|
};
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function $t(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 en(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 tn = { transform(e) {
|
|
1958
1958
|
switch (e.type) {
|
|
1959
1959
|
case "rect": {
|
|
1960
1960
|
let t = {
|
|
1961
1961
|
...e,
|
|
1962
|
-
paint:
|
|
1962
|
+
paint: Qt(e.paint)
|
|
1963
1963
|
};
|
|
1964
1964
|
return e.paint.stroke ? [{
|
|
1965
1965
|
...e,
|
|
1966
1966
|
hit: void 0,
|
|
1967
1967
|
paint: {
|
|
1968
|
-
|
|
1968
|
+
...$t(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: Qt(e.paint)
|
|
1977
1977
|
};
|
|
1978
1978
|
return e.paint.stroke ? [{
|
|
1979
1979
|
...e,
|
|
1980
1980
|
hit: void 0,
|
|
1981
1981
|
paint: {
|
|
1982
|
-
|
|
1982
|
+
...$t(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: en(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
|
+
} }, nn = {
|
|
2024
2024
|
lighten: .35,
|
|
2025
2025
|
darken: .25
|
|
2026
2026
|
};
|
|
2027
|
-
function
|
|
2028
|
-
let t = e.lighten ??
|
|
2027
|
+
function rn(e = {}) {
|
|
2028
|
+
let t = e.lighten ?? nn.lighten, n = e.darken ?? nn.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 dn(e) {
|
|
2081
|
-
let t = I(e);
|
|
2082
|
-
if (!t) return e;
|
|
2083
|
-
let [n, r, i] = Le(t.r, t.g, t.b);
|
|
2084
|
-
return Re(n, r < .08 ? r : Math.max(r, on), Math.min(cn, Math.max(sn, i)), t.a);
|
|
2085
|
-
}
|
|
2079
|
+
var an = "#0a0a0a", on = "#f4f0e0", sn = .6, cn = .4, ln = .62, un = 2.2, dn = .06;
|
|
2086
2080
|
function fn(e) {
|
|
2087
|
-
|
|
2081
|
+
let t = F(e);
|
|
2082
|
+
if (!t) return e;
|
|
2083
|
+
let [n, r, i] = Re(t.r, t.g, t.b);
|
|
2084
|
+
return ze(n, r < .08 ? r : Math.max(r, sn), Math.min(ln, Math.max(cn, i)), t.a);
|
|
2088
2085
|
}
|
|
2089
2086
|
function pn(e) {
|
|
2090
|
-
|
|
2087
|
+
return Math.max((e ?? .04) * un, dn);
|
|
2088
|
+
}
|
|
2089
|
+
function mn(e) {
|
|
2090
|
+
let t = P(e.fill, fn), 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 ? an : void 0,
|
|
2095
|
+
strokeWidth: n ? pn(e.strokeWidth) : e.strokeWidth,
|
|
2096
2096
|
dash: void 0,
|
|
2097
2097
|
dashEnabled: void 0
|
|
2098
2098
|
};
|
|
2099
2099
|
}
|
|
2100
|
-
var
|
|
2100
|
+
var hn = { 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: mn(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: an,
|
|
2113
|
+
strokeWidth: pn(e.paint.strokeWidth)
|
|
2114
2114
|
} : e.paint
|
|
2115
2115
|
};
|
|
2116
2116
|
case "text": return {
|
|
2117
2117
|
...e,
|
|
2118
|
-
fill:
|
|
2118
|
+
fill: on
|
|
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
|
-
}
|
|
2123
|
+
} }, gn = "#1c3f6e", _n = 1.4, vn = .05, yn = 198, bn = 212, xn = 230, Sn = 248, Cn = 250, wn = 255;
|
|
2130
2124
|
function Tn(e) {
|
|
2131
|
-
let t =
|
|
2132
|
-
if (!t
|
|
2133
|
-
let n =
|
|
2134
|
-
return
|
|
2125
|
+
let t = F(e);
|
|
2126
|
+
if (!t) return I(Sn, Cn, wn);
|
|
2127
|
+
let n = L(t);
|
|
2128
|
+
return I(Math.round(yn + (Sn - yn) * n), Math.round(bn + (Cn - bn) * n), Math.round(xn + (wn - xn) * n), t.a);
|
|
2135
2129
|
}
|
|
2136
2130
|
function En(e) {
|
|
2137
|
-
|
|
2131
|
+
let t = F(e);
|
|
2132
|
+
if (!t || t.a >= 1) return gn;
|
|
2133
|
+
let n = F(gn);
|
|
2134
|
+
return I(n.r, n.g, n.b, t.a);
|
|
2138
2135
|
}
|
|
2139
2136
|
function Dn(e) {
|
|
2137
|
+
return Math.max((e ?? .04) * _n, vn);
|
|
2138
|
+
}
|
|
2139
|
+
function On(e) {
|
|
2140
2140
|
return {
|
|
2141
2141
|
...e,
|
|
2142
|
-
fill:
|
|
2143
|
-
stroke: e.stroke ?
|
|
2144
|
-
strokeWidth: e.stroke ?
|
|
2142
|
+
fill: P(e.fill, Tn),
|
|
2143
|
+
stroke: e.stroke ? En(e.stroke) : e.stroke,
|
|
2144
|
+
strokeWidth: e.stroke ? Dn(e.strokeWidth) : e.strokeWidth
|
|
2145
2145
|
};
|
|
2146
2146
|
}
|
|
2147
|
-
var
|
|
2147
|
+
var kn = { 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: On(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: En(e.paint.stroke),
|
|
2160
|
+
strokeWidth: e.grid ? e.paint.strokeWidth : Dn(e.paint.strokeWidth)
|
|
2161
2161
|
}
|
|
2162
2162
|
} : e;
|
|
2163
2163
|
case "text": return {
|
|
2164
2164
|
...e,
|
|
2165
|
-
fill:
|
|
2165
|
+
fill: gn
|
|
2166
2166
|
};
|
|
2167
2167
|
case "image":
|
|
2168
2168
|
case "group": return e;
|
|
2169
2169
|
}
|
|
2170
|
-
} },
|
|
2171
|
-
function Vn(e) {
|
|
2172
|
-
let t = I(e);
|
|
2173
|
-
if (!t) return L(Fn, In, Ln);
|
|
2174
|
-
let n = R(t);
|
|
2175
|
-
return L(Math.round(Mn + (Fn - Mn) * n), Math.round(Nn + (In - Nn) * n), Math.round(Pn + (Ln - Pn) * n), t.a);
|
|
2176
|
-
}
|
|
2170
|
+
} }, An = "#7a6a48", jn = "#8a7a55", Mn = "#4a3f28", Nn = 78, Pn = 93, Fn = 52, In = 221, Ln = 207, Rn = 166, zn = 2, Bn = .26, Vn = .02;
|
|
2177
2171
|
function Hn(e) {
|
|
2172
|
+
let t = F(e);
|
|
2173
|
+
if (!t) return I(In, Ln, Rn);
|
|
2174
|
+
let n = L(t);
|
|
2175
|
+
return I(Math.round(Nn + (In - Nn) * n), Math.round(Pn + (Ln - Pn) * n), Math.round(Fn + (Rn - Fn) * n), t.a);
|
|
2176
|
+
}
|
|
2177
|
+
function Un(e) {
|
|
2178
2178
|
return {
|
|
2179
2179
|
...e,
|
|
2180
|
-
fill:
|
|
2181
|
-
stroke: e.stroke ?
|
|
2180
|
+
fill: P(e.fill, Hn),
|
|
2181
|
+
stroke: e.stroke ? An : e.stroke
|
|
2182
2182
|
};
|
|
2183
2183
|
}
|
|
2184
|
-
var
|
|
2185
|
-
stroke:
|
|
2186
|
-
strokeWidth:
|
|
2187
|
-
},
|
|
2184
|
+
var Wn = {
|
|
2185
|
+
stroke: An,
|
|
2186
|
+
strokeWidth: Vn
|
|
2187
|
+
}, Gn = { transform(e) {
|
|
2188
2188
|
switch (e.type) {
|
|
2189
2189
|
case "rect": {
|
|
2190
2190
|
let t = {
|
|
2191
2191
|
...e,
|
|
2192
|
-
paint:
|
|
2192
|
+
paint: Un(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 * Bn, i = Math.min(e.width, e.height) * .12;
|
|
2196
|
+
for (let t = 1; t <= zn; 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: Wn,
|
|
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: Un(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 * Bn;
|
|
2220
|
+
for (let t = 1; t <= zn; 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: Wn,
|
|
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: Un(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 <= zn; t++) {
|
|
2245
|
+
let o = 1 - Bn * 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: Wn,
|
|
2253
2253
|
layer: e.layer,
|
|
2254
2254
|
noScale: e.noScale
|
|
2255
2255
|
});
|
|
@@ -2260,27 +2260,27 @@ var Un = {
|
|
|
2260
2260
|
...e,
|
|
2261
2261
|
paint: {
|
|
2262
2262
|
...e.paint,
|
|
2263
|
-
stroke:
|
|
2263
|
+
stroke: jn
|
|
2264
2264
|
}
|
|
2265
2265
|
} : e;
|
|
2266
2266
|
case "text": return {
|
|
2267
2267
|
...e,
|
|
2268
|
-
fill:
|
|
2268
|
+
fill: Mn
|
|
2269
2269
|
};
|
|
2270
2270
|
case "image":
|
|
2271
2271
|
case "group": return e;
|
|
2272
2272
|
}
|
|
2273
|
-
} },
|
|
2274
|
-
function
|
|
2275
|
-
return
|
|
2276
|
-
let n =
|
|
2273
|
+
} }, Kn = "#3a3a44";
|
|
2274
|
+
function qn(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 Jn(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 = qn(t.fill, r), l = [];
|
|
2284
2284
|
for (let t = 0; t < n; t++) {
|
|
2285
2285
|
let n = z(i + t * 2654435769);
|
|
2286
2286
|
l.push({
|
|
@@ -2304,7 +2304,7 @@ function qn(e = {}) {
|
|
|
2304
2304
|
let n = z(B(e.x, e.y, e.width, e.height));
|
|
2305
2305
|
return {
|
|
2306
2306
|
type: "polygon",
|
|
2307
|
-
vertices:
|
|
2307
|
+
vertices: V(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) => V(e.x, e.y, e.width, e.height, t, n), e.paint, B(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
2321
|
let n = z(B(e.cx, e.cy, e.radius));
|
|
2322
2322
|
return {
|
|
2323
2323
|
type: "polygon",
|
|
2324
|
-
vertices:
|
|
2324
|
+
vertices: Ct(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) => Ct(e.cx, e.cy, e.radius, t, n), e.paint, B(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
|
|
2336
2336
|
case "polygon":
|
|
2337
2337
|
if (!e.paint.fill) {
|
|
2338
2338
|
let n = z(B(...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, B(...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: Kn
|
|
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 Yn = "rgba(255, 255, 255, 0.14)", Xn = "#5b6573", Zn = "#e6e8ec", Qn = "rgba(0, 0, 0, 0.38)", $n = .08, er = .34;
|
|
2368
|
+
function tr(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, er), .22 + i * .18, t.a);
|
|
2373
|
+
}
|
|
2374
|
+
function nr(e) {
|
|
2375
|
+
return {
|
|
2376
|
+
...e,
|
|
2377
|
+
fill: P(e.fill, tr),
|
|
2378
|
+
stroke: e.stroke ? Yn : e.stroke
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
function rr(e) {
|
|
2382
|
+
return e.hit?.kind === "room" && e.paint.fill !== void 0;
|
|
2383
|
+
}
|
|
2384
|
+
var ir = { transform(e, t) {
|
|
2385
|
+
switch (e.type) {
|
|
2386
|
+
case "rect": {
|
|
2387
|
+
let n = {
|
|
2388
|
+
...e,
|
|
2389
|
+
paint: nr(e.paint)
|
|
2390
|
+
};
|
|
2391
|
+
if (!rr(e)) return n;
|
|
2392
|
+
let r = t.roomSize * $n;
|
|
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: Qn },
|
|
2401
|
+
layer: e.layer,
|
|
2402
|
+
noScale: e.noScale
|
|
2403
|
+
}, n];
|
|
2404
|
+
}
|
|
2405
|
+
case "circle": {
|
|
2406
|
+
let n = {
|
|
2407
|
+
...e,
|
|
2408
|
+
paint: nr(e.paint)
|
|
2409
|
+
};
|
|
2410
|
+
if (!rr(e)) return n;
|
|
2411
|
+
let r = t.roomSize * $n;
|
|
2412
|
+
return [{
|
|
2413
|
+
type: "circle",
|
|
2414
|
+
cx: e.cx + r,
|
|
2415
|
+
cy: e.cy + r,
|
|
2416
|
+
radius: e.radius,
|
|
2417
|
+
paint: { fill: Qn },
|
|
2418
|
+
layer: e.layer,
|
|
2419
|
+
noScale: e.noScale
|
|
2420
|
+
}, n];
|
|
2421
|
+
}
|
|
2422
|
+
case "polygon": return {
|
|
2423
|
+
...e,
|
|
2424
|
+
paint: nr(e.paint)
|
|
2425
|
+
};
|
|
2426
|
+
case "line": return {
|
|
2427
|
+
...e,
|
|
2428
|
+
paint: e.paint.stroke ? {
|
|
2429
|
+
...e.paint,
|
|
2430
|
+
stroke: Xn
|
|
2431
|
+
} : e.paint
|
|
2432
|
+
};
|
|
2433
|
+
case "text": return {
|
|
2434
|
+
...e,
|
|
2435
|
+
fill: Zn
|
|
2436
|
+
};
|
|
2437
|
+
case "image":
|
|
2438
|
+
case "group": return e;
|
|
2439
|
+
}
|
|
2440
|
+
} }, J = "#5a3a22", ar = "#43301c", or = 120, sr = 86, cr = 50, lr = 232, ur = 205, dr = 158;
|
|
2441
|
+
function fr(e) {
|
|
2442
|
+
let t = F(e);
|
|
2443
|
+
if (!t) return I(lr, ur, dr);
|
|
2444
|
+
let n = L(t);
|
|
2445
|
+
return I(Math.round(or + (lr - or) * n), Math.round(sr + (ur - sr) * n), Math.round(cr + (dr - cr) * n), t.a);
|
|
2370
2446
|
}
|
|
2371
|
-
function
|
|
2372
|
-
|
|
2447
|
+
function pr(e) {
|
|
2448
|
+
let t = F(e);
|
|
2449
|
+
if (!t || t.a >= 1) return J;
|
|
2450
|
+
let n = F(J);
|
|
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
|
+
};
|
|
2377
2459
|
}
|
|
2378
|
-
var
|
|
2379
|
-
|
|
2380
|
-
|
|
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: ar
|
|
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;
|
|
2490
|
+
}
|
|
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: J,
|
|
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: J,
|
|
2524
|
+
strokeWidth: s
|
|
2525
|
+
},
|
|
2526
|
+
layer: "top"
|
|
2527
|
+
}), c.push({
|
|
2528
|
+
type: "polygon",
|
|
2529
|
+
vertices: gr(u, d, l),
|
|
2530
|
+
paint: {
|
|
2531
|
+
fill: I(lr, ur, dr, .85),
|
|
2532
|
+
stroke: J,
|
|
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: J },
|
|
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: ar,
|
|
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 = bt;
|
|
2561
|
+
function xr(e) {
|
|
2562
|
+
return Tt(e);
|
|
2563
|
+
}
|
|
2564
|
+
function Sr(e = {}) {
|
|
2565
|
+
return At(e);
|
|
2566
|
+
}
|
|
2567
|
+
var Cr = Ut, wr = tn;
|
|
2568
|
+
function Tr(e = {}) {
|
|
2569
|
+
return rn(e);
|
|
2570
|
+
}
|
|
2571
|
+
var Er = hn, Dr = kn, Or = Gn;
|
|
2572
|
+
function kr(e = {}) {
|
|
2573
|
+
return Jn(e);
|
|
2574
|
+
}
|
|
2575
|
+
var Ar = ir, 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 = k(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 = k(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 = k(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 = we(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 : w(e, t, h), v =
|
|
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 : w(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 * _, C = {
|
|
3003
3194
|
scale: _,
|
|
3004
3195
|
offsetX: b,
|
|
3005
3196
|
offsetY: x
|
|
3006
|
-
}, ee = r.forRenderCamera(d, f, _, b, x),
|
|
3197
|
+
}, ee = r.forRenderCamera(d, f, _, b, x), te = {
|
|
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 = we(new g(e.mapReader, l).buildScene(s, c, a, e.lens), ee.getViewportBounds(), l, te), 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 : w(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), C));
|
|
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,392 @@ 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 src/overlay/WaypointOverlay.ts
|
|
3528
|
+
var Ti = class {
|
|
3529
|
+
constructor() {
|
|
3530
|
+
this.waypoints = [], this.placed = [];
|
|
3531
|
+
}
|
|
3532
|
+
set(e) {
|
|
3533
|
+
this.waypoints = [...e], this.ctx?.invalidate();
|
|
3534
|
+
}
|
|
3535
|
+
add(e) {
|
|
3536
|
+
this.waypoints.push(e), this.ctx?.invalidate();
|
|
3537
|
+
}
|
|
3538
|
+
remove(e) {
|
|
3539
|
+
let t = this.waypoints.length;
|
|
3540
|
+
this.waypoints = this.waypoints.filter((t) => t.roomId !== e), this.waypoints.length !== t && this.ctx?.invalidate();
|
|
3541
|
+
}
|
|
3542
|
+
has(e) {
|
|
3543
|
+
return this.waypoints.some((t) => t.roomId === e);
|
|
3544
|
+
}
|
|
3545
|
+
hitTest(e, t) {
|
|
3546
|
+
for (let n = this.placed.length - 1; n >= 0; n--) {
|
|
3547
|
+
let r = this.placed[n];
|
|
3548
|
+
if (e >= r.x && e <= r.x + r.width && t >= r.y && t <= r.y + r.height) return r.wp;
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
attach(e) {
|
|
3552
|
+
this.ctx = e;
|
|
3553
|
+
}
|
|
3554
|
+
detach() {
|
|
3555
|
+
this.ctx = void 0, this.placed = [];
|
|
3556
|
+
}
|
|
3557
|
+
render(e, t) {
|
|
3558
|
+
this.placed = [];
|
|
3559
|
+
let n = e.currentArea, r = e.currentZIndex;
|
|
3560
|
+
if (n === void 0 || r === void 0 || this.waypoints.length === 0) return [];
|
|
3561
|
+
let i = e.currentAreaInstance?.getPlane(r);
|
|
3562
|
+
if (!i) return [];
|
|
3563
|
+
let a = e.settings.roomSize, o = a * .6, s = o * .5, c = o * 1.2, l = i.getRooms(), u = l.map((e) => ({
|
|
3564
|
+
x: e.x - a / 2,
|
|
3565
|
+
y: e.y - a / 2,
|
|
3566
|
+
width: a,
|
|
3567
|
+
height: a,
|
|
3568
|
+
kind: "room"
|
|
3569
|
+
})), d = (e, t, n, r) => u.push({
|
|
3570
|
+
x: Math.min(e, n) - .03,
|
|
3571
|
+
y: Math.min(t, r) - .03,
|
|
3572
|
+
width: Math.abs(n - e) + .06,
|
|
3573
|
+
height: Math.abs(r - t) + .06,
|
|
3574
|
+
kind: "exit"
|
|
3575
|
+
});
|
|
3576
|
+
for (let t of l) for (let i of [...Object.values(t.exits), ...Object.values(t.specialExits)]) {
|
|
3577
|
+
let a = e.mapReader.getRoom(i);
|
|
3578
|
+
a && a.area === n && a.z === r && d(t.x, t.y, a.x, a.y);
|
|
3579
|
+
}
|
|
3580
|
+
let f = [], p = [];
|
|
3581
|
+
for (let t of this.waypoints) {
|
|
3582
|
+
let i = e.mapReader.getRoom(t.roomId);
|
|
3583
|
+
if (!i || i.area !== n || i.z !== r) continue;
|
|
3584
|
+
let a = Array.isArray(t.label) ? t.label : [t.label], l = a.reduce((e, t) => Math.max(e, t.length), 0) * o * .6 + s * 2, u = a.length * c + o * .4;
|
|
3585
|
+
f.push({
|
|
3586
|
+
x: i.x,
|
|
3587
|
+
y: i.y,
|
|
3588
|
+
width: l,
|
|
3589
|
+
height: u,
|
|
3590
|
+
id: f.length,
|
|
3591
|
+
preferred: t.preferred
|
|
3592
|
+
}), p.push({
|
|
3593
|
+
wp: t,
|
|
3594
|
+
rx: i.x,
|
|
3595
|
+
ry: i.y,
|
|
3596
|
+
lines: a
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
if (f.length === 0) return [];
|
|
3600
|
+
let m = "rgba(20, 20, 24, 0.82)", h = wi(f, u, {
|
|
3601
|
+
offset: a * .7,
|
|
3602
|
+
extend: a * 4,
|
|
3603
|
+
clearCap: a * 1.5,
|
|
3604
|
+
minClearance: a * .7
|
|
3605
|
+
}), g = [];
|
|
3606
|
+
for (let t = 0; t < h.length; t++) {
|
|
3607
|
+
let n = h[t], { wp: r, rx: i, ry: s } = p[t], l = r.color ?? "#ffcc33", u = i - (n.x + n.width / 2), d = s - (n.y + n.height / 2), f = Math.hypot(u, d) || 1, _ = u / f, v = d / f, y = o * .7, b = o * .5, x = n.direction.length === 2, S;
|
|
3608
|
+
if (x) {
|
|
3609
|
+
let e = _ < 0 ? n.x : n.x + n.width, t = v < 0 ? n.y : n.y + n.height, r = o * .85;
|
|
3610
|
+
S = [
|
|
3611
|
+
e + (_ < 0 ? r : -r),
|
|
3612
|
+
t,
|
|
3613
|
+
e + _ * y,
|
|
3614
|
+
t + v * y,
|
|
3615
|
+
e,
|
|
3616
|
+
t + (v < 0 ? r : -r)
|
|
3617
|
+
];
|
|
3618
|
+
} else {
|
|
3619
|
+
let e = Math.abs(u), t = Math.abs(d), r = (e > 1e-6 ? n.width / 2 / e : Infinity) <= (t > 1e-6 ? n.height / 2 / t : Infinity), i = r ? _ < 0 ? n.x : n.x + n.width : n.x + n.width / 2, a = r ? n.y + n.height / 2 : v < 0 ? n.y : n.y + n.height, o = +!r, s = +!!r;
|
|
3620
|
+
S = [
|
|
3621
|
+
i + o * b,
|
|
3622
|
+
a + s * b,
|
|
3623
|
+
i + _ * y,
|
|
3624
|
+
a + v * y,
|
|
3625
|
+
i - o * b,
|
|
3626
|
+
a - s * b
|
|
3627
|
+
];
|
|
3628
|
+
}
|
|
3629
|
+
g.push({
|
|
3630
|
+
type: "polygon",
|
|
3631
|
+
vertices: S,
|
|
3632
|
+
paint: {
|
|
3633
|
+
fill: m,
|
|
3634
|
+
stroke: l,
|
|
3635
|
+
strokeWidth: a * .03
|
|
3636
|
+
},
|
|
3637
|
+
layer: "top"
|
|
3638
|
+
}), g.push({
|
|
3639
|
+
type: "rect",
|
|
3640
|
+
x: n.x,
|
|
3641
|
+
y: n.y,
|
|
3642
|
+
width: n.width,
|
|
3643
|
+
height: n.height,
|
|
3644
|
+
cornerRadius: o * .3,
|
|
3645
|
+
paint: {
|
|
3646
|
+
fill: m,
|
|
3647
|
+
stroke: l,
|
|
3648
|
+
strokeWidth: a * .03
|
|
3649
|
+
},
|
|
3650
|
+
layer: "top"
|
|
3651
|
+
}), this.placed.push({
|
|
3652
|
+
wp: r,
|
|
3653
|
+
x: n.x,
|
|
3654
|
+
y: n.y,
|
|
3655
|
+
width: n.width,
|
|
3656
|
+
height: n.height
|
|
3657
|
+
});
|
|
3658
|
+
let C = p[t].lines, ee = (n.height - C.length * c) / 2;
|
|
3659
|
+
for (let t = 0; t < C.length; t++) g.push({
|
|
3660
|
+
type: "text",
|
|
3661
|
+
x: n.x,
|
|
3662
|
+
y: n.y + ee + t * c,
|
|
3663
|
+
width: n.width,
|
|
3664
|
+
height: c,
|
|
3665
|
+
text: C[t],
|
|
3666
|
+
fontSize: o,
|
|
3667
|
+
fontFamily: e.settings.fontFamily,
|
|
3668
|
+
fill: "#f4f4f6",
|
|
3669
|
+
align: "center",
|
|
3670
|
+
verticalAlign: "middle",
|
|
3671
|
+
layer: "top"
|
|
3672
|
+
});
|
|
3673
|
+
}
|
|
3674
|
+
return g;
|
|
3675
|
+
}
|
|
3676
|
+
}, Ei = /* @__PURE__ */ O(((e, t) => {
|
|
3101
3677
|
t.exports = class {
|
|
3102
3678
|
constructor() {
|
|
3103
3679
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -3127,14 +3703,14 @@ var Lr = {
|
|
|
3127
3703
|
return this.queue.find((t) => t.key === e);
|
|
3128
3704
|
}
|
|
3129
3705
|
};
|
|
3130
|
-
})),
|
|
3706
|
+
})), Di = /* @__PURE__ */ O(((e, t) => {
|
|
3131
3707
|
function n(e, t) {
|
|
3132
3708
|
let r = /* @__PURE__ */ new Map();
|
|
3133
3709
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
3134
3710
|
return r;
|
|
3135
3711
|
}
|
|
3136
3712
|
t.exports = n;
|
|
3137
|
-
})),
|
|
3713
|
+
})), Oi = /* @__PURE__ */ O(((e, t) => {
|
|
3138
3714
|
function n(e) {
|
|
3139
3715
|
let t = Number(e);
|
|
3140
3716
|
return !(isNaN(t) || t <= 0);
|
|
@@ -3149,7 +3725,7 @@ var Lr = {
|
|
|
3149
3725
|
}), t;
|
|
3150
3726
|
}
|
|
3151
3727
|
t.exports = r;
|
|
3152
|
-
})),
|
|
3728
|
+
})), ki = /* @__PURE__ */ O(((e, t) => {
|
|
3153
3729
|
function n(e) {
|
|
3154
3730
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
3155
3731
|
e.forEach((e, t) => {
|
|
@@ -3161,8 +3737,8 @@ var Lr = {
|
|
|
3161
3737
|
});
|
|
3162
3738
|
}
|
|
3163
3739
|
t.exports = n;
|
|
3164
|
-
})),
|
|
3165
|
-
var n =
|
|
3740
|
+
})), Ai = /* @__PURE__ */ he((/* @__PURE__ */ O(((e, t) => {
|
|
3741
|
+
var n = Ei(), r = Di(), i = Oi(), a = ki();
|
|
3166
3742
|
t.exports = class {
|
|
3167
3743
|
constructor(e) {
|
|
3168
3744
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -3212,7 +3788,7 @@ var Lr = {
|
|
|
3212
3788
|
return this.path(...e);
|
|
3213
3789
|
}
|
|
3214
3790
|
};
|
|
3215
|
-
})))(), 1),
|
|
3791
|
+
})))(), 1), ji = {
|
|
3216
3792
|
1: "north",
|
|
3217
3793
|
2: "northeast",
|
|
3218
3794
|
3: "northwest",
|
|
@@ -3225,7 +3801,7 @@ var Lr = {
|
|
|
3225
3801
|
10: "down",
|
|
3226
3802
|
11: "in",
|
|
3227
3803
|
12: "out"
|
|
3228
|
-
},
|
|
3804
|
+
}, Mi = {
|
|
3229
3805
|
north: "n",
|
|
3230
3806
|
northeast: "ne",
|
|
3231
3807
|
northwest: "nw",
|
|
@@ -3238,7 +3814,7 @@ var Lr = {
|
|
|
3238
3814
|
down: "down",
|
|
3239
3815
|
in: "in",
|
|
3240
3816
|
out: "out"
|
|
3241
|
-
},
|
|
3817
|
+
}, Ni = class {
|
|
3242
3818
|
constructor(e) {
|
|
3243
3819
|
this.mapReader = e, this.data = this.buildGraph();
|
|
3244
3820
|
}
|
|
@@ -3264,12 +3840,12 @@ var Lr = {
|
|
|
3264
3840
|
buildGraph() {
|
|
3265
3841
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
3266
3842
|
return this.mapReader.getRooms().forEach((i) => {
|
|
3267
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
3843
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => ji[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
3268
3844
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
3269
3845
|
if (s.has(e)) return;
|
|
3270
3846
|
let c = this.mapReader.getRoom(t);
|
|
3271
3847
|
if (c) {
|
|
3272
|
-
let s =
|
|
3848
|
+
let s = Mi[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
3273
3849
|
a.push({
|
|
3274
3850
|
id: t,
|
|
3275
3851
|
weight: l
|
|
@@ -3300,7 +3876,7 @@ var Lr = {
|
|
|
3300
3876
|
};
|
|
3301
3877
|
//#endregion
|
|
3302
3878
|
//#region src/PathFinder.ts
|
|
3303
|
-
function
|
|
3879
|
+
function Pi(e, t) {
|
|
3304
3880
|
e.push(t);
|
|
3305
3881
|
let n = e.length - 1;
|
|
3306
3882
|
for (; n > 0;) {
|
|
@@ -3309,7 +3885,7 @@ function qr(e, t) {
|
|
|
3309
3885
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
3310
3886
|
}
|
|
3311
3887
|
}
|
|
3312
|
-
function
|
|
3888
|
+
function Fi(e) {
|
|
3313
3889
|
if (e.length === 0) return;
|
|
3314
3890
|
let t = e[0], n = e.pop();
|
|
3315
3891
|
if (e.length > 0) {
|
|
@@ -3323,16 +3899,16 @@ function Jr(e) {
|
|
|
3323
3899
|
}
|
|
3324
3900
|
return t;
|
|
3325
3901
|
}
|
|
3326
|
-
function
|
|
3902
|
+
function Ii(e, t, n) {
|
|
3327
3903
|
let r = [n], i = n;
|
|
3328
3904
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
3329
3905
|
return r.reverse(), r;
|
|
3330
3906
|
}
|
|
3331
|
-
function
|
|
3907
|
+
function Li(e, t, n) {
|
|
3332
3908
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
3333
3909
|
return i ? i.map((e) => Number(e)) : null;
|
|
3334
3910
|
}
|
|
3335
|
-
function
|
|
3911
|
+
function Ri(e, t, n, r) {
|
|
3336
3912
|
let i = r.getRoom(n);
|
|
3337
3913
|
if (!i) return null;
|
|
3338
3914
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -3341,16 +3917,16 @@ function Zr(e, t, n, r) {
|
|
|
3341
3917
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
3342
3918
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
3343
3919
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
3344
|
-
for (d.set(t, 0),
|
|
3920
|
+
for (d.set(t, 0), Pi(p, {
|
|
3345
3921
|
id: t,
|
|
3346
3922
|
priority: u(t)
|
|
3347
3923
|
}); p.length > 0;) {
|
|
3348
|
-
let { id: r } =
|
|
3349
|
-
if (r === n) return
|
|
3924
|
+
let { id: r } = Fi(p);
|
|
3925
|
+
if (r === n) return Ii(f, t, n);
|
|
3350
3926
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
3351
3927
|
if (a) for (let e of a) {
|
|
3352
3928
|
let t = i + e.weight;
|
|
3353
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
3929
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), Pi(p, {
|
|
3354
3930
|
id: e.id,
|
|
3355
3931
|
priority: t + u(e.id)
|
|
3356
3932
|
}));
|
|
@@ -3358,9 +3934,9 @@ function Zr(e, t, n, r) {
|
|
|
3358
3934
|
}
|
|
3359
3935
|
return null;
|
|
3360
3936
|
}
|
|
3361
|
-
var
|
|
3937
|
+
var zi = class {
|
|
3362
3938
|
constructor(e, t = "dijkstra") {
|
|
3363
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
3939
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ni(e), this.dijkstraGraph = new Ai.default(this.mapGraph.getGraphDefinition());
|
|
3364
3940
|
}
|
|
3365
3941
|
get algorithm() {
|
|
3366
3942
|
return this._algorithm;
|
|
@@ -3379,10 +3955,10 @@ var Qr = class {
|
|
|
3379
3955
|
let r;
|
|
3380
3956
|
switch (this._algorithm) {
|
|
3381
3957
|
case "dijkstra":
|
|
3382
|
-
r =
|
|
3958
|
+
r = Li(this.dijkstraGraph, e, t);
|
|
3383
3959
|
break;
|
|
3384
3960
|
case "astar":
|
|
3385
|
-
r =
|
|
3961
|
+
r = Ri(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
3386
3962
|
break;
|
|
3387
3963
|
}
|
|
3388
3964
|
return this.cache.set(n, r), r;
|
|
@@ -3392,10 +3968,10 @@ var Qr = class {
|
|
|
3392
3968
|
stub: 1,
|
|
3393
3969
|
full: 0
|
|
3394
3970
|
};
|
|
3395
|
-
function
|
|
3971
|
+
function Bi(e, t, n) {
|
|
3396
3972
|
return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
|
|
3397
3973
|
}
|
|
3398
|
-
function
|
|
3974
|
+
function Vi(e, ...t) {
|
|
3399
3975
|
let n = {}, r;
|
|
3400
3976
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
3401
3977
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -3411,7 +3987,7 @@ function ei(e, ...t) {
|
|
|
3411
3987
|
for (let s of r) {
|
|
3412
3988
|
let r = s.getExitTreatment ? s.getExitTreatment(e, t, n) : o(s, e, t, n);
|
|
3413
3989
|
if (a === void 0) a = r;
|
|
3414
|
-
else if (a =
|
|
3990
|
+
else if (a = Bi(a, r, i), i === "first") break;
|
|
3415
3991
|
}
|
|
3416
3992
|
return a ?? "full";
|
|
3417
3993
|
},
|
|
@@ -3424,7 +4000,7 @@ function ei(e, ...t) {
|
|
|
3424
4000
|
}
|
|
3425
4001
|
//#endregion
|
|
3426
4002
|
//#region src/lens/ExplorationLens.ts
|
|
3427
|
-
var
|
|
4003
|
+
var Hi = class {
|
|
3428
4004
|
constructor(e) {
|
|
3429
4005
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
3430
4006
|
}
|
|
@@ -3459,7 +4035,7 @@ var ti = class {
|
|
|
3459
4035
|
clear() {
|
|
3460
4036
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
3461
4037
|
}
|
|
3462
|
-
},
|
|
4038
|
+
}, Ui = {
|
|
3463
4039
|
1: "north",
|
|
3464
4040
|
2: "northeast",
|
|
3465
4041
|
3: "northwest",
|
|
@@ -3473,7 +4049,7 @@ var ti = class {
|
|
|
3473
4049
|
11: "in",
|
|
3474
4050
|
12: "out"
|
|
3475
4051
|
};
|
|
3476
|
-
function
|
|
4052
|
+
function Wi() {
|
|
3477
4053
|
return {
|
|
3478
4054
|
areaWidth: 150,
|
|
3479
4055
|
areaHeight: 80,
|
|
@@ -3487,14 +4063,14 @@ function ri() {
|
|
|
3487
4063
|
highlightColor: "#ff9900"
|
|
3488
4064
|
};
|
|
3489
4065
|
}
|
|
3490
|
-
var
|
|
4066
|
+
var Gi = class {
|
|
3491
4067
|
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 ??
|
|
4068
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? Wi(), this.stage = new D.Stage({
|
|
3493
4069
|
container: e,
|
|
3494
4070
|
width: e.clientWidth,
|
|
3495
4071
|
height: e.clientHeight,
|
|
3496
4072
|
draggable: !0
|
|
3497
|
-
}), this.backgroundLayer = new
|
|
4073
|
+
}), 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
4074
|
}
|
|
3499
4075
|
initResize(e) {
|
|
3500
4076
|
new ResizeObserver(() => {
|
|
@@ -3586,7 +4162,7 @@ var ii = class {
|
|
|
3586
4162
|
if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
|
|
3587
4163
|
let e = new Image();
|
|
3588
4164
|
e.crossOrigin = "anonymous", e.onload = () => {
|
|
3589
|
-
this.backgroundImage = new
|
|
4165
|
+
this.backgroundImage = new D.Image({
|
|
3590
4166
|
x: this.backgroundConfig.x,
|
|
3591
4167
|
y: this.backgroundConfig.y,
|
|
3592
4168
|
image: e,
|
|
@@ -3679,7 +4255,7 @@ var ii = class {
|
|
|
3679
4255
|
}
|
|
3680
4256
|
}
|
|
3681
4257
|
getLockedDirections(e) {
|
|
3682
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
4258
|
+
return new Set((e.exitLocks ?? []).map((e) => Ui[e]).filter((e) => !!e));
|
|
3683
4259
|
}
|
|
3684
4260
|
createConnection(e, t, n) {
|
|
3685
4261
|
let r = this.toPlanarDirection(n);
|
|
@@ -4141,7 +4717,7 @@ var ii = class {
|
|
|
4141
4717
|
y: n.y + n.height / 2
|
|
4142
4718
|
}, a, o;
|
|
4143
4719
|
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
|
|
4720
|
+
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
4721
|
points: [
|
|
4146
4722
|
a.x,
|
|
4147
4723
|
a.y,
|
|
@@ -4174,16 +4750,16 @@ var ii = class {
|
|
|
4174
4750
|
if (!isFinite(e.x) || !isFinite(e.y)) continue;
|
|
4175
4751
|
let t = e.areaId === this.highlightedArea;
|
|
4176
4752
|
if (this.dotsMode) {
|
|
4177
|
-
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new
|
|
4753
|
+
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new D.Group({
|
|
4178
4754
|
x: n,
|
|
4179
4755
|
y: r,
|
|
4180
4756
|
draggable: !0
|
|
4181
|
-
}), a = new
|
|
4757
|
+
}), a = new D.Circle({
|
|
4182
4758
|
radius: 6,
|
|
4183
4759
|
fill: t ? this.settings.highlightColor : "#ffffff",
|
|
4184
4760
|
stroke: t ? this.settings.highlightColor : "#ffffff",
|
|
4185
4761
|
strokeWidth: 1
|
|
4186
|
-
}), o = new
|
|
4762
|
+
}), o = new D.Text({
|
|
4187
4763
|
text: e.name,
|
|
4188
4764
|
fontSize: 10,
|
|
4189
4765
|
fill: "#ffffff",
|
|
@@ -4204,18 +4780,18 @@ var ii = class {
|
|
|
4204
4780
|
this.stage.container().style.cursor = "pointer";
|
|
4205
4781
|
}), this.areaLayer.add(i);
|
|
4206
4782
|
} else {
|
|
4207
|
-
let n = new
|
|
4783
|
+
let n = new D.Group({
|
|
4208
4784
|
x: e.x,
|
|
4209
4785
|
y: e.y,
|
|
4210
4786
|
draggable: !0
|
|
4211
|
-
}), r = new
|
|
4787
|
+
}), r = new D.Rect({
|
|
4212
4788
|
width: e.width,
|
|
4213
4789
|
height: e.height,
|
|
4214
4790
|
fill: this.settings.areaFillColor,
|
|
4215
4791
|
stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
|
|
4216
4792
|
strokeWidth: t ? 3 : 2,
|
|
4217
4793
|
cornerRadius: 8
|
|
4218
|
-
}), i = new
|
|
4794
|
+
}), i = new D.Text({
|
|
4219
4795
|
text: e.name,
|
|
4220
4796
|
fontSize: this.settings.fontSize,
|
|
4221
4797
|
fill: this.settings.textColor,
|
|
@@ -4227,7 +4803,7 @@ var ii = class {
|
|
|
4227
4803
|
verticalAlign: "middle",
|
|
4228
4804
|
ellipsis: !0,
|
|
4229
4805
|
wrap: "word"
|
|
4230
|
-
}), a = new
|
|
4806
|
+
}), a = new D.Text({
|
|
4231
4807
|
text: `${e.roomCount} rooms`,
|
|
4232
4808
|
fontSize: 10,
|
|
4233
4809
|
fill: this.settings.connectionColor,
|
|
@@ -4291,6 +4867,6 @@ var ii = class {
|
|
|
4291
4867
|
}
|
|
4292
4868
|
};
|
|
4293
4869
|
//#endregion
|
|
4294
|
-
export { n as ALL_VISIBLE,
|
|
4870
|
+
export { n as ALL_VISIBLE, di as AmbientLightOverlay, ae as Area, Gi as AreaMapRenderer, yr as Blueprint, r as Camera, ii as CanvasExporter, Cr as Construction, E as CullingManager, Ar as DarkModern, A as DrawCommandLayerNode, Hi as ExplorationLens, Tr as GradientRooms, Dr as GraphPaper, C as HitTester, c as IDENTITY_TRANSFORM, Sr as Isometric, Ni as MapGraph, se as MapReader, Mr as MapRenderer, be as MapState, ke as MaterializingLayerNode, br as Neon, vr as Parchment, zi as PathFinder, oe as Plane, ni as PngBlobExporter, ai as PngBytesExporter, ti as PngExporter, Oe 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, Ti as WaypointOverlay, w as applyStyleToShapes, Pr as buildDrawCommands, ri as canvasToBytes, e as colorLightness, _ as compose, Vi as composeLenses, ee as computePathData, Wi 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
4871
|
|
|
4296
4872
|
//# sourceMappingURL=index.mjs.map
|