mudlet-map-renderer 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ScenePipeline.d.ts +10 -1
- package/dist/binary/BinaryMapReader.d.ts +4 -2
- package/dist/binary.mjs.map +1 -1
- package/dist/{flushSceneShapes-Duhi0OQv.js → flushSceneShapes-c7ttw7D-.js} +637 -424
- package/dist/flushSceneShapes-c7ttw7D-.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +754 -672
- package/dist/index.mjs.map +1 -1
- package/dist/lens/hiddenAwareLens.d.ts +12 -0
- package/dist/offscreen.mjs +45 -45
- package/dist/render/RecordingLayer.d.ts +22 -7
- package/dist/rendering/KonvaRenderBackend.d.ts +20 -0
- package/dist/rendering/SceneManager.d.ts +2 -1
- package/dist/scene/NeighborProjector.d.ts +82 -0
- package/dist/scene/RoomFlags.d.ts +36 -0
- package/dist/scene/RoomStyle.d.ts +2 -0
- package/dist/scene/elements/RoomLayout.d.ts +12 -0
- package/dist/types/Settings.d.ts +29 -0
- package/package.json +5 -3
- package/dist/flushSceneShapes-Duhi0OQv.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { A as e,
|
|
2
|
-
import { n as
|
|
3
|
-
import
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, _ as b, a as x, b as S, c as C, d as w, f as T, g as ee, h as E, i as te, j as D, k as ne, l as re, m as ie, n as ae, o as oe, p as se, r as O, s as ce, u as le, v as ue, w as de, x as fe, y as pe, z as me } from "./flushSceneShapes-c7ttw7D-.js";
|
|
2
|
+
import { n as he, r as ge, t as _e } from "./MapReader-Brzg-X7T.js";
|
|
3
|
+
import k from "konva";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
6
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
5
|
+
var ve = Object.create, ye = Object.defineProperty, be = Object.getOwnPropertyDescriptor, xe = Object.getOwnPropertyNames, Se = Object.getPrototypeOf, Ce = Object.prototype.hasOwnProperty, A = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), we = (e, t, n, r) => {
|
|
6
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = xe(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ce.call(e, s) && s !== n && ye(e, s, {
|
|
7
7
|
get: ((e) => t[e]).bind(null, s),
|
|
8
|
-
enumerable: !(r =
|
|
8
|
+
enumerable: !(r = be(t, s)) || r.enumerable
|
|
9
9
|
});
|
|
10
10
|
return e;
|
|
11
|
-
},
|
|
11
|
+
}, Te = (e, t, n) => (n = e == null ? {} : ve(Se(e)), we(t || !e || !e.__esModule ? ye(n, "default", {
|
|
12
12
|
value: e,
|
|
13
13
|
enumerable: !0
|
|
14
|
-
}) : n, e)),
|
|
15
|
-
function
|
|
14
|
+
}) : n, e)), Ee = .6, De = .025, Oe = "rgb(225, 255, 225)";
|
|
15
|
+
function ke() {
|
|
16
16
|
return {
|
|
17
|
-
roomSize:
|
|
18
|
-
lineWidth:
|
|
19
|
-
lineColor:
|
|
17
|
+
roomSize: Ee,
|
|
18
|
+
lineWidth: De,
|
|
19
|
+
lineColor: Oe,
|
|
20
20
|
backgroundColor: "#000000",
|
|
21
21
|
instantMapMove: !1,
|
|
22
22
|
highlightCurrentRoom: !0,
|
|
23
23
|
cullingEnabled: !0,
|
|
24
24
|
cullingMode: "indexed",
|
|
25
|
+
coalesceRooms: !1,
|
|
25
26
|
cullingBounds: null,
|
|
26
27
|
labelRenderMode: "image",
|
|
27
28
|
transparentLabels: !1,
|
|
28
29
|
roomShape: "rectangle",
|
|
30
|
+
hiddenRooms: "hide",
|
|
29
31
|
playerMarker: {
|
|
30
32
|
strokeColor: "#00e5b2",
|
|
31
33
|
strokeAlpha: 1,
|
|
@@ -59,14 +61,16 @@ function ye() {
|
|
|
59
61
|
fontFamily: "sans-serif",
|
|
60
62
|
uniformLevelSize: !1,
|
|
61
63
|
areaExitLabels: !1,
|
|
62
|
-
areaExitLabelFontSize: .3
|
|
64
|
+
areaExitLabelFontSize: .3,
|
|
65
|
+
neighborSpill: !1,
|
|
66
|
+
neighborSpillDistance: 20
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
69
|
//#endregion
|
|
66
70
|
//#region src/MapState.ts
|
|
67
|
-
var
|
|
71
|
+
var Ae = class {
|
|
68
72
|
constructor(e, t) {
|
|
69
|
-
this.events = new
|
|
73
|
+
this.events = new p(), this.highlights = /* @__PURE__ */ new Map(), this.paths = [], this.lens = u, this.mapReader = e, this.settings = t;
|
|
70
74
|
}
|
|
71
75
|
setLens(e) {
|
|
72
76
|
this.lens = e, this.events.emit("lens", { lens: e });
|
|
@@ -199,7 +203,7 @@ var be = class {
|
|
|
199
203
|
};
|
|
200
204
|
//#endregion
|
|
201
205
|
//#region src/scene/elements/GridLayout.ts
|
|
202
|
-
function
|
|
206
|
+
function je(e, t, n = {}) {
|
|
203
207
|
if (!t.gridEnabled) return [];
|
|
204
208
|
let r = n.inverseTransform ?? ((e, t) => ({
|
|
205
209
|
x: e,
|
|
@@ -236,11 +240,11 @@ function xe(e, t, n = {}) {
|
|
|
236
240
|
}
|
|
237
241
|
//#endregion
|
|
238
242
|
//#region src/export/clipSceneToViewport.ts
|
|
239
|
-
function
|
|
243
|
+
function Me(e, t, n, r) {
|
|
240
244
|
if (!n.cullingEnabled) return /* @__PURE__ */ new Map();
|
|
241
245
|
let { minX: i, maxX: a, minY: o, maxY: s } = t, c = n.roomSize / 2, l = r?.forward, u = (e, t, n, r) => {
|
|
242
246
|
if (l) {
|
|
243
|
-
let c =
|
|
247
|
+
let c = Ne(e, t, n, r, l);
|
|
244
248
|
return c.maxX >= i && c.minX <= a && c.maxY >= o && c.minY <= s;
|
|
245
249
|
}
|
|
246
250
|
return n >= i && e <= a && r >= o && t <= s;
|
|
@@ -253,7 +257,7 @@ function Se(e, t, n, r) {
|
|
|
253
257
|
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
258
|
return d;
|
|
255
259
|
}
|
|
256
|
-
function
|
|
260
|
+
function Ne(e, t, n, r, i) {
|
|
257
261
|
let a = i(e, t), o = i(n, t), s = i(n, r), c = i(e, r);
|
|
258
262
|
return {
|
|
259
263
|
minX: Math.min(a.x, o.x, s.x, c.x),
|
|
@@ -262,13 +266,13 @@ function Ce(e, t, n, r, i) {
|
|
|
262
266
|
maxY: Math.max(a.y, o.y, s.y, c.y)
|
|
263
267
|
};
|
|
264
268
|
}
|
|
265
|
-
function
|
|
266
|
-
let i =
|
|
269
|
+
function Pe(e, t, n, r) {
|
|
270
|
+
let i = je(t, n, { inverseTransform: r?.inverse });
|
|
267
271
|
if (!n.cullingEnabled) return {
|
|
268
272
|
...e.sceneShapes,
|
|
269
273
|
grid: i
|
|
270
274
|
};
|
|
271
|
-
let a =
|
|
275
|
+
let a = Me(e, t, n, r);
|
|
272
276
|
return {
|
|
273
277
|
grid: i,
|
|
274
278
|
link: e.sceneShapes.link.filter((e) => a.get(e) ?? !0),
|
|
@@ -278,14 +282,14 @@ function we(e, t, n, r) {
|
|
|
278
282
|
}
|
|
279
283
|
//#endregion
|
|
280
284
|
//#region src/rendering/SceneManager.ts
|
|
281
|
-
var
|
|
285
|
+
var Fe = {
|
|
282
286
|
grid: [],
|
|
283
287
|
link: [],
|
|
284
288
|
room: [],
|
|
285
289
|
topLabel: []
|
|
286
|
-
},
|
|
290
|
+
}, Ie = class {
|
|
287
291
|
constructor(e, t, n) {
|
|
288
|
-
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new
|
|
292
|
+
this.camera = e, this.settings = t, this.standaloneExitShapeSet = /* @__PURE__ */ new Set(), this.pipeline = new E(n, t);
|
|
289
293
|
}
|
|
290
294
|
get exitRenderer() {
|
|
291
295
|
return this.pipeline.exitRenderer;
|
|
@@ -308,8 +312,8 @@ var Te = {
|
|
|
308
312
|
get hitShapes() {
|
|
309
313
|
return this.lastBuildResult?.hitShapes ?? [];
|
|
310
314
|
}
|
|
311
|
-
rebuild(e, t, n, r) {
|
|
312
|
-
return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
|
|
315
|
+
rebuild(e, t, n, r, i) {
|
|
316
|
+
return this.lastBuildResult = this.pipeline.buildScene(e, t, n, r, i), this.standaloneExitShapeSet = new Set(this.lastBuildResult.standaloneExitShapeRefs.map((e) => e.shape)), this.lastBuildResult;
|
|
313
317
|
}
|
|
314
318
|
buildExitShape(e) {
|
|
315
319
|
return this.pipeline.buildExitShape(e);
|
|
@@ -318,36 +322,36 @@ var Te = {
|
|
|
318
322
|
this.lastBuildResult = void 0, this.standaloneExitShapeSet = /* @__PURE__ */ new Set();
|
|
319
323
|
}
|
|
320
324
|
resetPipeline(e) {
|
|
321
|
-
this.pipeline = new
|
|
325
|
+
this.pipeline = new E(e, this.settings), this.reset();
|
|
322
326
|
}
|
|
323
|
-
cullInteractive(
|
|
327
|
+
cullInteractive(t = e) {
|
|
324
328
|
if (!this.lastBuildResult) return /* @__PURE__ */ new Map();
|
|
325
|
-
let
|
|
326
|
-
return
|
|
329
|
+
let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t };
|
|
330
|
+
return Me(this.lastBuildResult, n, this.settings, r);
|
|
327
331
|
}
|
|
328
|
-
cull(
|
|
332
|
+
cull(t = e) {
|
|
329
333
|
if (!this.lastBuildResult) return {
|
|
330
|
-
shapes:
|
|
334
|
+
shapes: Fe,
|
|
331
335
|
stats: {
|
|
332
336
|
visibleRooms: 0,
|
|
333
337
|
totalRooms: 0,
|
|
334
338
|
visibleExits: 0
|
|
335
339
|
}
|
|
336
340
|
};
|
|
337
|
-
let
|
|
341
|
+
let n = this.camera.getCullingViewport(this.settings.cullingBounds), r = t === e ? void 0 : { forward: t }, i = Pe(this.lastBuildResult, n, this.settings, r);
|
|
338
342
|
return {
|
|
339
|
-
shapes:
|
|
343
|
+
shapes: i,
|
|
340
344
|
stats: {
|
|
341
|
-
visibleRooms:
|
|
345
|
+
visibleRooms: i.room.length,
|
|
342
346
|
totalRooms: this.lastBuildResult.roomShapeRefs.size,
|
|
343
|
-
visibleExits:
|
|
347
|
+
visibleExits: i.link.filter((e) => this.standaloneExitShapeSet.has(e)).length
|
|
344
348
|
}
|
|
345
349
|
};
|
|
346
350
|
}
|
|
347
351
|
};
|
|
348
352
|
//#endregion
|
|
349
353
|
//#region src/render/canvasGradient.ts
|
|
350
|
-
function
|
|
354
|
+
function j(e, t) {
|
|
351
355
|
if (typeof t == "string") return t;
|
|
352
356
|
if (t.type === "linear") {
|
|
353
357
|
let n = e.createLinearGradient(t.x0, t.y0, t.x1, t.y1);
|
|
@@ -360,13 +364,13 @@ function k(e, t) {
|
|
|
360
364
|
}
|
|
361
365
|
//#endregion
|
|
362
366
|
//#region src/render/RecordingLayer.ts
|
|
363
|
-
function
|
|
367
|
+
function M(e, t) {
|
|
364
368
|
switch (t.type) {
|
|
365
369
|
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 =
|
|
370
|
+
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 = j(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
371
|
break;
|
|
368
372
|
case "circle":
|
|
369
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
373
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = j(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
374
|
break;
|
|
371
375
|
case "line": {
|
|
372
376
|
if (t.points.length < 4) break;
|
|
@@ -380,7 +384,7 @@ function De(e, t) {
|
|
|
380
384
|
if (t.vertices.length < 4) break;
|
|
381
385
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
382
386
|
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 =
|
|
387
|
+
e.closePath(), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
384
388
|
break;
|
|
385
389
|
case "text": {
|
|
386
390
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -417,7 +421,7 @@ function De(e, t) {
|
|
|
417
421
|
break;
|
|
418
422
|
}
|
|
419
423
|
}
|
|
420
|
-
var
|
|
424
|
+
var Le = class {
|
|
421
425
|
constructor(e, t) {
|
|
422
426
|
this._visible = !0, this.noScaling = !1, this.commands = [], this.x = e, this.y = t;
|
|
423
427
|
}
|
|
@@ -447,45 +451,102 @@ var Oe = class {
|
|
|
447
451
|
}
|
|
448
452
|
materialize() {
|
|
449
453
|
if (this._konvaGroup) return this._konvaGroup;
|
|
450
|
-
let e = new
|
|
454
|
+
let e = new k.Group({
|
|
451
455
|
x: this.x,
|
|
452
456
|
y: this.y,
|
|
453
457
|
listening: !1,
|
|
454
458
|
visible: this._visible
|
|
455
459
|
}), t = this.commands;
|
|
456
|
-
return e.add(new
|
|
460
|
+
return e.add(new k.Shape({
|
|
457
461
|
listening: !1,
|
|
458
462
|
perfectDrawEnabled: !1,
|
|
459
463
|
sceneFunc: (e) => {
|
|
460
464
|
let n = e._context;
|
|
461
|
-
for (let e of t)
|
|
465
|
+
for (let e of t) M(n, e);
|
|
462
466
|
}
|
|
463
467
|
})), this._konvaGroup = e, e;
|
|
464
468
|
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
469
|
+
};
|
|
470
|
+
function Re(e) {
|
|
471
|
+
if (e.noScaling || e.commands.length !== 1) return null;
|
|
472
|
+
let t = e.commands[0];
|
|
473
|
+
return t.type === "rect" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `r|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.cr}` : t.type === "circle" ? typeof t.fill != "string" && t.fill !== void 0 || t.dash ? null : `c|${t.fill ?? ""}|${t.stroke ?? ""}|${t.sw}|${t.r}` : t.type === "line" ? t.dash || t.alpha !== void 0 ? null : `l|${t.stroke ?? ""}|${t.sw}|${t.lineCap ?? ""}|${t.lineJoin ?? ""}` : null;
|
|
474
|
+
}
|
|
475
|
+
var ze = class {
|
|
476
|
+
constructor(e, t = () => !1) {
|
|
477
|
+
this.coalesce = t, this.entries = [], this.nodeToEntry = /* @__PURE__ */ new Map(), this.buckets = /* @__PURE__ */ new Map(), this.konvaLayer = e, e.destroyChildren();
|
|
478
|
+
let n = this;
|
|
479
|
+
this.konvaShape = new k.Shape({
|
|
470
480
|
listening: !1,
|
|
471
481
|
perfectDrawEnabled: !1,
|
|
472
482
|
sceneFunc: (e) => {
|
|
473
|
-
let
|
|
474
|
-
|
|
475
|
-
if (!e.visible) continue;
|
|
476
|
-
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
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) De(n, t);
|
|
479
|
-
}
|
|
480
|
-
n.setTransform(r);
|
|
483
|
+
let t = e._context;
|
|
484
|
+
n.coalesce() ? n.drawCoalesced(t) : n.drawPerEntry(t);
|
|
481
485
|
}
|
|
482
486
|
}), e.add(this.konvaShape);
|
|
483
487
|
}
|
|
488
|
+
drawPerEntry(e) {
|
|
489
|
+
let t = e.getTransform(), n = t.a, r = t.b, i = t.c, a = t.d;
|
|
490
|
+
for (let o of this.entries) {
|
|
491
|
+
if (!o.visible) continue;
|
|
492
|
+
let s = n * o.x + i * o.y + t.e, c = r * o.x + a * o.y + t.f;
|
|
493
|
+
o.noScaling ? e.setTransform(75, 0, 0, 75, s, c) : e.setTransform(n, r, i, a, s, c);
|
|
494
|
+
for (let t of o.commands) M(e, t);
|
|
495
|
+
}
|
|
496
|
+
e.setTransform(t);
|
|
497
|
+
}
|
|
498
|
+
drawCoalesced(e) {
|
|
499
|
+
let t = e.getTransform();
|
|
500
|
+
this.sweep(e, t, (e) => e.layer !== "room"), this.sweep(e, t, (e) => e.layer === "room"), e.setTransform(t);
|
|
501
|
+
}
|
|
502
|
+
sweep(e, t, n) {
|
|
503
|
+
let r = t.a, i = t.b, a = t.c, o = t.d, s = t.e, c = t.f, l = this.buckets;
|
|
504
|
+
l.clear();
|
|
505
|
+
for (let t of this.entries) {
|
|
506
|
+
if (!t.visible || !n(t)) continue;
|
|
507
|
+
let u = Re(t);
|
|
508
|
+
if (u === null) {
|
|
509
|
+
let n = r * t.x + a * t.y + s, l = i * t.x + o * t.y + c;
|
|
510
|
+
t.noScaling ? e.setTransform(75, 0, 0, 75, n, l) : e.setTransform(r, i, a, o, n, l);
|
|
511
|
+
for (let n of t.commands) M(e, n);
|
|
512
|
+
} else {
|
|
513
|
+
let e = l.get(u);
|
|
514
|
+
e || l.set(u, e = []), e.push(t);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (l.size !== 0) {
|
|
518
|
+
e.setTransform(r, i, a, o, s, c);
|
|
519
|
+
for (let t of l.values()) {
|
|
520
|
+
let n = t[0].commands[0];
|
|
521
|
+
if (e.beginPath(), n.type === "rect") {
|
|
522
|
+
let r = n.cr > 0 && typeof e.roundRect == "function";
|
|
523
|
+
for (let i of t) r ? e.roundRect(i.x + n.x, i.y + n.y, n.w, n.h, n.cr) : e.rect(i.x + n.x, i.y + n.y, n.w, n.h);
|
|
524
|
+
n.fill && (e.fillStyle = n.fill, e.fill()), n.stroke && n.sw > 0 && (e.strokeStyle = n.stroke, e.lineWidth = n.sw, e.setLineDash([]), e.stroke());
|
|
525
|
+
} else if (n.type === "circle") {
|
|
526
|
+
for (let r of t) {
|
|
527
|
+
let t = r.x + n.cx, i = r.y + n.cy;
|
|
528
|
+
e.moveTo(t + n.r, i), e.arc(t, i, n.r, 0, Math.PI * 2);
|
|
529
|
+
}
|
|
530
|
+
n.fill && (e.fillStyle = n.fill, e.fill()), n.stroke && n.sw > 0 && (e.strokeStyle = n.stroke, e.lineWidth = n.sw, e.setLineDash([]), e.stroke());
|
|
531
|
+
} else if (n.type === "line") {
|
|
532
|
+
for (let n of t) {
|
|
533
|
+
let t = n.commands[0].points;
|
|
534
|
+
if (!(t.length < 4)) {
|
|
535
|
+
e.moveTo(t[0] + n.x, t[1] + n.y);
|
|
536
|
+
for (let r = 2; r < t.length; r += 2) e.lineTo(t[r] + n.x, t[r + 1] + n.y);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
n.stroke && (e.strokeStyle = n.stroke), e.lineWidth = n.sw, e.setLineDash([]), n.lineCap && (e.lineCap = n.lineCap), n.lineJoin && (e.lineJoin = n.lineJoin), e.stroke();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
484
544
|
addNode(e) {
|
|
485
545
|
let t = {
|
|
486
546
|
x: e.x,
|
|
487
547
|
y: e.y,
|
|
488
548
|
noScaling: e.noScaling,
|
|
549
|
+
layer: e.layer,
|
|
489
550
|
commands: e.commands,
|
|
490
551
|
visible: e._visible
|
|
491
552
|
};
|
|
@@ -503,11 +564,11 @@ var Oe = class {
|
|
|
503
564
|
ensureShape() {
|
|
504
565
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
505
566
|
}
|
|
506
|
-
},
|
|
567
|
+
}, N = class {
|
|
507
568
|
constructor(e) {
|
|
508
569
|
this.groups = [], this.konvaLayer = e, e.destroyChildren();
|
|
509
570
|
let t = this;
|
|
510
|
-
this.konvaShape = new
|
|
571
|
+
this.konvaShape = new k.Shape({
|
|
511
572
|
listening: !1,
|
|
512
573
|
perfectDrawEnabled: !1,
|
|
513
574
|
sceneFunc: (e) => {
|
|
@@ -516,7 +577,7 @@ var Oe = class {
|
|
|
516
577
|
if (!e._visible) continue;
|
|
517
578
|
let t = i * e.x + o * e.y + r.e, c = a * e.x + s * e.y + r.f;
|
|
518
579
|
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)
|
|
580
|
+
for (let t of e.commands) M(n, t);
|
|
520
581
|
}
|
|
521
582
|
n.setTransform(r);
|
|
522
583
|
}
|
|
@@ -534,7 +595,7 @@ var Oe = class {
|
|
|
534
595
|
ensureShape() {
|
|
535
596
|
this.konvaShape.getParent() || this.konvaLayer.add(this.konvaShape);
|
|
536
597
|
}
|
|
537
|
-
},
|
|
598
|
+
}, Be = class {
|
|
538
599
|
constructor(e) {
|
|
539
600
|
this.konvaLayer = e;
|
|
540
601
|
}
|
|
@@ -550,14 +611,14 @@ var Oe = class {
|
|
|
550
611
|
};
|
|
551
612
|
//#endregion
|
|
552
613
|
//#region src/scene/Shape.ts
|
|
553
|
-
function
|
|
614
|
+
function Ve(e) {
|
|
554
615
|
return typeof e == "object" && !!e;
|
|
555
616
|
}
|
|
556
|
-
function
|
|
617
|
+
function He(e, t) {
|
|
557
618
|
return t !== !1 && e ? e : void 0;
|
|
558
619
|
}
|
|
559
|
-
function
|
|
560
|
-
return
|
|
620
|
+
function P(e, t, n, r, i, a) {
|
|
621
|
+
return Ve(e) ? e.type === "linear" ? {
|
|
561
622
|
type: "linear",
|
|
562
623
|
x0: (t + e.x0) * r + i,
|
|
563
624
|
y0: (n + e.y0) * r + a,
|
|
@@ -577,14 +638,14 @@ function M(e, t, n, r, i, a) {
|
|
|
577
638
|
}
|
|
578
639
|
//#endregion
|
|
579
640
|
//#region src/render/shapeToRecording.ts
|
|
580
|
-
function
|
|
581
|
-
let t = new
|
|
582
|
-
return e.noScale && (t.noScaling = !0),
|
|
641
|
+
function Ue(e) {
|
|
642
|
+
let t = new Le(e.x, e.y);
|
|
643
|
+
return e.noScale && (t.noScaling = !0), t.layer = e.layer, We(t, e.children, 0, 0), t;
|
|
583
644
|
}
|
|
584
|
-
function
|
|
585
|
-
for (let i of t)
|
|
645
|
+
function We(e, t, n, r) {
|
|
646
|
+
for (let i of t) Ge(e, i, n, r);
|
|
586
647
|
}
|
|
587
|
-
function
|
|
648
|
+
function Ge(e, t, n, r) {
|
|
588
649
|
switch (t.type) {
|
|
589
650
|
case "rect":
|
|
590
651
|
e.commands.push({
|
|
@@ -593,11 +654,11 @@ function Pe(e, t, n, r) {
|
|
|
593
654
|
y: t.y + r,
|
|
594
655
|
w: t.width,
|
|
595
656
|
h: t.height,
|
|
596
|
-
fill:
|
|
657
|
+
fill: P(t.paint.fill, n, r, 1, 0, 0),
|
|
597
658
|
stroke: t.paint.stroke,
|
|
598
659
|
sw: t.paint.strokeWidth ?? 0,
|
|
599
660
|
cr: t.cornerRadius ?? 0,
|
|
600
|
-
dash:
|
|
661
|
+
dash: He(t.paint.dash, t.paint.dashEnabled)
|
|
601
662
|
});
|
|
602
663
|
return;
|
|
603
664
|
case "circle":
|
|
@@ -606,20 +667,20 @@ function Pe(e, t, n, r) {
|
|
|
606
667
|
cx: t.cx + n,
|
|
607
668
|
cy: t.cy + r,
|
|
608
669
|
r: t.radius,
|
|
609
|
-
fill:
|
|
670
|
+
fill: P(t.paint.fill, n, r, 1, 0, 0),
|
|
610
671
|
stroke: t.paint.stroke,
|
|
611
672
|
sw: t.paint.strokeWidth ?? 0,
|
|
612
|
-
dash:
|
|
673
|
+
dash: He(t.paint.dash, t.paint.dashEnabled)
|
|
613
674
|
});
|
|
614
675
|
return;
|
|
615
676
|
case "line": {
|
|
616
|
-
let i = n === 0 && r === 0 ? t.points :
|
|
677
|
+
let i = n === 0 && r === 0 ? t.points : Ke(t.points, n, r);
|
|
617
678
|
e.commands.push({
|
|
618
679
|
type: "line",
|
|
619
680
|
points: i,
|
|
620
681
|
stroke: t.paint.stroke,
|
|
621
682
|
sw: t.paint.strokeWidth ?? 0,
|
|
622
|
-
dash:
|
|
683
|
+
dash: He(t.paint.dash, t.paint.dashEnabled),
|
|
623
684
|
lineCap: t.lineCap,
|
|
624
685
|
lineJoin: t.lineJoin,
|
|
625
686
|
alpha: t.paint.alpha
|
|
@@ -629,8 +690,8 @@ function Pe(e, t, n, r) {
|
|
|
629
690
|
case "polygon":
|
|
630
691
|
e.commands.push({
|
|
631
692
|
type: "polygon",
|
|
632
|
-
vertices: n === 0 && r === 0 ? t.vertices :
|
|
633
|
-
fill:
|
|
693
|
+
vertices: n === 0 && r === 0 ? t.vertices : Ke(t.vertices, n, r),
|
|
694
|
+
fill: P(t.paint.fill, n, r, 1, 0, 0),
|
|
634
695
|
stroke: t.paint.stroke,
|
|
635
696
|
sw: t.paint.strokeWidth ?? 0
|
|
636
697
|
});
|
|
@@ -656,7 +717,7 @@ function Pe(e, t, n, r) {
|
|
|
656
717
|
});
|
|
657
718
|
return;
|
|
658
719
|
case "image": {
|
|
659
|
-
let i =
|
|
720
|
+
let i = qe(t.src);
|
|
660
721
|
e.commands.push({
|
|
661
722
|
type: "image",
|
|
662
723
|
x: t.x + n,
|
|
@@ -669,58 +730,58 @@ function Pe(e, t, n, r) {
|
|
|
669
730
|
return;
|
|
670
731
|
}
|
|
671
732
|
case "group":
|
|
672
|
-
|
|
733
|
+
We(e, t.children, n + t.x, r + t.y);
|
|
673
734
|
return;
|
|
674
735
|
}
|
|
675
736
|
}
|
|
676
|
-
function
|
|
737
|
+
function Ke(e, t, n) {
|
|
677
738
|
let r = Array(e.length);
|
|
678
739
|
for (let i = 0; i < e.length; i += 2) r[i] = e[i] + t, r[i + 1] = e[i + 1] + n;
|
|
679
740
|
return r;
|
|
680
741
|
}
|
|
681
|
-
function
|
|
682
|
-
let t =
|
|
742
|
+
function qe(e) {
|
|
743
|
+
let t = k === void 0 ? typeof Image < "u" ? new Image() : null : k.Util.createImageElement();
|
|
683
744
|
return t && (t.src = e), t;
|
|
684
745
|
}
|
|
685
746
|
//#endregion
|
|
686
747
|
//#region src/rendering/KonvaRenderBackend.ts
|
|
687
|
-
var
|
|
748
|
+
var F = "rgb(120, 72, 0)", Je = class {
|
|
688
749
|
get coordinateTransform() {
|
|
689
750
|
return this._coordinateTransform;
|
|
690
751
|
}
|
|
691
|
-
constructor(
|
|
692
|
-
this.gridCachedBounds = null, this.currentStyle =
|
|
693
|
-
container:
|
|
694
|
-
width:
|
|
695
|
-
height:
|
|
752
|
+
constructor(t, n) {
|
|
753
|
+
this.gridCachedBounds = null, this.currentStyle = x, this.hitTester = new oe(), this.lastHitShapes = [], this.shapeToDrawEntry = /* @__PURE__ */ new Map(), this.shapeToGroup = /* @__PURE__ */ new Map(), this.highlightShapes = /* @__PURE__ */ new Map(), this.pathShapes = [], this.spilledRoomPositions = /* @__PURE__ */ new Map(), this.currentRoomOverlay = [], this.destroyed = !1, this._coordinateTransform = e, this.coordinateInverse = e, this.liveEffects = /* @__PURE__ */ new Map(), this.sceneOverlays = /* @__PURE__ */ new Map(), this.sceneOverlayNodes = /* @__PURE__ */ new Map(), this.viewportSubscribers = /* @__PURE__ */ new Set(), this.state = t, this.container = n, n ? (this.stage = new k.Stage({
|
|
754
|
+
container: n,
|
|
755
|
+
width: n.clientWidth,
|
|
756
|
+
height: n.clientHeight,
|
|
696
757
|
draggable: !1
|
|
697
|
-
}),
|
|
758
|
+
}), n.style.backgroundColor = t.settings.backgroundColor, this.camera = new D(n.clientWidth, n.clientHeight)) : (this.stage = new k.Stage({
|
|
698
759
|
width: 1,
|
|
699
760
|
height: 1
|
|
700
|
-
}), this.camera = new
|
|
701
|
-
let
|
|
702
|
-
if (this.linkLayer =
|
|
761
|
+
}), this.camera = new D(1, 1)), this.gridLayer = new k.Layer({ listening: !1 }), this.stage.add(this.gridLayer);
|
|
762
|
+
let r = new k.Layer({ listening: !1 });
|
|
763
|
+
if (this.linkLayer = r, this.roomLayer = r, this.stage.add(r), this.positionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.positionLayer), this.overlayLayer = new k.Layer({ listening: !1 }), this.stage.add(this.overlayLayer), this.topLabelLayer = new k.Layer({ listening: !1 }), this.stage.add(this.topLabelLayer), this.positionLayerNode = new Be(this.positionLayer), this.overlayLayerNode = new Be(this.overlayLayer), this.sceneNode = new ze(r, () => t.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(this.topLabelLayer), this.sceneManager = new Ie(this.camera, t.settings, t.mapReader), this.events = new p(n), this.culling = new ne(t.settings, () => this.applyClipping()), this.cameraChangeHandler = () => this.applyViewportToStage(), this.camera.on("change", this.cameraChangeHandler), n) {
|
|
703
764
|
this.origSetSize = this.camera.setSize.bind(this.camera);
|
|
704
|
-
let
|
|
705
|
-
this.camera.setSize = (
|
|
706
|
-
|
|
707
|
-
}, this.interactionHandler = new
|
|
708
|
-
clientToMapPoint: (e,
|
|
765
|
+
let e = this.origSetSize;
|
|
766
|
+
this.camera.setSize = (t, n) => {
|
|
767
|
+
e(t, n), this.stage.width(t), this.stage.height(n);
|
|
768
|
+
}, this.interactionHandler = new ie(n, this.camera, t, {
|
|
769
|
+
clientToMapPoint: (e, t) => this.camera.clientToMapPoint(e, t, n.getBoundingClientRect()),
|
|
709
770
|
pickAtPoint: (e, t) => this.hitTester.pick(e, t)
|
|
710
771
|
}, this.events);
|
|
711
772
|
}
|
|
712
|
-
this.applyStyleTransforms(), this.subscribeToState(
|
|
773
|
+
this.applyStyleTransforms(), this.subscribeToState(t);
|
|
713
774
|
}
|
|
714
775
|
setStyle(e) {
|
|
715
|
-
this.currentStyle = e, this.sceneNode = new
|
|
776
|
+
this.currentStyle = e, this.sceneNode = new ze(this.linkLayer, () => this.state.settings.coalesceRooms), this.gridLayerNode = new N(this.gridLayer), this.topLabelLayerNode = new N(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
777
|
}
|
|
717
778
|
applyStyleTransforms() {
|
|
718
|
-
let
|
|
719
|
-
this._coordinateTransform =
|
|
720
|
-
let
|
|
779
|
+
let t = this.currentStyle, n = t.worldToScene ? (e, n) => t.worldToScene(e, n) : e, r = t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : e, i = this.coordinateInverse, a = t.sceneLayerOffset ? (e) => t.sceneLayerOffset(e) : void 0;
|
|
780
|
+
this._coordinateTransform = n, this.coordinateInverse = r, this.coordinateLayerOffset = a, this.culling.setCoordinateTransform(n), this.gridCachedBounds = null, this.lastHitShapes.length > 0 && this.hitTester.build(this.lastHitShapes, this.state.settings.roomSize, n, a);
|
|
781
|
+
let o = this.camera.getScale(), s = this.camera.width / 2, c = this.camera.height / 2, l = i((s - this.camera.position.x) / o, (c - this.camera.position.y) / o), u = n(l.x, l.y);
|
|
721
782
|
this.camera.position = {
|
|
722
|
-
x:
|
|
723
|
-
y:
|
|
783
|
+
x: s - u.x * o,
|
|
784
|
+
y: c - u.y * o
|
|
724
785
|
}, this.applyViewportToStage();
|
|
725
786
|
}
|
|
726
787
|
styleContext() {
|
|
@@ -838,7 +899,7 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
838
899
|
e.events.on("area", () => {
|
|
839
900
|
this.refresh();
|
|
840
901
|
}), e.events.on("position", ({ roomId: e, center: t, areaChanged: n }) => {
|
|
841
|
-
this.onPositionChanged(e, t, n);
|
|
902
|
+
this.onPositionChanged(e, t, n), this.state.settings.neighborSpill && e !== void 0 && this.refresh();
|
|
842
903
|
}), e.events.on("center", ({ roomId: t, instant: n }) => {
|
|
843
904
|
let r = e.mapReader.getRoom(t);
|
|
844
905
|
if (r) {
|
|
@@ -857,20 +918,35 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
857
918
|
}
|
|
858
919
|
buildScene(e, t, n) {
|
|
859
920
|
this.positionLayer.destroyChildren(), this.positionMarker = void 0, this.clearOverlayShapes(), this.currentRoomOverlay = [], this.sceneNode.destroyChildren(), this.gridLayerNode.destroyChildren(), this.gridCachedBounds = null, this.topLabelLayerNode.destroyChildren();
|
|
860
|
-
let r = this.
|
|
921
|
+
let r = this.computeNeighborSpill(e, n);
|
|
922
|
+
this.spilledRoomPositions = r ? pe(r) : /* @__PURE__ */ new Map();
|
|
923
|
+
let i = this.sceneManager.rebuild(e, t, n, this.state.lens, r);
|
|
861
924
|
this.shapeToGroup = /* @__PURE__ */ new Map(), this.refreshGrid(this.camera.getViewportBounds());
|
|
862
|
-
for (let e of
|
|
925
|
+
for (let e of i.sceneShapes.link) {
|
|
863
926
|
let t = this.addStyledShape(e, this.sceneNode);
|
|
864
927
|
t && this.shapeToGroup.set(e, t);
|
|
865
928
|
}
|
|
866
|
-
for (let e of
|
|
929
|
+
for (let e of i.sceneShapes.room) {
|
|
867
930
|
let t = this.addStyledShape(e, this.sceneNode);
|
|
868
931
|
t && this.shapeToGroup.set(e, t);
|
|
869
932
|
}
|
|
870
|
-
for (let e of
|
|
933
|
+
for (let e of i.sceneShapes.topLabel) this.addStyledShape(e, this.topLabelLayerNode);
|
|
934
|
+
}
|
|
935
|
+
computeNeighborSpill(e, t) {
|
|
936
|
+
let n = this.state.settings;
|
|
937
|
+
if (!n.neighborSpill) return;
|
|
938
|
+
let r = this.state.positionRoomId;
|
|
939
|
+
if (r === void 0) return;
|
|
940
|
+
let i = this.state.mapReader.getRoom(r);
|
|
941
|
+
if (!i || i.area !== e.getAreaId() || i.z !== t) return;
|
|
942
|
+
let a = this.state.lens;
|
|
943
|
+
return b(this.state.mapReader, e.getAreaId(), t, r, n.neighborSpillDistance, (e) => a.isVisible(e));
|
|
944
|
+
}
|
|
945
|
+
overlayReader() {
|
|
946
|
+
return this.spilledRoomPositions.size === 0 || this.state.currentArea === void 0 || this.state.currentZIndex === void 0 ? this.state.mapReader : new ee(this.state.mapReader, this.state.currentArea, this.state.currentZIndex, this.spilledRoomPositions);
|
|
871
947
|
}
|
|
872
948
|
addStyledShape(e, t, n = !1) {
|
|
873
|
-
let r = n || this.currentStyle ===
|
|
949
|
+
let r = n || this.currentStyle === x ? [e] : O([e], this.currentStyle, this.styleContext());
|
|
874
950
|
if (r.length === 0) return;
|
|
875
951
|
let i;
|
|
876
952
|
i = r.length === 1 && r[0].type === "group" ? r[0] : {
|
|
@@ -881,7 +957,7 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
881
957
|
layer: e.layer,
|
|
882
958
|
noScale: e.noScale
|
|
883
959
|
};
|
|
884
|
-
let a =
|
|
960
|
+
let a = Ue(i);
|
|
885
961
|
return t.addNode(a), a;
|
|
886
962
|
}
|
|
887
963
|
refreshGrid(e) {
|
|
@@ -893,7 +969,7 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
893
969
|
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
970
|
if (g && g.left === f && g.right === p && g.top === m && g.bottom === h) return;
|
|
895
971
|
this.gridLayerNode.destroyChildren();
|
|
896
|
-
let _ =
|
|
972
|
+
let _ = je(e, t, { inverseTransform: this.coordinateInverse });
|
|
897
973
|
for (let e of _) this.addStyledShape(e, this.gridLayerNode);
|
|
898
974
|
this.gridCachedBounds = {
|
|
899
975
|
left: f,
|
|
@@ -943,8 +1019,8 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
943
1019
|
this.positionLayerNode.batchDraw();
|
|
944
1020
|
return;
|
|
945
1021
|
}
|
|
946
|
-
let t =
|
|
947
|
-
this.positionMarker = this.addStyledShape(
|
|
1022
|
+
let t = T(e, this.state.settings);
|
|
1023
|
+
this.positionMarker = this.addStyledShape(re(t), this.positionLayerNode);
|
|
948
1024
|
}
|
|
949
1025
|
clearCurrentRoomOverlay() {
|
|
950
1026
|
this.currentRoomOverlay.forEach((e) => e.destroy()), this.currentRoomOverlay = [], this.positionLayerNode.batchDraw();
|
|
@@ -954,42 +1030,48 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
954
1030
|
this.positionLayerNode.batchDraw();
|
|
955
1031
|
return;
|
|
956
1032
|
}
|
|
957
|
-
let
|
|
958
|
-
if (!
|
|
1033
|
+
let r = this.state.settings;
|
|
1034
|
+
if (!r.highlightCurrentRoom) {
|
|
959
1035
|
this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
960
1036
|
return;
|
|
961
1037
|
}
|
|
962
|
-
let
|
|
963
|
-
|
|
964
|
-
let
|
|
1038
|
+
let a = /* @__PURE__ */ new Map();
|
|
1039
|
+
a.set(e.id, e);
|
|
1040
|
+
let o = [], s = this.sceneManager.exitRenderer, c = S(this.state.lens, r.hiddenRooms === "hide");
|
|
965
1041
|
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 =
|
|
967
|
-
t
|
|
1042
|
+
let t = this.state.mapReader.getRoom(e.a), n = this.state.mapReader.getRoom(e.b);
|
|
1043
|
+
if (!t || !n || (c.getExitTreatment ? c.getExitTreatment(e, t, n) : d(c, e, t, n)) !== "full") return;
|
|
1044
|
+
let r = s.renderDataWithColor(e, F, this.state.currentZIndex);
|
|
1045
|
+
if (r) {
|
|
1046
|
+
if (r.targetRoomId !== void 0 && this.spilledRoomPositions.has(r.targetRoomId)) return;
|
|
1047
|
+
o.push(this.sceneManager.buildExitShape(r));
|
|
1048
|
+
}
|
|
968
1049
|
});
|
|
969
|
-
for (let
|
|
970
|
-
for (let
|
|
1050
|
+
for (let t of g(e, r, F)) o.push(h(t, e.id));
|
|
1051
|
+
for (let t of i(e, r, F)) o.push(fe(t));
|
|
971
1052
|
[...Object.values(e.exits), ...Object.values(e.specialExits)].forEach((e) => {
|
|
972
1053
|
let t = this.state.mapReader.getRoom(e);
|
|
973
|
-
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex &&
|
|
974
|
-
}),
|
|
1054
|
+
t && t.area === this.state.currentArea && t.z === this.state.currentZIndex && c.isVisible(t) && a.set(e, t);
|
|
1055
|
+
}), o.forEach((e) => {
|
|
975
1056
|
let t = this.addStyledShape(e, this.positionLayerNode);
|
|
976
1057
|
t && this.currentRoomOverlay.push(t);
|
|
977
|
-
}),
|
|
978
|
-
let
|
|
979
|
-
strokeOverride:
|
|
980
|
-
flatPipeline: !0
|
|
1058
|
+
}), a.forEach((i, a) => {
|
|
1059
|
+
let o = a === e.id, s = de(i, this.state.mapReader, r, {
|
|
1060
|
+
strokeOverride: o ? F : r.lineColor,
|
|
1061
|
+
flatPipeline: !0,
|
|
1062
|
+
...t(i, r.hiddenRooms)
|
|
981
1063
|
});
|
|
982
|
-
|
|
983
|
-
let
|
|
984
|
-
|
|
1064
|
+
s.children.push(...n(i, this.state.mapReader, r));
|
|
1065
|
+
let c = this.addStyledShape(s, this.positionLayerNode);
|
|
1066
|
+
c && this.currentRoomOverlay.push(c);
|
|
985
1067
|
}), this.positionMarker && this.positionMarker.moveToTop(), this.positionLayerNode.batchDraw();
|
|
986
1068
|
}
|
|
987
1069
|
syncHighlight(e, t) {
|
|
988
1070
|
let n = this.highlightShapes.get(e);
|
|
989
1071
|
if (n && (n.destroy(), this.highlightShapes.delete(e)), t !== void 0) {
|
|
990
|
-
let n = this.
|
|
1072
|
+
let n = this.overlayReader().getRoom(e);
|
|
991
1073
|
if (n && n.area === this.state.currentArea && n.z === this.state.currentZIndex) {
|
|
992
|
-
let r =
|
|
1074
|
+
let r = le(n, t, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
|
|
993
1075
|
i && this.highlightShapes.set(e, i);
|
|
994
1076
|
}
|
|
995
1077
|
}
|
|
@@ -998,28 +1080,28 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
998
1080
|
syncHighlights() {
|
|
999
1081
|
for (let e of this.highlightShapes.values()) e.destroy();
|
|
1000
1082
|
this.highlightShapes.clear();
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
let n =
|
|
1004
|
-
if (!n) continue;
|
|
1005
|
-
let r =
|
|
1006
|
-
i && this.highlightShapes.set(
|
|
1083
|
+
let e = this.overlayReader();
|
|
1084
|
+
for (let [t] of this.state.highlights) {
|
|
1085
|
+
let n = e.getRoom(t);
|
|
1086
|
+
if (!n || n.area !== this.state.currentArea || n.z !== this.state.currentZIndex) continue;
|
|
1087
|
+
let r = le(n, this.state.highlights.get(t).colors, this.state.settings), i = this.addStyledShape(ce(r), this.overlayLayerNode);
|
|
1088
|
+
i && this.highlightShapes.set(t, i);
|
|
1007
1089
|
}
|
|
1008
1090
|
this.overlayLayerNode.batchDraw();
|
|
1009
1091
|
}
|
|
1010
1092
|
syncPaths() {
|
|
1011
1093
|
this.clearPathShapes();
|
|
1012
1094
|
let { currentArea: e, currentZIndex: t } = this.state;
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1095
|
+
if (e === void 0 || t === void 0) return;
|
|
1096
|
+
let n = this.overlayReader();
|
|
1097
|
+
for (let r of this.state.paths) {
|
|
1098
|
+
let i = w(n, this.state.settings, r.locations, r.color, e, t);
|
|
1099
|
+
for (let e of C(i)) {
|
|
1100
|
+
let t = this.addStyledShape(e, this.overlayLayerNode);
|
|
1101
|
+
t && this.pathShapes.push(t);
|
|
1020
1102
|
}
|
|
1021
|
-
this.overlayLayerNode.batchDraw();
|
|
1022
1103
|
}
|
|
1104
|
+
this.overlayLayerNode.batchDraw();
|
|
1023
1105
|
}
|
|
1024
1106
|
clearOverlayShapes() {
|
|
1025
1107
|
for (let e of this.highlightShapes.values()) e.destroy();
|
|
@@ -1032,7 +1114,7 @@ var N = "rgb(120, 72, 0)", Le = class {
|
|
|
1032
1114
|
};
|
|
1033
1115
|
//#endregion
|
|
1034
1116
|
//#region src/style/shape/paintMap.ts
|
|
1035
|
-
function
|
|
1117
|
+
function I(e, t) {
|
|
1036
1118
|
if (e !== void 0) return typeof e == "string" ? t(e) : {
|
|
1037
1119
|
...e,
|
|
1038
1120
|
stops: e.stops.map((e) => ({
|
|
@@ -1041,7 +1123,7 @@ function P(e, t) {
|
|
|
1041
1123
|
}))
|
|
1042
1124
|
};
|
|
1043
1125
|
}
|
|
1044
|
-
function
|
|
1126
|
+
function L(e) {
|
|
1045
1127
|
let t = e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
1046
1128
|
return t ? {
|
|
1047
1129
|
r: parseInt(t[1]),
|
|
@@ -1055,13 +1137,13 @@ function F(e) {
|
|
|
1055
1137
|
a: 1
|
|
1056
1138
|
} : null;
|
|
1057
1139
|
}
|
|
1058
|
-
function
|
|
1140
|
+
function R(e, t, n, r = 1) {
|
|
1059
1141
|
return r < 1 ? `rgba(${e}, ${t}, ${n}, ${r})` : `rgb(${e}, ${t}, ${n})`;
|
|
1060
1142
|
}
|
|
1061
|
-
function
|
|
1143
|
+
function z(e) {
|
|
1062
1144
|
return (.299 * e.r + .587 * e.g + .114 * e.b) / 255;
|
|
1063
1145
|
}
|
|
1064
|
-
function
|
|
1146
|
+
function Ye(e, t, n) {
|
|
1065
1147
|
e /= 255, t /= 255, n /= 255;
|
|
1066
1148
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1067
1149
|
if (r === i) return [
|
|
@@ -1076,99 +1158,99 @@ function Re(e, t, n) {
|
|
|
1076
1158
|
a
|
|
1077
1159
|
];
|
|
1078
1160
|
}
|
|
1079
|
-
function
|
|
1161
|
+
function Xe(e, t, n, r = 1) {
|
|
1080
1162
|
e = (e % 360 + 360) % 360;
|
|
1081
1163
|
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),
|
|
1164
|
+
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), R(Math.round((s + o) * 255), Math.round((c + o) * 255), Math.round((l + o) * 255), r);
|
|
1083
1165
|
}
|
|
1084
1166
|
//#endregion
|
|
1085
1167
|
//#region src/style/shape/ParchmentStyle.ts
|
|
1086
|
-
var
|
|
1087
|
-
function
|
|
1088
|
-
let t =
|
|
1089
|
-
if (!t) return
|
|
1090
|
-
let n =
|
|
1091
|
-
return
|
|
1168
|
+
var Ze = "#4a3728", Qe = "#3b2a1a", $e = 139, et = 115, tt = 85, nt = 244, rt = 228, it = 193;
|
|
1169
|
+
function at(e) {
|
|
1170
|
+
let t = L(e);
|
|
1171
|
+
if (!t) return R(nt, rt, it);
|
|
1172
|
+
let n = z(t);
|
|
1173
|
+
return R(Math.round($e + (nt - $e) * n), Math.round(et + (rt - et) * n), Math.round(tt + (it - tt) * n), t.a);
|
|
1092
1174
|
}
|
|
1093
|
-
function
|
|
1094
|
-
let t =
|
|
1095
|
-
if (!t || t.a >= 1) return
|
|
1096
|
-
let n =
|
|
1097
|
-
return
|
|
1175
|
+
function ot(e) {
|
|
1176
|
+
let t = L(e);
|
|
1177
|
+
if (!t || t.a >= 1) return Ze;
|
|
1178
|
+
let n = L(Ze);
|
|
1179
|
+
return R(n.r, n.g, n.b, t.a);
|
|
1098
1180
|
}
|
|
1099
|
-
function
|
|
1181
|
+
function st(e) {
|
|
1100
1182
|
return {
|
|
1101
1183
|
...e,
|
|
1102
|
-
fill:
|
|
1103
|
-
stroke: e.stroke ?
|
|
1184
|
+
fill: I(e.fill, at),
|
|
1185
|
+
stroke: e.stroke ? ot(e.stroke) : e.stroke
|
|
1104
1186
|
};
|
|
1105
1187
|
}
|
|
1106
|
-
var
|
|
1188
|
+
var ct = { transform(e) {
|
|
1107
1189
|
switch (e.type) {
|
|
1108
1190
|
case "rect":
|
|
1109
1191
|
case "circle":
|
|
1110
1192
|
case "polygon": return {
|
|
1111
1193
|
...e,
|
|
1112
|
-
paint:
|
|
1194
|
+
paint: st(e.paint)
|
|
1113
1195
|
};
|
|
1114
1196
|
case "line": return {
|
|
1115
1197
|
...e,
|
|
1116
1198
|
paint: e.paint.stroke ? {
|
|
1117
1199
|
...e.paint,
|
|
1118
|
-
stroke:
|
|
1200
|
+
stroke: ot(e.paint.stroke)
|
|
1119
1201
|
} : e.paint
|
|
1120
1202
|
};
|
|
1121
1203
|
case "text": return {
|
|
1122
1204
|
...e,
|
|
1123
|
-
fill:
|
|
1205
|
+
fill: Qe
|
|
1124
1206
|
};
|
|
1125
1207
|
case "image":
|
|
1126
1208
|
case "group": return e;
|
|
1127
1209
|
}
|
|
1128
|
-
} },
|
|
1129
|
-
function
|
|
1130
|
-
let t =
|
|
1131
|
-
if (!t) return
|
|
1132
|
-
let n =
|
|
1133
|
-
return
|
|
1210
|
+
} }, lt = "#c0deff", ut = "#e0f0ff", dt = 20, ft = 40, pt = 80, mt = 60, ht = 100, gt = 160;
|
|
1211
|
+
function _t(e) {
|
|
1212
|
+
let t = L(e);
|
|
1213
|
+
if (!t) return R(mt, ht, gt);
|
|
1214
|
+
let n = z(t);
|
|
1215
|
+
return R(Math.round(dt + (mt - dt) * n), Math.round(ft + (ht - ft) * n), Math.round(pt + (gt - pt) * n), t.a);
|
|
1134
1216
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let t =
|
|
1137
|
-
if (!t || t.a >= 1) return
|
|
1138
|
-
let n =
|
|
1139
|
-
return
|
|
1217
|
+
function vt(e) {
|
|
1218
|
+
let t = L(e);
|
|
1219
|
+
if (!t || t.a >= 1) return lt;
|
|
1220
|
+
let n = L(lt);
|
|
1221
|
+
return R(n.r, n.g, n.b, t.a);
|
|
1140
1222
|
}
|
|
1141
|
-
function
|
|
1223
|
+
function yt(e) {
|
|
1142
1224
|
return {
|
|
1143
1225
|
...e,
|
|
1144
|
-
fill:
|
|
1145
|
-
stroke: e.stroke ?
|
|
1226
|
+
fill: I(e.fill, _t),
|
|
1227
|
+
stroke: e.stroke ? vt(e.stroke) : e.stroke
|
|
1146
1228
|
};
|
|
1147
1229
|
}
|
|
1148
|
-
var
|
|
1230
|
+
var bt = { transform(e) {
|
|
1149
1231
|
switch (e.type) {
|
|
1150
1232
|
case "rect":
|
|
1151
1233
|
case "circle":
|
|
1152
1234
|
case "polygon": return {
|
|
1153
1235
|
...e,
|
|
1154
|
-
paint:
|
|
1236
|
+
paint: yt(e.paint)
|
|
1155
1237
|
};
|
|
1156
1238
|
case "line": return {
|
|
1157
1239
|
...e,
|
|
1158
1240
|
paint: e.paint.stroke ? {
|
|
1159
1241
|
...e.paint,
|
|
1160
|
-
stroke:
|
|
1242
|
+
stroke: vt(e.paint.stroke)
|
|
1161
1243
|
} : e.paint
|
|
1162
1244
|
};
|
|
1163
1245
|
case "text": return {
|
|
1164
1246
|
...e,
|
|
1165
|
-
fill:
|
|
1247
|
+
fill: ut
|
|
1166
1248
|
};
|
|
1167
1249
|
case "image":
|
|
1168
1250
|
case "group": return e;
|
|
1169
1251
|
}
|
|
1170
|
-
} },
|
|
1171
|
-
function
|
|
1252
|
+
} }, xt = "#00ffd0", St = .3, Ct = 3;
|
|
1253
|
+
function wt(e, t, n) {
|
|
1172
1254
|
e /= 255, t /= 255, n /= 255;
|
|
1173
1255
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1174
1256
|
if (r === i) return [
|
|
@@ -1183,68 +1265,68 @@ function pt(e, t, n) {
|
|
|
1183
1265
|
a
|
|
1184
1266
|
];
|
|
1185
1267
|
}
|
|
1186
|
-
function
|
|
1268
|
+
function Tt(e, t, n, r = 1) {
|
|
1187
1269
|
e = (e % 360 + 360) % 360;
|
|
1188
1270
|
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
1271
|
e < 60 ? (s = i, c = a, l = 0) : e < 120 ? (s = a, c = i, l = 0) : e < 180 ? (s = 0, c = i, l = a) : e < 240 ? (s = 0, c = a, l = i) : e < 300 ? (s = a, c = 0, l = i) : (s = i, c = 0, l = a);
|
|
1190
1272
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
1191
1273
|
return r < 1 ? `rgba(${u}, ${d}, ${f}, ${r})` : `rgb(${u}, ${d}, ${f})`;
|
|
1192
1274
|
}
|
|
1193
|
-
function
|
|
1194
|
-
let t =
|
|
1275
|
+
function Et(e) {
|
|
1276
|
+
let t = L(e);
|
|
1195
1277
|
if (!t) return {
|
|
1196
1278
|
h: 150,
|
|
1197
1279
|
a: 1
|
|
1198
1280
|
};
|
|
1199
|
-
let [n] =
|
|
1281
|
+
let [n] = wt(t.r, t.g, t.b);
|
|
1200
1282
|
return {
|
|
1201
1283
|
h: n,
|
|
1202
1284
|
a: t.a
|
|
1203
1285
|
};
|
|
1204
1286
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let { h: t, a: n } =
|
|
1207
|
-
return
|
|
1287
|
+
function Dt(e) {
|
|
1288
|
+
let { h: t, a: n } = Et(e);
|
|
1289
|
+
return Tt(t, .95, .65, n);
|
|
1208
1290
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let t =
|
|
1291
|
+
function Ot(e) {
|
|
1292
|
+
let t = L(e);
|
|
1211
1293
|
if (!t) return "rgb(8, 12, 10)";
|
|
1212
|
-
let [n] =
|
|
1213
|
-
return
|
|
1294
|
+
let [n] = wt(t.r, t.g, t.b);
|
|
1295
|
+
return Tt(n, .4, .1, t.a);
|
|
1214
1296
|
}
|
|
1215
|
-
function
|
|
1216
|
-
let { h: t, a: n } =
|
|
1217
|
-
return
|
|
1297
|
+
function kt(e) {
|
|
1298
|
+
let { h: t, a: n } = Et(e);
|
|
1299
|
+
return Tt(t, .95, .65, Math.min(n, St));
|
|
1218
1300
|
}
|
|
1219
|
-
function
|
|
1301
|
+
function At(e) {
|
|
1220
1302
|
return {
|
|
1221
1303
|
...e,
|
|
1222
|
-
fill:
|
|
1223
|
-
stroke: e.stroke ?
|
|
1304
|
+
fill: I(e.fill, Ot),
|
|
1305
|
+
stroke: e.stroke ? Dt(e.stroke) : e.stroke
|
|
1224
1306
|
};
|
|
1225
1307
|
}
|
|
1226
|
-
function
|
|
1308
|
+
function jt(e, t = !1) {
|
|
1227
1309
|
if (!e.stroke) return e;
|
|
1228
|
-
let n = (e.strokeWidth ?? 1) *
|
|
1310
|
+
let n = (e.strokeWidth ?? 1) * Ct;
|
|
1229
1311
|
return {
|
|
1230
|
-
stroke:
|
|
1312
|
+
stroke: kt(e.stroke),
|
|
1231
1313
|
strokeWidth: n,
|
|
1232
1314
|
dash: e.dash,
|
|
1233
1315
|
dashEnabled: e.dashEnabled,
|
|
1234
|
-
alpha: t ?
|
|
1316
|
+
alpha: t ? St : e.alpha
|
|
1235
1317
|
};
|
|
1236
1318
|
}
|
|
1237
|
-
var
|
|
1319
|
+
var Mt = { transform(e) {
|
|
1238
1320
|
switch (e.type) {
|
|
1239
1321
|
case "rect": {
|
|
1240
1322
|
let t = {
|
|
1241
1323
|
...e,
|
|
1242
|
-
paint:
|
|
1324
|
+
paint: At(e.paint)
|
|
1243
1325
|
};
|
|
1244
1326
|
return e.paint.stroke ? [{
|
|
1245
1327
|
...e,
|
|
1246
1328
|
paint: {
|
|
1247
|
-
...
|
|
1329
|
+
...jt(e.paint),
|
|
1248
1330
|
fill: void 0
|
|
1249
1331
|
}
|
|
1250
1332
|
}, t] : t;
|
|
@@ -1252,12 +1334,12 @@ var bt = { transform(e) {
|
|
|
1252
1334
|
case "circle": {
|
|
1253
1335
|
let t = {
|
|
1254
1336
|
...e,
|
|
1255
|
-
paint:
|
|
1337
|
+
paint: At(e.paint)
|
|
1256
1338
|
};
|
|
1257
1339
|
return e.paint.stroke ? [{
|
|
1258
1340
|
...e,
|
|
1259
1341
|
paint: {
|
|
1260
|
-
...
|
|
1342
|
+
...jt(e.paint),
|
|
1261
1343
|
fill: void 0
|
|
1262
1344
|
}
|
|
1263
1345
|
}, t] : t;
|
|
@@ -1267,21 +1349,21 @@ var bt = { transform(e) {
|
|
|
1267
1349
|
...e,
|
|
1268
1350
|
paint: e.paint.stroke ? {
|
|
1269
1351
|
...e.paint,
|
|
1270
|
-
stroke:
|
|
1352
|
+
stroke: Dt(e.paint.stroke)
|
|
1271
1353
|
} : e.paint
|
|
1272
1354
|
};
|
|
1273
1355
|
return e.paint.stroke ? [{
|
|
1274
1356
|
...e,
|
|
1275
|
-
paint:
|
|
1357
|
+
paint: jt(e.paint, !0)
|
|
1276
1358
|
}, t] : t;
|
|
1277
1359
|
}
|
|
1278
1360
|
case "polygon": return {
|
|
1279
1361
|
...e,
|
|
1280
|
-
paint:
|
|
1362
|
+
paint: At(e.paint)
|
|
1281
1363
|
};
|
|
1282
1364
|
case "text": return {
|
|
1283
1365
|
...e,
|
|
1284
|
-
fill:
|
|
1366
|
+
fill: xt
|
|
1285
1367
|
};
|
|
1286
1368
|
case "image":
|
|
1287
1369
|
case "group": return e;
|
|
@@ -1289,16 +1371,16 @@ var bt = { transform(e) {
|
|
|
1289
1371
|
} };
|
|
1290
1372
|
//#endregion
|
|
1291
1373
|
//#region src/style/shape/wobble.ts
|
|
1292
|
-
function
|
|
1374
|
+
function B(e) {
|
|
1293
1375
|
let t = e | 0 || 1;
|
|
1294
1376
|
return () => (t = t * 1664525 + 1013904223 | 0, (t >>> 0) / 4294967296);
|
|
1295
1377
|
}
|
|
1296
|
-
function
|
|
1378
|
+
function V(...e) {
|
|
1297
1379
|
let t = 2654435769;
|
|
1298
1380
|
for (let n of e) t ^= (n * 1e3 | 0) + 2654435769 + (t << 6) + (t >> 2);
|
|
1299
1381
|
return t;
|
|
1300
1382
|
}
|
|
1301
|
-
function
|
|
1383
|
+
function H(e, t, n, r, i, a) {
|
|
1302
1384
|
let o = n - e, s = r - t, c = Math.sqrt(o * o + s * s);
|
|
1303
1385
|
if (c < .001) return [
|
|
1304
1386
|
e,
|
|
@@ -1313,17 +1395,17 @@ function xt(e, t, n, r, i, a) {
|
|
|
1313
1395
|
}
|
|
1314
1396
|
return f.push(n + l * (a() - .5) * i * .3, r + u * (a() - .5) * i * .3), f;
|
|
1315
1397
|
}
|
|
1316
|
-
function
|
|
1398
|
+
function Nt(e, t, n) {
|
|
1317
1399
|
if (e.length < 4) return e;
|
|
1318
1400
|
let r = [];
|
|
1319
1401
|
for (let i = 0; i < e.length - 2; i += 2) {
|
|
1320
|
-
let a =
|
|
1402
|
+
let a = H(e[i], e[i + 1], e[i + 2], e[i + 3], t, n);
|
|
1321
1403
|
if (i === 0) r.push(...a);
|
|
1322
1404
|
else for (let e = 2; e < a.length; e++) r.push(a[e]);
|
|
1323
1405
|
}
|
|
1324
1406
|
return r;
|
|
1325
1407
|
}
|
|
1326
|
-
function
|
|
1408
|
+
function U(e, t, n, r, i, a) {
|
|
1327
1409
|
let o = [
|
|
1328
1410
|
e,
|
|
1329
1411
|
t,
|
|
@@ -1335,12 +1417,12 @@ function V(e, t, n, r, i, a) {
|
|
|
1335
1417
|
t + r
|
|
1336
1418
|
], s = [];
|
|
1337
1419
|
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 =
|
|
1420
|
+
let t = o[e * 2], n = o[e * 2 + 1], r = (e + 1) % 4, c = o[r * 2], l = o[r * 2 + 1], u = H(t, n, c, l, i, a);
|
|
1339
1421
|
for (let e = 0; e < u.length - 2; e++) s.push(u[e]);
|
|
1340
1422
|
}
|
|
1341
1423
|
return s;
|
|
1342
1424
|
}
|
|
1343
|
-
function
|
|
1425
|
+
function Pt(e, t, n, r, i) {
|
|
1344
1426
|
let a = [];
|
|
1345
1427
|
for (let o = 0; o < 24; o++) {
|
|
1346
1428
|
let s = o / 24 * Math.PI * 2, c = n + (i() - .5) * 2 * r;
|
|
@@ -1348,31 +1430,31 @@ function Ct(e, t, n, r, i) {
|
|
|
1348
1430
|
}
|
|
1349
1431
|
return a;
|
|
1350
1432
|
}
|
|
1351
|
-
function
|
|
1433
|
+
function Ft(e, t, n) {
|
|
1352
1434
|
let r = e.length / 2;
|
|
1353
1435
|
if (r < 2) return e;
|
|
1354
1436
|
let i = [];
|
|
1355
1437
|
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 =
|
|
1438
|
+
let o = e[a * 2], s = e[a * 2 + 1], c = (a + 1) % r, l = e[c * 2], u = e[c * 2 + 1], d = H(o, s, l, u, t, n);
|
|
1357
1439
|
for (let e = 0; e < d.length - 2; e++) i.push(d[e]);
|
|
1358
1440
|
}
|
|
1359
1441
|
return i;
|
|
1360
1442
|
}
|
|
1361
1443
|
//#endregion
|
|
1362
1444
|
//#region src/style/shape/SketchyStyle.ts
|
|
1363
|
-
function
|
|
1445
|
+
function It(e, t) {
|
|
1364
1446
|
if (!t) return e;
|
|
1365
1447
|
let n = t.match(/^rgba\(.+,\s*([\d.]+)\s*\)$/);
|
|
1366
1448
|
if (!n) return e;
|
|
1367
1449
|
let r = parseFloat(n[1]);
|
|
1368
1450
|
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
1451
|
}
|
|
1370
|
-
function
|
|
1452
|
+
function Lt(e) {
|
|
1371
1453
|
let { jitter: t, color: n } = e;
|
|
1372
1454
|
return { transform(e) {
|
|
1373
1455
|
switch (e.type) {
|
|
1374
1456
|
case "rect": {
|
|
1375
|
-
let r =
|
|
1457
|
+
let r = B(V(e.x, e.y, e.width, e.height)), i = e.paint.fill ? "#ffffff" : void 0, a = e.paint.stroke ? n : void 0;
|
|
1376
1458
|
if (e.cornerRadius && e.cornerRadius > 0) {
|
|
1377
1459
|
let n = [];
|
|
1378
1460
|
if (i && n.push({
|
|
@@ -1385,7 +1467,7 @@ function Tt(e) {
|
|
|
1385
1467
|
}), a && e.paint.strokeWidth) {
|
|
1386
1468
|
let i = {
|
|
1387
1469
|
type: "polygon",
|
|
1388
|
-
vertices:
|
|
1470
|
+
vertices: U(e.x, e.y, e.width, e.height, t, r),
|
|
1389
1471
|
paint: {
|
|
1390
1472
|
stroke: a,
|
|
1391
1473
|
strokeWidth: e.paint.strokeWidth
|
|
@@ -1400,7 +1482,7 @@ function Tt(e) {
|
|
|
1400
1482
|
}
|
|
1401
1483
|
return {
|
|
1402
1484
|
type: "polygon",
|
|
1403
|
-
vertices:
|
|
1485
|
+
vertices: U(e.x, e.y, e.width, e.height, t, r),
|
|
1404
1486
|
paint: {
|
|
1405
1487
|
fill: i,
|
|
1406
1488
|
stroke: a,
|
|
@@ -1412,10 +1494,10 @@ function Tt(e) {
|
|
|
1412
1494
|
};
|
|
1413
1495
|
}
|
|
1414
1496
|
case "circle": {
|
|
1415
|
-
let r =
|
|
1497
|
+
let r = B(V(e.cx, e.cy, e.radius));
|
|
1416
1498
|
return {
|
|
1417
1499
|
type: "polygon",
|
|
1418
|
-
vertices:
|
|
1500
|
+
vertices: Pt(e.cx, e.cy, e.radius, t, r),
|
|
1419
1501
|
paint: {
|
|
1420
1502
|
fill: e.paint.fill ? "#ffffff" : void 0,
|
|
1421
1503
|
stroke: e.paint.stroke ? n : void 0,
|
|
@@ -1427,7 +1509,7 @@ function Tt(e) {
|
|
|
1427
1509
|
};
|
|
1428
1510
|
}
|
|
1429
1511
|
case "line": {
|
|
1430
|
-
let r =
|
|
1512
|
+
let r = B(V(...e.points.slice(0, 4))), i = Nt(e.points, t, r), a = It(n, e.paint.stroke), o = {
|
|
1431
1513
|
...e.paint,
|
|
1432
1514
|
stroke: a
|
|
1433
1515
|
};
|
|
@@ -1438,7 +1520,7 @@ function Tt(e) {
|
|
|
1438
1520
|
};
|
|
1439
1521
|
}
|
|
1440
1522
|
case "polygon": {
|
|
1441
|
-
let r =
|
|
1523
|
+
let r = B(V(...e.vertices.slice(0, 4))), i = Ft(e.vertices, t, r);
|
|
1442
1524
|
return {
|
|
1443
1525
|
...e,
|
|
1444
1526
|
vertices: i,
|
|
@@ -1460,10 +1542,10 @@ function Tt(e) {
|
|
|
1460
1542
|
}
|
|
1461
1543
|
//#endregion
|
|
1462
1544
|
//#region src/style/shape/IsometricStyle.ts
|
|
1463
|
-
function U(e, t) {
|
|
1464
|
-
return P(e, (e) => v(e, t));
|
|
1465
|
-
}
|
|
1466
1545
|
function W(e, t) {
|
|
1546
|
+
return I(e, (e) => _(e, t));
|
|
1547
|
+
}
|
|
1548
|
+
function G(e, t) {
|
|
1467
1549
|
if (!t || typeof t == "string") return t;
|
|
1468
1550
|
if (t.type === "linear") {
|
|
1469
1551
|
let [n, r] = e(t.x0, t.y0), [i, a] = e(t.x1, t.y1);
|
|
@@ -1486,16 +1568,16 @@ function W(e, t) {
|
|
|
1486
1568
|
}
|
|
1487
1569
|
return i;
|
|
1488
1570
|
}
|
|
1489
|
-
function
|
|
1571
|
+
function Rt(e) {
|
|
1490
1572
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1491
1573
|
return (e, t) => [e * n - t * r, (e * r + t * n) * .5];
|
|
1492
1574
|
}
|
|
1493
|
-
function
|
|
1575
|
+
function zt(e) {
|
|
1494
1576
|
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
1495
1577
|
return (e, t) => [e * n + 2 * t * r, -e * r + 2 * t * n];
|
|
1496
1578
|
}
|
|
1497
|
-
var
|
|
1498
|
-
function
|
|
1579
|
+
var K = 32;
|
|
1580
|
+
function Bt(e, t) {
|
|
1499
1581
|
let n = Array(t.length);
|
|
1500
1582
|
for (let r = 0; r < t.length; r += 2) {
|
|
1501
1583
|
let [i, a] = e(t[r], t[r + 1]);
|
|
@@ -1503,7 +1585,7 @@ function Ot(e, t) {
|
|
|
1503
1585
|
}
|
|
1504
1586
|
return n;
|
|
1505
1587
|
}
|
|
1506
|
-
function
|
|
1588
|
+
function Vt(e, t, n, r, i) {
|
|
1507
1589
|
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
1590
|
return [
|
|
1509
1591
|
a,
|
|
@@ -1516,8 +1598,8 @@ function kt(e, t, n, r, i) {
|
|
|
1516
1598
|
f
|
|
1517
1599
|
];
|
|
1518
1600
|
}
|
|
1519
|
-
function
|
|
1520
|
-
let t = e.rotation ?? 0, n = e.depth ?? .18, r =
|
|
1601
|
+
function Ht(e = {}) {
|
|
1602
|
+
let t = e.rotation ?? 0, n = e.depth ?? .18, r = Rt(t), i = zt(t);
|
|
1521
1603
|
function a(e, t, n, i) {
|
|
1522
1604
|
let [a, o] = r(e, t), [s, c] = r(e + n, t), [l, u] = r(e, t + i);
|
|
1523
1605
|
return [
|
|
@@ -1530,7 +1612,7 @@ function At(e = {}) {
|
|
|
1530
1612
|
];
|
|
1531
1613
|
}
|
|
1532
1614
|
function o(e) {
|
|
1533
|
-
let { x: t, y: i, width: a, height: o, paint: s } = e, c =
|
|
1615
|
+
let { x: t, y: i, width: a, height: o, paint: s } = e, c = Vt(r, t, i, a, o);
|
|
1534
1616
|
if (s.dash || s.dashEnabled) {
|
|
1535
1617
|
let t = [];
|
|
1536
1618
|
for (let n = 0; n < 8; n += 2) {
|
|
@@ -1556,7 +1638,7 @@ function At(e = {}) {
|
|
|
1556
1638
|
if (n > 0 && s.fill) {
|
|
1557
1639
|
let t = [], i = 0;
|
|
1558
1640
|
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 =
|
|
1641
|
+
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 = G(r, s.fill);
|
|
1560
1642
|
if (t.push({
|
|
1561
1643
|
type: "polygon",
|
|
1562
1644
|
vertices: [
|
|
@@ -1569,7 +1651,7 @@ function At(e = {}) {
|
|
|
1569
1651
|
u,
|
|
1570
1652
|
d + n
|
|
1571
1653
|
],
|
|
1572
|
-
paint: { fill:
|
|
1654
|
+
paint: { fill: W(v, .2) },
|
|
1573
1655
|
layer: e.layer
|
|
1574
1656
|
}), t.push({
|
|
1575
1657
|
type: "polygon",
|
|
@@ -1583,7 +1665,7 @@ function At(e = {}) {
|
|
|
1583
1665
|
a,
|
|
1584
1666
|
o + n
|
|
1585
1667
|
],
|
|
1586
|
-
paint: { fill:
|
|
1668
|
+
paint: { fill: W(v, .4) },
|
|
1587
1669
|
layer: e.layer
|
|
1588
1670
|
}), t.push({
|
|
1589
1671
|
type: "polygon",
|
|
@@ -1639,7 +1721,7 @@ function At(e = {}) {
|
|
|
1639
1721
|
type: "polygon",
|
|
1640
1722
|
vertices: c,
|
|
1641
1723
|
paint: {
|
|
1642
|
-
fill:
|
|
1724
|
+
fill: G(r, s.fill),
|
|
1643
1725
|
stroke: s.stroke,
|
|
1644
1726
|
strokeWidth: s.strokeWidth
|
|
1645
1727
|
},
|
|
@@ -1649,15 +1731,15 @@ function At(e = {}) {
|
|
|
1649
1731
|
};
|
|
1650
1732
|
}
|
|
1651
1733
|
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 /
|
|
1734
|
+
let { cx: t, cy: i, radius: a, paint: o } = e, s = Array(K * 2);
|
|
1735
|
+
for (let e = 0; e < K; e++) {
|
|
1736
|
+
let n = e / K * Math.PI * 2, [o, c] = r(t + Math.cos(n) * a, i + Math.sin(n) * a);
|
|
1655
1737
|
s[e * 2] = o, s[e * 2 + 1] = c;
|
|
1656
1738
|
}
|
|
1657
1739
|
if (o.dash || o.dashEnabled) {
|
|
1658
1740
|
let t = [];
|
|
1659
|
-
for (let n = 0; n <
|
|
1660
|
-
let r = (n + 1) %
|
|
1741
|
+
for (let n = 0; n < K; n++) {
|
|
1742
|
+
let r = (n + 1) % K;
|
|
1661
1743
|
t.push({
|
|
1662
1744
|
type: "line",
|
|
1663
1745
|
points: [
|
|
@@ -1676,18 +1758,18 @@ function At(e = {}) {
|
|
|
1676
1758
|
}
|
|
1677
1759
|
return t;
|
|
1678
1760
|
}
|
|
1679
|
-
let c = [], l =
|
|
1761
|
+
let c = [], l = G(r, o.fill);
|
|
1680
1762
|
if (n > 0 && o.fill) {
|
|
1681
1763
|
let t = 0, r = 0, i = 0, a = -Infinity, u = Infinity, d = -Infinity;
|
|
1682
|
-
for (let e = 0; e <
|
|
1764
|
+
for (let e = 0; e < K; 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
1765
|
let f = [], p = t;
|
|
1684
|
-
for (let e = 0; e <=
|
|
1766
|
+
for (let e = 0; e <= K && (f.push(s[p * 2], s[p * 2 + 1]), p !== i); e++) p = (p + 1) % K;
|
|
1685
1767
|
for (let e = f.length - 2; e >= 0; e -= 2) f.push(f[e], f[e + 1] + n);
|
|
1686
1768
|
c.push({
|
|
1687
1769
|
type: "polygon",
|
|
1688
1770
|
vertices: f,
|
|
1689
1771
|
paint: {
|
|
1690
|
-
fill:
|
|
1772
|
+
fill: W(l, .2),
|
|
1691
1773
|
stroke: o.stroke,
|
|
1692
1774
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
1693
1775
|
},
|
|
@@ -1695,13 +1777,13 @@ function At(e = {}) {
|
|
|
1695
1777
|
});
|
|
1696
1778
|
let m = [];
|
|
1697
1779
|
p = i;
|
|
1698
|
-
for (let e = 0; e <=
|
|
1780
|
+
for (let e = 0; e <= K && (m.push(s[p * 2], s[p * 2 + 1]), p !== r); e++) p = (p + 1) % K;
|
|
1699
1781
|
for (let e = m.length - 2; e >= 0; e -= 2) m.push(m[e], m[e + 1] + n);
|
|
1700
1782
|
c.push({
|
|
1701
1783
|
type: "polygon",
|
|
1702
1784
|
vertices: m,
|
|
1703
1785
|
paint: {
|
|
1704
|
-
fill:
|
|
1786
|
+
fill: W(l, .4),
|
|
1705
1787
|
stroke: o.stroke,
|
|
1706
1788
|
strokeWidth: o.strokeWidth ? o.strokeWidth * .5 : void 0
|
|
1707
1789
|
},
|
|
@@ -1729,14 +1811,14 @@ function At(e = {}) {
|
|
|
1729
1811
|
case "circle": return s(e);
|
|
1730
1812
|
case "line": return {
|
|
1731
1813
|
...e,
|
|
1732
|
-
points:
|
|
1814
|
+
points: Bt(r, e.points)
|
|
1733
1815
|
};
|
|
1734
1816
|
case "polygon": return {
|
|
1735
1817
|
...e,
|
|
1736
|
-
vertices:
|
|
1818
|
+
vertices: Bt(r, e.vertices),
|
|
1737
1819
|
paint: {
|
|
1738
1820
|
...e.paint,
|
|
1739
|
-
fill:
|
|
1821
|
+
fill: G(r, e.paint.fill)
|
|
1740
1822
|
}
|
|
1741
1823
|
};
|
|
1742
1824
|
case "text": {
|
|
@@ -1801,21 +1883,21 @@ function At(e = {}) {
|
|
|
1801
1883
|
}
|
|
1802
1884
|
//#endregion
|
|
1803
1885
|
//#region src/style/shape/ConstructionStyle.ts
|
|
1804
|
-
var
|
|
1805
|
-
function
|
|
1806
|
-
let t =
|
|
1807
|
-
if (!t) return
|
|
1808
|
-
let n =
|
|
1809
|
-
return
|
|
1886
|
+
var q = "#1a1a1a", Ut = "#ffc200", Wt = "#ff6600", Gt = 26, Kt = 26, qt = 26, Jt = 255, Yt = 194, Xt = 0;
|
|
1887
|
+
function Zt(e) {
|
|
1888
|
+
let t = L(e);
|
|
1889
|
+
if (!t) return R(Jt, Yt, Xt);
|
|
1890
|
+
let n = z(t);
|
|
1891
|
+
return R(Math.round(Gt + (Jt - Gt) * n), Math.round(Kt + (Yt - Kt) * n), Math.round(qt + (Xt - qt) * n), t.a);
|
|
1810
1892
|
}
|
|
1811
|
-
function
|
|
1893
|
+
function Qt(e) {
|
|
1812
1894
|
return {
|
|
1813
1895
|
...e,
|
|
1814
|
-
fill:
|
|
1815
|
-
stroke: e.stroke ?
|
|
1896
|
+
fill: I(e.fill, Zt),
|
|
1897
|
+
stroke: e.stroke ? q : e.stroke
|
|
1816
1898
|
};
|
|
1817
1899
|
}
|
|
1818
|
-
function
|
|
1900
|
+
function $t(e, t, n, r) {
|
|
1819
1901
|
let i = [], a = e.length;
|
|
1820
1902
|
for (let o = 0; o < a; o++) {
|
|
1821
1903
|
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 +1908,7 @@ function Vt(e, t, n, r) {
|
|
|
1826
1908
|
}
|
|
1827
1909
|
return i;
|
|
1828
1910
|
}
|
|
1829
|
-
function
|
|
1911
|
+
function en(e, t, n, r, i) {
|
|
1830
1912
|
let a = [
|
|
1831
1913
|
[e, t],
|
|
1832
1914
|
[e + n, t],
|
|
@@ -1834,37 +1916,37 @@ function Ht(e, t, n, r, i) {
|
|
|
1834
1916
|
[e, t + r]
|
|
1835
1917
|
], 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
1918
|
for (let e = u; e <= d; e++) {
|
|
1837
|
-
let t = e * o, n = t + s, r =
|
|
1838
|
-
r =
|
|
1919
|
+
let t = e * o, n = t + s, r = $t(a, 1, 1, t);
|
|
1920
|
+
r = $t(r, -1, -1, -n), r.length >= 3 && f.push(r.flatMap((e) => [e[0], e[1]]));
|
|
1839
1921
|
}
|
|
1840
1922
|
return f;
|
|
1841
1923
|
}
|
|
1842
|
-
var
|
|
1924
|
+
var tn = { transform(e, t) {
|
|
1843
1925
|
switch (e.type) {
|
|
1844
1926
|
case "rect": {
|
|
1845
1927
|
if (!e.paint.fill) return {
|
|
1846
1928
|
...e,
|
|
1847
|
-
paint:
|
|
1929
|
+
paint: Qt(e.paint)
|
|
1848
1930
|
};
|
|
1849
1931
|
let n = {
|
|
1850
1932
|
...e,
|
|
1851
1933
|
paint: {
|
|
1852
|
-
fill:
|
|
1934
|
+
fill: q,
|
|
1853
1935
|
strokeWidth: e.paint.strokeWidth
|
|
1854
1936
|
}
|
|
1855
|
-
}, r =
|
|
1937
|
+
}, r = en(e.x, e.y, e.width, e.height, t.roomSize).map((t) => ({
|
|
1856
1938
|
type: "polygon",
|
|
1857
1939
|
vertices: t,
|
|
1858
1940
|
layer: e.layer,
|
|
1859
1941
|
paint: {
|
|
1860
|
-
fill:
|
|
1942
|
+
fill: Ut,
|
|
1861
1943
|
alpha: .65
|
|
1862
1944
|
}
|
|
1863
1945
|
})), i = {
|
|
1864
1946
|
...e,
|
|
1865
1947
|
hit: void 0,
|
|
1866
1948
|
paint: {
|
|
1867
|
-
stroke:
|
|
1949
|
+
stroke: q,
|
|
1868
1950
|
strokeWidth: e.paint.strokeWidth
|
|
1869
1951
|
}
|
|
1870
1952
|
};
|
|
@@ -1876,38 +1958,38 @@ var Ut = { transform(e, t) {
|
|
|
1876
1958
|
}
|
|
1877
1959
|
case "circle": return {
|
|
1878
1960
|
...e,
|
|
1879
|
-
paint:
|
|
1961
|
+
paint: Qt(e.paint)
|
|
1880
1962
|
};
|
|
1881
1963
|
case "polygon": return {
|
|
1882
1964
|
...e,
|
|
1883
1965
|
paint: {
|
|
1884
1966
|
...e.paint,
|
|
1885
|
-
fill: e.paint.fill ?
|
|
1886
|
-
stroke: e.paint.stroke ?
|
|
1967
|
+
fill: e.paint.fill ? Wt : e.paint.fill,
|
|
1968
|
+
stroke: e.paint.stroke ? q : e.paint.stroke
|
|
1887
1969
|
}
|
|
1888
1970
|
};
|
|
1889
1971
|
case "line": return {
|
|
1890
1972
|
...e,
|
|
1891
1973
|
paint: e.paint.stroke ? {
|
|
1892
1974
|
...e.paint,
|
|
1893
|
-
stroke:
|
|
1975
|
+
stroke: Wt
|
|
1894
1976
|
} : e.paint
|
|
1895
1977
|
};
|
|
1896
1978
|
case "text": return {
|
|
1897
1979
|
...e,
|
|
1898
|
-
fill:
|
|
1899
|
-
stroke:
|
|
1980
|
+
fill: Wt,
|
|
1981
|
+
stroke: q,
|
|
1900
1982
|
strokeWidth: t.roomSize * .25
|
|
1901
1983
|
};
|
|
1902
1984
|
case "image":
|
|
1903
1985
|
case "group": return e;
|
|
1904
1986
|
}
|
|
1905
|
-
} },
|
|
1906
|
-
function
|
|
1987
|
+
} }, nn = "#c8eeff", rn = "#00c8ff", an = "#00ffaa", on = .2, sn = 5, cn = 190;
|
|
1988
|
+
function ln(e, t, n) {
|
|
1907
1989
|
e /= 255, t /= 255, n /= 255;
|
|
1908
1990
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2;
|
|
1909
1991
|
if (r === i) return [
|
|
1910
|
-
|
|
1992
|
+
cn,
|
|
1911
1993
|
0,
|
|
1912
1994
|
a
|
|
1913
1995
|
];
|
|
@@ -1918,54 +2000,54 @@ function Yt(e, t, n) {
|
|
|
1918
2000
|
a
|
|
1919
2001
|
];
|
|
1920
2002
|
}
|
|
1921
|
-
function
|
|
2003
|
+
function un(e, t, n, r = 1) {
|
|
1922
2004
|
e = (e % 360 + 360) % 360;
|
|
1923
2005
|
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
2006
|
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
2007
|
let u = Math.round((s + o) * 255), d = Math.round((c + o) * 255), f = Math.round((l + o) * 255);
|
|
1926
2008
|
return r < 1 ? `rgba(${u},${d},${f},${r})` : `rgb(${u},${d},${f})`;
|
|
1927
2009
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let t =
|
|
1930
|
-
if (!t) return
|
|
1931
|
-
let [n, r] =
|
|
1932
|
-
return
|
|
2010
|
+
function dn(e) {
|
|
2011
|
+
let t = L(e);
|
|
2012
|
+
if (!t) return un(cn, .55, .18);
|
|
2013
|
+
let [n, r] = ln(t.r, t.g, t.b);
|
|
2014
|
+
return un(r < .08 ? cn : n, .55, .18, t.a);
|
|
1933
2015
|
}
|
|
1934
|
-
function
|
|
2016
|
+
function fn(e) {
|
|
1935
2017
|
return {
|
|
1936
2018
|
...e,
|
|
1937
|
-
fill:
|
|
1938
|
-
stroke: e.stroke ?
|
|
2019
|
+
fill: I(e.fill, dn),
|
|
2020
|
+
stroke: e.stroke ? rn : e.stroke
|
|
1939
2021
|
};
|
|
1940
2022
|
}
|
|
1941
|
-
function
|
|
2023
|
+
function pn(e) {
|
|
1942
2024
|
return {
|
|
1943
|
-
stroke:
|
|
1944
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
1945
|
-
alpha:
|
|
2025
|
+
stroke: rn,
|
|
2026
|
+
strokeWidth: (e.strokeWidth ?? 1) * sn,
|
|
2027
|
+
alpha: on
|
|
1946
2028
|
};
|
|
1947
2029
|
}
|
|
1948
|
-
function
|
|
2030
|
+
function mn(e) {
|
|
1949
2031
|
return {
|
|
1950
|
-
stroke:
|
|
1951
|
-
strokeWidth: (e.strokeWidth ?? 1) *
|
|
1952
|
-
alpha:
|
|
2032
|
+
stroke: an,
|
|
2033
|
+
strokeWidth: (e.strokeWidth ?? 1) * sn,
|
|
2034
|
+
alpha: on,
|
|
1953
2035
|
dash: e.dash,
|
|
1954
2036
|
dashEnabled: e.dashEnabled
|
|
1955
2037
|
};
|
|
1956
2038
|
}
|
|
1957
|
-
var
|
|
2039
|
+
var hn = { transform(e) {
|
|
1958
2040
|
switch (e.type) {
|
|
1959
2041
|
case "rect": {
|
|
1960
2042
|
let t = {
|
|
1961
2043
|
...e,
|
|
1962
|
-
paint:
|
|
2044
|
+
paint: fn(e.paint)
|
|
1963
2045
|
};
|
|
1964
2046
|
return e.paint.stroke ? [{
|
|
1965
2047
|
...e,
|
|
1966
2048
|
hit: void 0,
|
|
1967
2049
|
paint: {
|
|
1968
|
-
|
|
2050
|
+
...pn(e.paint),
|
|
1969
2051
|
fill: void 0
|
|
1970
2052
|
}
|
|
1971
2053
|
}, t] : t;
|
|
@@ -1973,13 +2055,13 @@ var tn = { transform(e) {
|
|
|
1973
2055
|
case "circle": {
|
|
1974
2056
|
let t = {
|
|
1975
2057
|
...e,
|
|
1976
|
-
paint:
|
|
2058
|
+
paint: fn(e.paint)
|
|
1977
2059
|
};
|
|
1978
2060
|
return e.paint.stroke ? [{
|
|
1979
2061
|
...e,
|
|
1980
2062
|
hit: void 0,
|
|
1981
2063
|
paint: {
|
|
1982
|
-
|
|
2064
|
+
...pn(e.paint),
|
|
1983
2065
|
fill: void 0
|
|
1984
2066
|
}
|
|
1985
2067
|
}, t] : t;
|
|
@@ -1996,37 +2078,37 @@ var tn = { transform(e) {
|
|
|
1996
2078
|
...e,
|
|
1997
2079
|
paint: e.paint.stroke ? {
|
|
1998
2080
|
...e.paint,
|
|
1999
|
-
stroke:
|
|
2081
|
+
stroke: an
|
|
2000
2082
|
} : e.paint
|
|
2001
2083
|
};
|
|
2002
2084
|
return e.paint.stroke ? [{
|
|
2003
2085
|
...e,
|
|
2004
2086
|
hit: void 0,
|
|
2005
|
-
paint:
|
|
2087
|
+
paint: mn(e.paint)
|
|
2006
2088
|
}, t] : t;
|
|
2007
2089
|
}
|
|
2008
2090
|
case "polygon": return {
|
|
2009
2091
|
...e,
|
|
2010
2092
|
paint: {
|
|
2011
2093
|
...e.paint,
|
|
2012
|
-
fill: e.paint.fill ?
|
|
2094
|
+
fill: e.paint.fill ? an : e.paint.fill,
|
|
2013
2095
|
stroke: void 0
|
|
2014
2096
|
}
|
|
2015
2097
|
};
|
|
2016
2098
|
case "text": return {
|
|
2017
2099
|
...e,
|
|
2018
|
-
fill:
|
|
2100
|
+
fill: nn
|
|
2019
2101
|
};
|
|
2020
2102
|
case "image":
|
|
2021
2103
|
case "group": return e;
|
|
2022
2104
|
}
|
|
2023
|
-
} },
|
|
2105
|
+
} }, gn = {
|
|
2024
2106
|
lighten: .35,
|
|
2025
2107
|
darken: .25
|
|
2026
2108
|
};
|
|
2027
|
-
function
|
|
2028
|
-
let t = e.lighten ??
|
|
2029
|
-
function r(e, r, i,
|
|
2109
|
+
function _n(e = {}) {
|
|
2110
|
+
let t = e.lighten ?? gn.lighten, n = e.darken ?? gn.darken;
|
|
2111
|
+
function r(e, r, i, a, s) {
|
|
2030
2112
|
let c = e.fill;
|
|
2031
2113
|
if (typeof c != "string") return e;
|
|
2032
2114
|
let l = {
|
|
@@ -2037,10 +2119,10 @@ function rn(e = {}) {
|
|
|
2037
2119
|
y1: i + s,
|
|
2038
2120
|
stops: [{
|
|
2039
2121
|
offset: 0,
|
|
2040
|
-
color:
|
|
2122
|
+
color: o(c, t)
|
|
2041
2123
|
}, {
|
|
2042
2124
|
offset: 1,
|
|
2043
|
-
color:
|
|
2125
|
+
color: _(c, n)
|
|
2044
2126
|
}]
|
|
2045
2127
|
};
|
|
2046
2128
|
return {
|
|
@@ -2076,124 +2158,124 @@ function rn(e = {}) {
|
|
|
2076
2158
|
}
|
|
2077
2159
|
//#endregion
|
|
2078
2160
|
//#region src/style/shape/StainedGlassStyle.ts
|
|
2079
|
-
var
|
|
2080
|
-
function
|
|
2081
|
-
let t =
|
|
2161
|
+
var vn = "#0a0a0a", yn = "#f4f0e0", bn = .6, xn = .4, Sn = .62, Cn = 2.2, wn = .06;
|
|
2162
|
+
function Tn(e) {
|
|
2163
|
+
let t = L(e);
|
|
2082
2164
|
if (!t) return e;
|
|
2083
|
-
let [n, r, i] =
|
|
2084
|
-
return
|
|
2165
|
+
let [n, r, i] = Ye(t.r, t.g, t.b);
|
|
2166
|
+
return Xe(n, r < .08 ? r : Math.max(r, bn), Math.min(Sn, Math.max(xn, i)), t.a);
|
|
2085
2167
|
}
|
|
2086
|
-
function
|
|
2087
|
-
return Math.max((e ?? .04) *
|
|
2168
|
+
function En(e) {
|
|
2169
|
+
return Math.max((e ?? .04) * Cn, wn);
|
|
2088
2170
|
}
|
|
2089
|
-
function
|
|
2090
|
-
let t =
|
|
2171
|
+
function Dn(e) {
|
|
2172
|
+
let t = I(e.fill, Tn), n = t !== void 0 || e.stroke !== void 0;
|
|
2091
2173
|
return {
|
|
2092
2174
|
...e,
|
|
2093
2175
|
fill: t,
|
|
2094
|
-
stroke: n ?
|
|
2095
|
-
strokeWidth: n ?
|
|
2176
|
+
stroke: n ? vn : void 0,
|
|
2177
|
+
strokeWidth: n ? En(e.strokeWidth) : e.strokeWidth,
|
|
2096
2178
|
dash: void 0,
|
|
2097
2179
|
dashEnabled: void 0
|
|
2098
2180
|
};
|
|
2099
2181
|
}
|
|
2100
|
-
var
|
|
2182
|
+
var On = { transform(e) {
|
|
2101
2183
|
switch (e.type) {
|
|
2102
2184
|
case "rect":
|
|
2103
2185
|
case "circle":
|
|
2104
2186
|
case "polygon": return {
|
|
2105
2187
|
...e,
|
|
2106
|
-
paint:
|
|
2188
|
+
paint: Dn(e.paint)
|
|
2107
2189
|
};
|
|
2108
2190
|
case "line": return {
|
|
2109
2191
|
...e,
|
|
2110
2192
|
paint: e.paint.stroke ? {
|
|
2111
2193
|
...e.paint,
|
|
2112
|
-
stroke:
|
|
2113
|
-
strokeWidth:
|
|
2194
|
+
stroke: vn,
|
|
2195
|
+
strokeWidth: En(e.paint.strokeWidth)
|
|
2114
2196
|
} : e.paint
|
|
2115
2197
|
};
|
|
2116
2198
|
case "text": return {
|
|
2117
2199
|
...e,
|
|
2118
|
-
fill:
|
|
2200
|
+
fill: yn
|
|
2119
2201
|
};
|
|
2120
2202
|
case "image":
|
|
2121
2203
|
case "group": return e;
|
|
2122
2204
|
}
|
|
2123
|
-
} },
|
|
2124
|
-
function
|
|
2125
|
-
let t =
|
|
2126
|
-
if (!t) return
|
|
2127
|
-
let n =
|
|
2128
|
-
return
|
|
2205
|
+
} }, kn = "#1c3f6e", An = 1.4, jn = .05, Mn = 198, Nn = 212, Pn = 230, Fn = 248, In = 250, Ln = 255;
|
|
2206
|
+
function Rn(e) {
|
|
2207
|
+
let t = L(e);
|
|
2208
|
+
if (!t) return R(Fn, In, Ln);
|
|
2209
|
+
let n = z(t);
|
|
2210
|
+
return R(Math.round(Mn + (Fn - Mn) * n), Math.round(Nn + (In - Nn) * n), Math.round(Pn + (Ln - Pn) * n), t.a);
|
|
2129
2211
|
}
|
|
2130
|
-
function
|
|
2131
|
-
let t =
|
|
2132
|
-
if (!t || t.a >= 1) return
|
|
2133
|
-
let n =
|
|
2134
|
-
return
|
|
2212
|
+
function zn(e) {
|
|
2213
|
+
let t = L(e);
|
|
2214
|
+
if (!t || t.a >= 1) return kn;
|
|
2215
|
+
let n = L(kn);
|
|
2216
|
+
return R(n.r, n.g, n.b, t.a);
|
|
2135
2217
|
}
|
|
2136
|
-
function
|
|
2137
|
-
return Math.max((e ?? .04) *
|
|
2218
|
+
function Bn(e) {
|
|
2219
|
+
return Math.max((e ?? .04) * An, jn);
|
|
2138
2220
|
}
|
|
2139
|
-
function
|
|
2221
|
+
function Vn(e) {
|
|
2140
2222
|
return {
|
|
2141
2223
|
...e,
|
|
2142
|
-
fill:
|
|
2143
|
-
stroke: e.stroke ?
|
|
2144
|
-
strokeWidth: e.stroke ?
|
|
2224
|
+
fill: I(e.fill, Rn),
|
|
2225
|
+
stroke: e.stroke ? zn(e.stroke) : e.stroke,
|
|
2226
|
+
strokeWidth: e.stroke ? Bn(e.strokeWidth) : e.strokeWidth
|
|
2145
2227
|
};
|
|
2146
2228
|
}
|
|
2147
|
-
var
|
|
2229
|
+
var Hn = { transform(e) {
|
|
2148
2230
|
switch (e.type) {
|
|
2149
2231
|
case "rect":
|
|
2150
2232
|
case "circle":
|
|
2151
2233
|
case "polygon": return {
|
|
2152
2234
|
...e,
|
|
2153
|
-
paint:
|
|
2235
|
+
paint: Vn(e.paint)
|
|
2154
2236
|
};
|
|
2155
2237
|
case "line": return e.paint.stroke ? {
|
|
2156
2238
|
...e,
|
|
2157
2239
|
paint: {
|
|
2158
2240
|
...e.paint,
|
|
2159
|
-
stroke:
|
|
2160
|
-
strokeWidth: e.grid ? e.paint.strokeWidth :
|
|
2241
|
+
stroke: zn(e.paint.stroke),
|
|
2242
|
+
strokeWidth: e.grid ? e.paint.strokeWidth : Bn(e.paint.strokeWidth)
|
|
2161
2243
|
}
|
|
2162
2244
|
} : e;
|
|
2163
2245
|
case "text": return {
|
|
2164
2246
|
...e,
|
|
2165
|
-
fill:
|
|
2247
|
+
fill: kn
|
|
2166
2248
|
};
|
|
2167
2249
|
case "image":
|
|
2168
2250
|
case "group": return e;
|
|
2169
2251
|
}
|
|
2170
|
-
} },
|
|
2171
|
-
function
|
|
2172
|
-
let t =
|
|
2173
|
-
if (!t) return
|
|
2174
|
-
let n =
|
|
2175
|
-
return
|
|
2252
|
+
} }, Un = "#7a6a48", Wn = "#8a7a55", Gn = "#4a3f28", Kn = 78, qn = 93, Jn = 52, Yn = 221, Xn = 207, Zn = 166, Qn = 2, $n = .26, er = .02;
|
|
2253
|
+
function tr(e) {
|
|
2254
|
+
let t = L(e);
|
|
2255
|
+
if (!t) return R(Yn, Xn, Zn);
|
|
2256
|
+
let n = z(t);
|
|
2257
|
+
return R(Math.round(Kn + (Yn - Kn) * n), Math.round(qn + (Xn - qn) * n), Math.round(Jn + (Zn - Jn) * n), t.a);
|
|
2176
2258
|
}
|
|
2177
|
-
function
|
|
2259
|
+
function nr(e) {
|
|
2178
2260
|
return {
|
|
2179
2261
|
...e,
|
|
2180
|
-
fill:
|
|
2181
|
-
stroke: e.stroke ?
|
|
2262
|
+
fill: I(e.fill, tr),
|
|
2263
|
+
stroke: e.stroke ? Un : e.stroke
|
|
2182
2264
|
};
|
|
2183
2265
|
}
|
|
2184
|
-
var
|
|
2185
|
-
stroke:
|
|
2186
|
-
strokeWidth:
|
|
2187
|
-
},
|
|
2266
|
+
var rr = {
|
|
2267
|
+
stroke: Un,
|
|
2268
|
+
strokeWidth: er
|
|
2269
|
+
}, ir = { transform(e) {
|
|
2188
2270
|
switch (e.type) {
|
|
2189
2271
|
case "rect": {
|
|
2190
2272
|
let t = {
|
|
2191
2273
|
...e,
|
|
2192
|
-
paint:
|
|
2274
|
+
paint: nr(e.paint)
|
|
2193
2275
|
};
|
|
2194
2276
|
if (!e.paint.fill) return t;
|
|
2195
|
-
let n = [t], r = Math.min(e.width, e.height) / 2 *
|
|
2196
|
-
for (let t = 1; t <=
|
|
2277
|
+
let n = [t], r = Math.min(e.width, e.height) / 2 * $n, i = Math.min(e.width, e.height) * .12;
|
|
2278
|
+
for (let t = 1; t <= Qn; t++) {
|
|
2197
2279
|
let a = r * t, o = e.width - a * 2, s = e.height - a * 2;
|
|
2198
2280
|
if (o <= i || s <= i) break;
|
|
2199
2281
|
n.push({
|
|
@@ -2203,7 +2285,7 @@ var Wn = {
|
|
|
2203
2285
|
width: o,
|
|
2204
2286
|
height: s,
|
|
2205
2287
|
cornerRadius: e.cornerRadius,
|
|
2206
|
-
paint:
|
|
2288
|
+
paint: rr,
|
|
2207
2289
|
layer: e.layer,
|
|
2208
2290
|
noScale: e.noScale
|
|
2209
2291
|
});
|
|
@@ -2213,11 +2295,11 @@ var Wn = {
|
|
|
2213
2295
|
case "circle": {
|
|
2214
2296
|
let t = {
|
|
2215
2297
|
...e,
|
|
2216
|
-
paint:
|
|
2298
|
+
paint: nr(e.paint)
|
|
2217
2299
|
};
|
|
2218
2300
|
if (!e.paint.fill) return t;
|
|
2219
|
-
let n = [t], r = e.radius *
|
|
2220
|
-
for (let t = 1; t <=
|
|
2301
|
+
let n = [t], r = e.radius * $n;
|
|
2302
|
+
for (let t = 1; t <= Qn; t++) {
|
|
2221
2303
|
let i = e.radius - r * t;
|
|
2222
2304
|
if (i <= e.radius * .12) break;
|
|
2223
2305
|
n.push({
|
|
@@ -2225,7 +2307,7 @@ var Wn = {
|
|
|
2225
2307
|
cx: e.cx,
|
|
2226
2308
|
cy: e.cy,
|
|
2227
2309
|
radius: i,
|
|
2228
|
-
paint:
|
|
2310
|
+
paint: rr,
|
|
2229
2311
|
layer: e.layer,
|
|
2230
2312
|
noScale: e.noScale
|
|
2231
2313
|
});
|
|
@@ -2235,21 +2317,21 @@ var Wn = {
|
|
|
2235
2317
|
case "polygon": {
|
|
2236
2318
|
let t = {
|
|
2237
2319
|
...e,
|
|
2238
|
-
paint:
|
|
2320
|
+
paint: nr(e.paint)
|
|
2239
2321
|
};
|
|
2240
2322
|
if (!e.paint.fill) return t;
|
|
2241
2323
|
let n = [t], r = e.vertices.length / 2, i = 0, a = 0;
|
|
2242
2324
|
for (let t = 0; t < r; t++) i += e.vertices[t * 2], a += e.vertices[t * 2 + 1];
|
|
2243
2325
|
i /= r, a /= r;
|
|
2244
|
-
for (let t = 1; t <=
|
|
2245
|
-
let o = 1 -
|
|
2326
|
+
for (let t = 1; t <= Qn; t++) {
|
|
2327
|
+
let o = 1 - $n * t;
|
|
2246
2328
|
if (o <= .15) break;
|
|
2247
2329
|
let s = [];
|
|
2248
2330
|
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
2331
|
n.push({
|
|
2250
2332
|
type: "polygon",
|
|
2251
2333
|
vertices: s,
|
|
2252
|
-
paint:
|
|
2334
|
+
paint: rr,
|
|
2253
2335
|
layer: e.layer,
|
|
2254
2336
|
noScale: e.noScale
|
|
2255
2337
|
});
|
|
@@ -2260,29 +2342,29 @@ var Wn = {
|
|
|
2260
2342
|
...e,
|
|
2261
2343
|
paint: {
|
|
2262
2344
|
...e.paint,
|
|
2263
|
-
stroke:
|
|
2345
|
+
stroke: Wn
|
|
2264
2346
|
}
|
|
2265
2347
|
} : e;
|
|
2266
2348
|
case "text": return {
|
|
2267
2349
|
...e,
|
|
2268
|
-
fill:
|
|
2350
|
+
fill: Gn
|
|
2269
2351
|
};
|
|
2270
2352
|
case "image":
|
|
2271
2353
|
case "group": return e;
|
|
2272
2354
|
}
|
|
2273
|
-
} },
|
|
2274
|
-
function
|
|
2275
|
-
return
|
|
2276
|
-
let n =
|
|
2355
|
+
} }, ar = "#3a3a44";
|
|
2356
|
+
function or(e, t) {
|
|
2357
|
+
return I(e, (e) => {
|
|
2358
|
+
let n = L(e);
|
|
2277
2359
|
return n ? `rgba(${n.r}, ${n.g}, ${n.b}, ${(n.a * t).toFixed(3)})` : e;
|
|
2278
2360
|
});
|
|
2279
2361
|
}
|
|
2280
|
-
function
|
|
2362
|
+
function sr(e = {}) {
|
|
2281
2363
|
let t = e.bleed ?? .05, n = Math.max(1, Math.min(4, e.layers ?? 2)), r = e.alpha ?? .4;
|
|
2282
2364
|
function i(e, t, i, a, o, s) {
|
|
2283
|
-
let c =
|
|
2365
|
+
let c = or(t.fill, r), l = [];
|
|
2284
2366
|
for (let t = 0; t < n; t++) {
|
|
2285
|
-
let n =
|
|
2367
|
+
let n = B(i + t * 2654435769);
|
|
2286
2368
|
l.push({
|
|
2287
2369
|
type: "polygon",
|
|
2288
2370
|
vertices: e(n),
|
|
@@ -2301,10 +2383,10 @@ function Jn(e = {}) {
|
|
|
2301
2383
|
switch (e.type) {
|
|
2302
2384
|
case "rect":
|
|
2303
2385
|
if (!e.paint.fill) {
|
|
2304
|
-
let n =
|
|
2386
|
+
let n = B(V(e.x, e.y, e.width, e.height));
|
|
2305
2387
|
return {
|
|
2306
2388
|
type: "polygon",
|
|
2307
|
-
vertices:
|
|
2389
|
+
vertices: U(e.x, e.y, e.width, e.height, t, n),
|
|
2308
2390
|
paint: {
|
|
2309
2391
|
stroke: e.paint.stroke,
|
|
2310
2392
|
strokeWidth: e.paint.strokeWidth ?? 0,
|
|
@@ -2315,13 +2397,13 @@ function Jn(e = {}) {
|
|
|
2315
2397
|
noScale: e.noScale
|
|
2316
2398
|
};
|
|
2317
2399
|
}
|
|
2318
|
-
return i((n) =>
|
|
2400
|
+
return i((n) => U(e.x, e.y, e.width, e.height, t, n), e.paint, V(e.x, e.y, e.width, e.height), e.layer, e.hit, e.noScale);
|
|
2319
2401
|
case "circle":
|
|
2320
2402
|
if (!e.paint.fill) {
|
|
2321
|
-
let n =
|
|
2403
|
+
let n = B(V(e.cx, e.cy, e.radius));
|
|
2322
2404
|
return {
|
|
2323
2405
|
type: "polygon",
|
|
2324
|
-
vertices:
|
|
2406
|
+
vertices: Pt(e.cx, e.cy, e.radius, t, n),
|
|
2325
2407
|
paint: {
|
|
2326
2408
|
stroke: e.paint.stroke,
|
|
2327
2409
|
strokeWidth: e.paint.strokeWidth ?? 0,
|
|
@@ -2332,20 +2414,20 @@ function Jn(e = {}) {
|
|
|
2332
2414
|
noScale: e.noScale
|
|
2333
2415
|
};
|
|
2334
2416
|
}
|
|
2335
|
-
return i((n) =>
|
|
2417
|
+
return i((n) => Pt(e.cx, e.cy, e.radius, t, n), e.paint, V(e.cx, e.cy, e.radius), e.layer, e.hit, e.noScale);
|
|
2336
2418
|
case "polygon":
|
|
2337
2419
|
if (!e.paint.fill) {
|
|
2338
|
-
let n =
|
|
2420
|
+
let n = B(V(...e.vertices.slice(0, 4)));
|
|
2339
2421
|
return {
|
|
2340
2422
|
...e,
|
|
2341
|
-
vertices:
|
|
2423
|
+
vertices: Ft(e.vertices, t, n),
|
|
2342
2424
|
paint: {
|
|
2343
2425
|
...e.paint,
|
|
2344
2426
|
alpha: .5
|
|
2345
2427
|
}
|
|
2346
2428
|
};
|
|
2347
2429
|
}
|
|
2348
|
-
return i((n) =>
|
|
2430
|
+
return i((n) => Ft(e.vertices, t, n), e.paint, V(...e.vertices.slice(0, 4)), e.layer, e.hit, e.noScale);
|
|
2349
2431
|
case "line": return {
|
|
2350
2432
|
...e,
|
|
2351
2433
|
paint: {
|
|
@@ -2355,7 +2437,7 @@ function Jn(e = {}) {
|
|
|
2355
2437
|
};
|
|
2356
2438
|
case "text": return {
|
|
2357
2439
|
...e,
|
|
2358
|
-
fill:
|
|
2440
|
+
fill: ar
|
|
2359
2441
|
};
|
|
2360
2442
|
case "image":
|
|
2361
2443
|
case "group": return e;
|
|
@@ -2364,32 +2446,32 @@ function Jn(e = {}) {
|
|
|
2364
2446
|
}
|
|
2365
2447
|
//#endregion
|
|
2366
2448
|
//#region src/style/shape/DarkModernStyle.ts
|
|
2367
|
-
var
|
|
2368
|
-
function
|
|
2369
|
-
let t =
|
|
2449
|
+
var cr = "rgba(255, 255, 255, 0.14)", lr = "#5b6573", ur = "#e6e8ec", dr = "rgba(0, 0, 0, 0.38)", fr = .08, pr = .34;
|
|
2450
|
+
function mr(e) {
|
|
2451
|
+
let t = L(e);
|
|
2370
2452
|
if (!t) return "rgb(38, 42, 48)";
|
|
2371
|
-
let [n, r, i] =
|
|
2372
|
-
return
|
|
2453
|
+
let [n, r, i] = Ye(t.r, t.g, t.b);
|
|
2454
|
+
return Xe(n, Math.min(r, pr), .22 + i * .18, t.a);
|
|
2373
2455
|
}
|
|
2374
|
-
function
|
|
2456
|
+
function hr(e) {
|
|
2375
2457
|
return {
|
|
2376
2458
|
...e,
|
|
2377
|
-
fill:
|
|
2378
|
-
stroke: e.stroke ?
|
|
2459
|
+
fill: I(e.fill, mr),
|
|
2460
|
+
stroke: e.stroke ? cr : e.stroke
|
|
2379
2461
|
};
|
|
2380
2462
|
}
|
|
2381
|
-
function
|
|
2463
|
+
function gr(e) {
|
|
2382
2464
|
return e.hit?.kind === "room" && e.paint.fill !== void 0;
|
|
2383
2465
|
}
|
|
2384
|
-
var
|
|
2466
|
+
var _r = { transform(e, t) {
|
|
2385
2467
|
switch (e.type) {
|
|
2386
2468
|
case "rect": {
|
|
2387
2469
|
let n = {
|
|
2388
2470
|
...e,
|
|
2389
|
-
paint:
|
|
2471
|
+
paint: hr(e.paint)
|
|
2390
2472
|
};
|
|
2391
|
-
if (!
|
|
2392
|
-
let r = t.roomSize *
|
|
2473
|
+
if (!gr(e)) return n;
|
|
2474
|
+
let r = t.roomSize * fr;
|
|
2393
2475
|
return [{
|
|
2394
2476
|
type: "rect",
|
|
2395
2477
|
x: e.x + r,
|
|
@@ -2397,7 +2479,7 @@ var ir = { transform(e, t) {
|
|
|
2397
2479
|
width: e.width,
|
|
2398
2480
|
height: e.height,
|
|
2399
2481
|
cornerRadius: e.cornerRadius,
|
|
2400
|
-
paint: { fill:
|
|
2482
|
+
paint: { fill: dr },
|
|
2401
2483
|
layer: e.layer,
|
|
2402
2484
|
noScale: e.noScale
|
|
2403
2485
|
}, n];
|
|
@@ -2405,82 +2487,82 @@ var ir = { transform(e, t) {
|
|
|
2405
2487
|
case "circle": {
|
|
2406
2488
|
let n = {
|
|
2407
2489
|
...e,
|
|
2408
|
-
paint:
|
|
2490
|
+
paint: hr(e.paint)
|
|
2409
2491
|
};
|
|
2410
|
-
if (!
|
|
2411
|
-
let r = t.roomSize *
|
|
2492
|
+
if (!gr(e)) return n;
|
|
2493
|
+
let r = t.roomSize * fr;
|
|
2412
2494
|
return [{
|
|
2413
2495
|
type: "circle",
|
|
2414
2496
|
cx: e.cx + r,
|
|
2415
2497
|
cy: e.cy + r,
|
|
2416
2498
|
radius: e.radius,
|
|
2417
|
-
paint: { fill:
|
|
2499
|
+
paint: { fill: dr },
|
|
2418
2500
|
layer: e.layer,
|
|
2419
2501
|
noScale: e.noScale
|
|
2420
2502
|
}, n];
|
|
2421
2503
|
}
|
|
2422
2504
|
case "polygon": return {
|
|
2423
2505
|
...e,
|
|
2424
|
-
paint:
|
|
2506
|
+
paint: hr(e.paint)
|
|
2425
2507
|
};
|
|
2426
2508
|
case "line": return {
|
|
2427
2509
|
...e,
|
|
2428
2510
|
paint: e.paint.stroke ? {
|
|
2429
2511
|
...e.paint,
|
|
2430
|
-
stroke:
|
|
2512
|
+
stroke: lr
|
|
2431
2513
|
} : e.paint
|
|
2432
2514
|
};
|
|
2433
2515
|
case "text": return {
|
|
2434
2516
|
...e,
|
|
2435
|
-
fill:
|
|
2517
|
+
fill: ur
|
|
2436
2518
|
};
|
|
2437
2519
|
case "image":
|
|
2438
2520
|
case "group": return e;
|
|
2439
2521
|
}
|
|
2440
|
-
} }, J = "#5a3a22",
|
|
2441
|
-
function
|
|
2442
|
-
let t =
|
|
2443
|
-
if (!t) return
|
|
2444
|
-
let n =
|
|
2445
|
-
return
|
|
2522
|
+
} }, J = "#5a3a22", vr = "#43301c", yr = 120, br = 86, xr = 50, Sr = 232, Cr = 205, wr = 158;
|
|
2523
|
+
function Tr(e) {
|
|
2524
|
+
let t = L(e);
|
|
2525
|
+
if (!t) return R(Sr, Cr, wr);
|
|
2526
|
+
let n = z(t);
|
|
2527
|
+
return R(Math.round(yr + (Sr - yr) * n), Math.round(br + (Cr - br) * n), Math.round(xr + (wr - xr) * n), t.a);
|
|
2446
2528
|
}
|
|
2447
|
-
function
|
|
2448
|
-
let t =
|
|
2529
|
+
function Er(e) {
|
|
2530
|
+
let t = L(e);
|
|
2449
2531
|
if (!t || t.a >= 1) return J;
|
|
2450
|
-
let n =
|
|
2451
|
-
return
|
|
2532
|
+
let n = L(J);
|
|
2533
|
+
return R(n.r, n.g, n.b, t.a);
|
|
2452
2534
|
}
|
|
2453
|
-
function
|
|
2535
|
+
function Dr(e) {
|
|
2454
2536
|
return {
|
|
2455
2537
|
...e,
|
|
2456
|
-
fill:
|
|
2457
|
-
stroke: e.stroke ?
|
|
2538
|
+
fill: I(e.fill, Tr),
|
|
2539
|
+
stroke: e.stroke ? Er(e.stroke) : e.stroke
|
|
2458
2540
|
};
|
|
2459
2541
|
}
|
|
2460
|
-
var
|
|
2542
|
+
var Or = { transform(e) {
|
|
2461
2543
|
switch (e.type) {
|
|
2462
2544
|
case "rect":
|
|
2463
2545
|
case "circle":
|
|
2464
2546
|
case "polygon": return {
|
|
2465
2547
|
...e,
|
|
2466
|
-
paint:
|
|
2548
|
+
paint: Dr(e.paint)
|
|
2467
2549
|
};
|
|
2468
2550
|
case "line": return {
|
|
2469
2551
|
...e,
|
|
2470
2552
|
paint: e.paint.stroke ? {
|
|
2471
2553
|
...e.paint,
|
|
2472
|
-
stroke:
|
|
2554
|
+
stroke: Er(e.paint.stroke)
|
|
2473
2555
|
} : e.paint
|
|
2474
2556
|
};
|
|
2475
2557
|
case "text": return {
|
|
2476
2558
|
...e,
|
|
2477
|
-
fill:
|
|
2559
|
+
fill: vr
|
|
2478
2560
|
};
|
|
2479
2561
|
case "image":
|
|
2480
2562
|
case "group": return e;
|
|
2481
2563
|
}
|
|
2482
2564
|
} };
|
|
2483
|
-
function
|
|
2565
|
+
function kr(e, t, n) {
|
|
2484
2566
|
let r = [], i = n * .42;
|
|
2485
2567
|
for (let a = 0; a < 8; a++) {
|
|
2486
2568
|
let o = (-90 + a * 45) * (Math.PI / 180), s = a % 2 == 0 ? n : i;
|
|
@@ -2488,7 +2570,7 @@ function gr(e, t, n) {
|
|
|
2488
2570
|
}
|
|
2489
2571
|
return r;
|
|
2490
2572
|
}
|
|
2491
|
-
function
|
|
2573
|
+
function Ar() {
|
|
2492
2574
|
let e;
|
|
2493
2575
|
return {
|
|
2494
2576
|
attach(t) {
|
|
@@ -2526,9 +2608,9 @@ function _r() {
|
|
|
2526
2608
|
layer: "top"
|
|
2527
2609
|
}), c.push({
|
|
2528
2610
|
type: "polygon",
|
|
2529
|
-
vertices:
|
|
2611
|
+
vertices: kr(u, d, l),
|
|
2530
2612
|
paint: {
|
|
2531
|
-
fill:
|
|
2613
|
+
fill: R(Sr, Cr, wr, .85),
|
|
2532
2614
|
stroke: J,
|
|
2533
2615
|
strokeWidth: s
|
|
2534
2616
|
},
|
|
@@ -2547,7 +2629,7 @@ function _r() {
|
|
|
2547
2629
|
text: "N",
|
|
2548
2630
|
fontSize: l * .5,
|
|
2549
2631
|
fontStyle: "bold",
|
|
2550
|
-
fill:
|
|
2632
|
+
fill: vr,
|
|
2551
2633
|
align: "center",
|
|
2552
2634
|
verticalAlign: "middle",
|
|
2553
2635
|
layer: "top"
|
|
@@ -2557,22 +2639,22 @@ function _r() {
|
|
|
2557
2639
|
}
|
|
2558
2640
|
//#endregion
|
|
2559
2641
|
//#region src/style/index.ts
|
|
2560
|
-
var
|
|
2561
|
-
function
|
|
2562
|
-
return
|
|
2642
|
+
var jr = ct, Mr = bt, Nr = Mt;
|
|
2643
|
+
function Pr(e) {
|
|
2644
|
+
return Lt(e);
|
|
2563
2645
|
}
|
|
2564
|
-
function
|
|
2565
|
-
return
|
|
2646
|
+
function Fr(e = {}) {
|
|
2647
|
+
return Ht(e);
|
|
2566
2648
|
}
|
|
2567
|
-
var
|
|
2568
|
-
function
|
|
2569
|
-
return
|
|
2649
|
+
var Ir = tn, Lr = hn;
|
|
2650
|
+
function Rr(e = {}) {
|
|
2651
|
+
return _n(e);
|
|
2570
2652
|
}
|
|
2571
|
-
var
|
|
2572
|
-
function
|
|
2573
|
-
return
|
|
2653
|
+
var zr = On, Br = Hn, Vr = ir;
|
|
2654
|
+
function Hr(e = {}) {
|
|
2655
|
+
return sr(e);
|
|
2574
2656
|
}
|
|
2575
|
-
var
|
|
2657
|
+
var Ur = _r, Wr = Or, Gr = class {
|
|
2576
2658
|
get settings() {
|
|
2577
2659
|
return this.state.settings;
|
|
2578
2660
|
}
|
|
@@ -2589,7 +2671,7 @@ var Ar = ir, jr = hr, Mr = class {
|
|
|
2589
2671
|
return this.backend.events;
|
|
2590
2672
|
}
|
|
2591
2673
|
constructor(e, t, n, r) {
|
|
2592
|
-
this.currentStyle =
|
|
2674
|
+
this.currentStyle = x, this.state = new Ae(e, t ?? ke()), this.backend = r ? r(this.state) : new Je(this.state, n);
|
|
2593
2675
|
}
|
|
2594
2676
|
destroy() {
|
|
2595
2677
|
this.backend.destroy();
|
|
@@ -2643,7 +2725,7 @@ var Ar = ir, jr = hr, Mr = class {
|
|
|
2643
2725
|
this.currentStyle = e, this.backend.setStyle(e);
|
|
2644
2726
|
}
|
|
2645
2727
|
clearStyle() {
|
|
2646
|
-
this.setStyle(
|
|
2728
|
+
this.setStyle(x);
|
|
2647
2729
|
}
|
|
2648
2730
|
getStyle() {
|
|
2649
2731
|
return this.currentStyle;
|
|
@@ -2745,15 +2827,15 @@ var Ar = ir, jr = hr, Mr = class {
|
|
|
2745
2827
|
getCullingMode() {
|
|
2746
2828
|
return this.state.settings.cullingMode;
|
|
2747
2829
|
}
|
|
2748
|
-
},
|
|
2749
|
-
function
|
|
2830
|
+
}, Kr = "room";
|
|
2831
|
+
function qr(e, t) {
|
|
2750
2832
|
let n = /* @__PURE__ */ new Map();
|
|
2751
2833
|
function r(e) {
|
|
2752
2834
|
let t = n.get(e);
|
|
2753
2835
|
return t || (t = [], n.set(e, t)), t;
|
|
2754
2836
|
}
|
|
2755
2837
|
function i(e, t, n, i, o, s, c) {
|
|
2756
|
-
let l = e.layer ?? c ??
|
|
2838
|
+
let l = e.layer ?? c ?? Kr;
|
|
2757
2839
|
switch (e.type) {
|
|
2758
2840
|
case "rect": {
|
|
2759
2841
|
let a = {
|
|
@@ -2762,11 +2844,11 @@ function Pr(e, t) {
|
|
|
2762
2844
|
y: (n + e.y) * i + s,
|
|
2763
2845
|
w: e.width * i,
|
|
2764
2846
|
h: e.height * i,
|
|
2765
|
-
fill:
|
|
2847
|
+
fill: P(e.paint.fill, t, n, i, o, s),
|
|
2766
2848
|
stroke: e.paint.stroke,
|
|
2767
2849
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2768
2850
|
cr: (e.cornerRadius ?? 0) * i,
|
|
2769
|
-
dash:
|
|
2851
|
+
dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
2770
2852
|
};
|
|
2771
2853
|
r(l).push(a);
|
|
2772
2854
|
return;
|
|
@@ -2777,19 +2859,19 @@ function Pr(e, t) {
|
|
|
2777
2859
|
cx: (t + e.cx) * i + o,
|
|
2778
2860
|
cy: (n + e.cy) * i + s,
|
|
2779
2861
|
r: e.radius * i,
|
|
2780
|
-
fill:
|
|
2862
|
+
fill: P(e.paint.fill, t, n, i, o, s),
|
|
2781
2863
|
stroke: e.paint.stroke,
|
|
2782
2864
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2783
|
-
dash:
|
|
2865
|
+
dash: Yr(e.paint.dash, i, e.paint.dashEnabled)
|
|
2784
2866
|
});
|
|
2785
2867
|
return;
|
|
2786
2868
|
case "line": {
|
|
2787
2869
|
let a = {
|
|
2788
2870
|
type: "line",
|
|
2789
|
-
points:
|
|
2871
|
+
points: Jr(e.points, t, n, i, o, s),
|
|
2790
2872
|
stroke: e.paint.stroke,
|
|
2791
2873
|
sw: (e.paint.strokeWidth ?? 0) * i,
|
|
2792
|
-
dash:
|
|
2874
|
+
dash: Yr(e.paint.dash, i, e.paint.dashEnabled),
|
|
2793
2875
|
lineCap: e.lineCap,
|
|
2794
2876
|
lineJoin: e.lineJoin,
|
|
2795
2877
|
alpha: e.paint.alpha
|
|
@@ -2800,8 +2882,8 @@ function Pr(e, t) {
|
|
|
2800
2882
|
case "polygon": {
|
|
2801
2883
|
let a = {
|
|
2802
2884
|
type: "polygon",
|
|
2803
|
-
vertices:
|
|
2804
|
-
fill:
|
|
2885
|
+
vertices: Jr(e.vertices, t, n, i, o, s),
|
|
2886
|
+
fill: P(e.paint.fill, t, n, i, o, s),
|
|
2805
2887
|
stroke: e.paint.stroke,
|
|
2806
2888
|
sw: (e.paint.strokeWidth ?? 0) * i
|
|
2807
2889
|
};
|
|
@@ -2809,7 +2891,7 @@ function Pr(e, t) {
|
|
|
2809
2891
|
return;
|
|
2810
2892
|
}
|
|
2811
2893
|
case "text": {
|
|
2812
|
-
let a =
|
|
2894
|
+
let a = Xr(e.transform, t, n, i, o, s), c = {
|
|
2813
2895
|
type: "text",
|
|
2814
2896
|
x: a ? 0 : (t + e.x) * i + o,
|
|
2815
2897
|
y: a ? 0 : (n + e.y) * i + s,
|
|
@@ -2832,7 +2914,7 @@ function Pr(e, t) {
|
|
|
2832
2914
|
return;
|
|
2833
2915
|
}
|
|
2834
2916
|
case "image": {
|
|
2835
|
-
let a =
|
|
2917
|
+
let a = Xr(e.transform, t, n, i, o, s), c = a ? 0 : (t + e.x) * i + o, u = a ? 0 : (n + e.y) * i + s;
|
|
2836
2918
|
r(l).push({
|
|
2837
2919
|
type: "image",
|
|
2838
2920
|
x: c,
|
|
@@ -2852,7 +2934,7 @@ function Pr(e, t) {
|
|
|
2852
2934
|
function a(e, t, n, a, o, s, c) {
|
|
2853
2935
|
let l = e.layer ?? c;
|
|
2854
2936
|
if (e.noScale) {
|
|
2855
|
-
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ??
|
|
2937
|
+
let c = (t + e.x) * a + o, u = (n + e.y) * a + s, d = r(l ?? Kr);
|
|
2856
2938
|
d.push({
|
|
2857
2939
|
type: "pushTransform",
|
|
2858
2940
|
matrix: [
|
|
@@ -2879,19 +2961,19 @@ function Pr(e, t) {
|
|
|
2879
2961
|
});
|
|
2880
2962
|
return o;
|
|
2881
2963
|
}
|
|
2882
|
-
function
|
|
2964
|
+
function Jr(e, t, n, r, i, a) {
|
|
2883
2965
|
let o = Array(e.length);
|
|
2884
2966
|
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;
|
|
2885
2967
|
return o;
|
|
2886
2968
|
}
|
|
2887
|
-
function
|
|
2969
|
+
function Yr(e, t, n) {
|
|
2888
2970
|
if (n === !1) return;
|
|
2889
2971
|
if (!e || e.length === 0) return e;
|
|
2890
2972
|
let r = Array(e.length);
|
|
2891
2973
|
for (let n = 0; n < e.length; n++) r[n] = e[n] * t;
|
|
2892
2974
|
return r;
|
|
2893
2975
|
}
|
|
2894
|
-
function
|
|
2976
|
+
function Xr(e, t, n, r, i, a) {
|
|
2895
2977
|
if (!e) return;
|
|
2896
2978
|
let [o, s, c, l, u, d] = e;
|
|
2897
2979
|
return [
|
|
@@ -2911,33 +2993,33 @@ function Y(e) {
|
|
|
2911
2993
|
function X(e, t) {
|
|
2912
2994
|
return t === void 0 ? "" : ` ${e}="${typeof t == "string" ? Y(t) : t}"`;
|
|
2913
2995
|
}
|
|
2914
|
-
function
|
|
2996
|
+
function Zr(e) {
|
|
2915
2997
|
return !e || e.length === 0 ? "" : ` stroke-dasharray="${e.join(" ")}"`;
|
|
2916
2998
|
}
|
|
2917
|
-
var
|
|
2918
|
-
function
|
|
2919
|
-
return `mmr-grad-${++
|
|
2999
|
+
var Qr = 0;
|
|
3000
|
+
function $r() {
|
|
3001
|
+
return `mmr-grad-${++Qr}`;
|
|
2920
3002
|
}
|
|
2921
|
-
function
|
|
3003
|
+
function ei(e, t) {
|
|
2922
3004
|
let n = t.stops.map((e) => `<stop offset="${e.offset}" stop-color="${Y(e.color)}"/>`).join("");
|
|
2923
3005
|
return `<defs><linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${t.x0}" y1="${t.y0}" x2="${t.x1}" y2="${t.y1}">${n}</linearGradient></defs>`;
|
|
2924
3006
|
}
|
|
2925
|
-
function
|
|
3007
|
+
function ti(e, t) {
|
|
2926
3008
|
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}"`);
|
|
2927
3009
|
return `<defs><radialGradient id="${e}" gradientUnits="userSpaceOnUse" cx="${t.cx}" cy="${t.cy}" r="${t.r}"${r}>${n}</radialGradient></defs>`;
|
|
2928
3010
|
}
|
|
2929
|
-
function
|
|
3011
|
+
function ni(e, t) {
|
|
2930
3012
|
if (e === void 0) return;
|
|
2931
3013
|
if (typeof e == "string") return e;
|
|
2932
|
-
let n =
|
|
2933
|
-
return t.push(e.type === "linear" ?
|
|
3014
|
+
let n = $r();
|
|
3015
|
+
return t.push(e.type === "linear" ? ei(n, e) : ti(n, e)), `url(#${n})`;
|
|
2934
3016
|
}
|
|
2935
|
-
function
|
|
3017
|
+
function ri(e) {
|
|
2936
3018
|
let t = [];
|
|
2937
|
-
for (let n of e)
|
|
3019
|
+
for (let n of e) ii(n.commands, t);
|
|
2938
3020
|
return t;
|
|
2939
3021
|
}
|
|
2940
|
-
function
|
|
3022
|
+
function ii(e, t) {
|
|
2941
3023
|
let n = [];
|
|
2942
3024
|
for (let r of e) switch (r.type) {
|
|
2943
3025
|
case "pushTransform": {
|
|
@@ -2955,21 +3037,21 @@ function Gr(e, t) {
|
|
|
2955
3037
|
break;
|
|
2956
3038
|
}
|
|
2957
3039
|
default:
|
|
2958
|
-
|
|
3040
|
+
ai(r, t);
|
|
2959
3041
|
break;
|
|
2960
3042
|
}
|
|
2961
3043
|
for (; n.length > 0;) t.push(n.pop());
|
|
2962
3044
|
}
|
|
2963
|
-
function
|
|
3045
|
+
function ai(e, t) {
|
|
2964
3046
|
switch (e.type) {
|
|
2965
3047
|
case "rect": {
|
|
2966
|
-
let n =
|
|
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}${
|
|
3048
|
+
let n = ni(e.fill, t) ?? "none", r = e.cr > 0 ? `${X("rx", e.cr)}${X("ry", e.cr)}` : "";
|
|
3049
|
+
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}${Zr(e.dash)}/>`);
|
|
2968
3050
|
return;
|
|
2969
3051
|
}
|
|
2970
3052
|
case "circle": {
|
|
2971
|
-
let n =
|
|
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) : ""}${
|
|
3053
|
+
let n = ni(e.fill, t) ?? "none";
|
|
3054
|
+
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) : ""}${Zr(e.dash)}/>`);
|
|
2973
3055
|
return;
|
|
2974
3056
|
}
|
|
2975
3057
|
case "line": {
|
|
@@ -2977,7 +3059,7 @@ function Kr(e, t) {
|
|
|
2977
3059
|
if (n.length < 2) return;
|
|
2978
3060
|
let r = [];
|
|
2979
3061
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
2980
|
-
t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${
|
|
3062
|
+
t.push(`<polyline points="${r.join(" ")}"${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}${Zr(e.dash)}${X("stroke-linecap", e.lineCap)}${X("stroke-linejoin", e.lineJoin)}${X("opacity", e.alpha)} fill="none"/>`);
|
|
2981
3063
|
return;
|
|
2982
3064
|
}
|
|
2983
3065
|
case "polygon": {
|
|
@@ -2985,7 +3067,7 @@ function Kr(e, t) {
|
|
|
2985
3067
|
if (n.length < 4) return;
|
|
2986
3068
|
let r = [];
|
|
2987
3069
|
for (let e = 0; e < n.length; e += 2) r.push(`${n[e]},${n[e + 1]}`);
|
|
2988
|
-
let i =
|
|
3070
|
+
let i = ni(e.fill, t);
|
|
2989
3071
|
t.push(`<polygon points="${r.join(" ")}"${X("fill", i)}${X("stroke", e.stroke)}${e.sw ? X("stroke-width", e.sw) : ""}/>`);
|
|
2990
3072
|
return;
|
|
2991
3073
|
}
|
|
@@ -3008,18 +3090,18 @@ function Kr(e, t) {
|
|
|
3008
3090
|
}
|
|
3009
3091
|
//#endregion
|
|
3010
3092
|
//#region src/render/CanvasRenderer.ts
|
|
3011
|
-
var
|
|
3093
|
+
var oi = (e) => {
|
|
3012
3094
|
if (typeof Image < "u") {
|
|
3013
3095
|
let t = new Image();
|
|
3014
3096
|
return t.src = e, t;
|
|
3015
3097
|
}
|
|
3016
3098
|
return null;
|
|
3017
3099
|
};
|
|
3018
|
-
function
|
|
3019
|
-
let r = n.imageFactory ??
|
|
3020
|
-
for (let n of t)
|
|
3100
|
+
function si(e, t, n = {}) {
|
|
3101
|
+
let r = n.imageFactory ?? oi;
|
|
3102
|
+
for (let n of t) ci(e, n.commands, r);
|
|
3021
3103
|
}
|
|
3022
|
-
function
|
|
3104
|
+
function ci(e, t, n) {
|
|
3023
3105
|
let r = 0;
|
|
3024
3106
|
for (let i of t) switch (i.type) {
|
|
3025
3107
|
case "pushTransform":
|
|
@@ -3033,18 +3115,18 @@ function Yr(e, t, n) {
|
|
|
3033
3115
|
r > 0 && (e.restore(), r--);
|
|
3034
3116
|
break;
|
|
3035
3117
|
default:
|
|
3036
|
-
|
|
3118
|
+
li(e, i, n);
|
|
3037
3119
|
break;
|
|
3038
3120
|
}
|
|
3039
3121
|
for (; r > 0;) e.restore(), r--;
|
|
3040
3122
|
}
|
|
3041
|
-
function
|
|
3123
|
+
function li(e, t, n) {
|
|
3042
3124
|
switch (t.type) {
|
|
3043
3125
|
case "rect":
|
|
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 =
|
|
3126
|
+
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 = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
3045
3127
|
break;
|
|
3046
3128
|
case "circle":
|
|
3047
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle =
|
|
3129
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.r, 0, Math.PI * 2), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash(t.dash ?? []), e.stroke());
|
|
3048
3130
|
break;
|
|
3049
3131
|
case "line": {
|
|
3050
3132
|
if (t.points.length < 4) break;
|
|
@@ -3058,7 +3140,7 @@ function Xr(e, t, n) {
|
|
|
3058
3140
|
if (t.vertices.length < 4) break;
|
|
3059
3141
|
e.beginPath(), e.moveTo(t.vertices[0], t.vertices[1]);
|
|
3060
3142
|
for (let n = 2; n < t.vertices.length; n += 2) e.lineTo(t.vertices[n], t.vertices[n + 1]);
|
|
3061
|
-
e.closePath(), t.fill && (e.fillStyle =
|
|
3143
|
+
e.closePath(), t.fill && (e.fillStyle = j(e, t.fill), e.fill()), t.stroke && t.sw > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.sw, e.setLineDash([]), e.stroke());
|
|
3062
3144
|
break;
|
|
3063
3145
|
case "text": {
|
|
3064
3146
|
let n = t.fontSize * 100, r = `${t.fontStyle} ${n}px ${t.fontFamily}`;
|
|
@@ -3099,7 +3181,7 @@ function Xr(e, t, n) {
|
|
|
3099
3181
|
}
|
|
3100
3182
|
//#endregion
|
|
3101
3183
|
//#region src/export/sceneBounds.ts
|
|
3102
|
-
function
|
|
3184
|
+
function ui(e, t, n = 0) {
|
|
3103
3185
|
if (!t.worldToScene) return e;
|
|
3104
3186
|
let r = [
|
|
3105
3187
|
t.worldToScene(e.x, e.y),
|
|
@@ -3117,47 +3199,47 @@ function Zr(e, t, n = 0) {
|
|
|
3117
3199
|
}
|
|
3118
3200
|
//#endregion
|
|
3119
3201
|
//#region src/export/SvgExporter.ts
|
|
3120
|
-
var
|
|
3202
|
+
var di = {
|
|
3121
3203
|
scale: 1,
|
|
3122
3204
|
offsetX: 0,
|
|
3123
3205
|
offsetY: 0
|
|
3124
3206
|
};
|
|
3125
|
-
function
|
|
3207
|
+
function fi(e) {
|
|
3126
3208
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3127
3209
|
}
|
|
3128
|
-
var
|
|
3210
|
+
var pi = class {
|
|
3129
3211
|
constructor(e = {}) {
|
|
3130
3212
|
this.options = e;
|
|
3131
3213
|
}
|
|
3132
3214
|
render({ state: e, style: t, sceneOverlays: n }) {
|
|
3133
|
-
let { currentArea:
|
|
3134
|
-
if (
|
|
3135
|
-
let
|
|
3136
|
-
if (!
|
|
3137
|
-
let
|
|
3215
|
+
let { currentArea: r, currentZIndex: i, currentAreaInstance: a } = e;
|
|
3216
|
+
if (r === void 0 || i === void 0 || !a) return;
|
|
3217
|
+
let o = a, s = o.getPlane(i);
|
|
3218
|
+
if (!s) return;
|
|
3219
|
+
let c = e.settings, l = this.options.padding ?? 3, u = e.computeExportBounds(o, s, this.options.roomId, l), d = D.forMapBounds(u.x, u.x + u.w, u.y, u.y + u.h).getViewportBounds(), f = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), d, c, {
|
|
3138
3220
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
3139
3221
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
3140
|
-
}),
|
|
3222
|
+
}), p = {
|
|
3141
3223
|
scale: 1,
|
|
3142
|
-
roomSize:
|
|
3143
|
-
},
|
|
3144
|
-
return
|
|
3224
|
+
roomSize: c.roomSize
|
|
3225
|
+
}, m = (e) => t === x ? e : O(e, t, p), h = ui(u, t, c.roomSize * .5), g = [];
|
|
3226
|
+
return g.push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${h.x} ${h.y} ${h.w} ${h.h}">`), g.push(`<rect x="${h.x}" y="${h.y}" width="${h.w}" height="${h.h}" fill="${fi(c.backgroundColor)}"/>`), ae(f, {
|
|
3145
3227
|
state: e,
|
|
3146
|
-
viewportBounds:
|
|
3228
|
+
viewportBounds: d,
|
|
3147
3229
|
sceneOverlays: n,
|
|
3148
3230
|
overlays: this.options.overlays
|
|
3149
3231
|
}, (e, t) => {
|
|
3150
|
-
e.length !== 0 &&
|
|
3151
|
-
}),
|
|
3232
|
+
e.length !== 0 && g.push(...ri(qr(t ? e : m(e), di)));
|
|
3233
|
+
}), g.push("</svg>"), g.join("\n");
|
|
3152
3234
|
}
|
|
3153
|
-
},
|
|
3235
|
+
}, mi = class {
|
|
3154
3236
|
constructor(e = {}) {
|
|
3155
3237
|
this.options = e;
|
|
3156
3238
|
}
|
|
3157
3239
|
render({ backend: e }) {
|
|
3158
3240
|
return e.exportCanvas(this.options)?.toDataURL("image/png");
|
|
3159
3241
|
}
|
|
3160
|
-
},
|
|
3242
|
+
}, hi = class {
|
|
3161
3243
|
constructor(e = {}) {
|
|
3162
3244
|
this.options = e;
|
|
3163
3245
|
}
|
|
@@ -3174,87 +3256,87 @@ var ei = class {
|
|
|
3174
3256
|
};
|
|
3175
3257
|
//#endregion
|
|
3176
3258
|
//#region src/export/canvasToBytes.ts
|
|
3177
|
-
function
|
|
3259
|
+
function gi(e, t = "image/png", n) {
|
|
3178
3260
|
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);
|
|
3179
3261
|
for (let e = 0; e < o.length; e++) s[e] = o.charCodeAt(e);
|
|
3180
3262
|
return s;
|
|
3181
3263
|
}
|
|
3182
3264
|
//#endregion
|
|
3183
3265
|
//#region src/export/CanvasExporter.ts
|
|
3184
|
-
var
|
|
3266
|
+
var _i = class {
|
|
3185
3267
|
constructor(e) {
|
|
3186
3268
|
this.options = e;
|
|
3187
3269
|
}
|
|
3188
3270
|
render({ state: e, style: t, sceneOverlays: n }) {
|
|
3189
|
-
let { currentArea:
|
|
3190
|
-
if (
|
|
3191
|
-
let
|
|
3192
|
-
if (!
|
|
3193
|
-
let
|
|
3194
|
-
scale:
|
|
3195
|
-
offsetX:
|
|
3196
|
-
offsetY:
|
|
3197
|
-
},
|
|
3271
|
+
let { currentArea: r, currentZIndex: i, currentAreaInstance: a } = e;
|
|
3272
|
+
if (r === void 0 || i === void 0 || !a) return;
|
|
3273
|
+
let o = a, s = o.getPlane(i);
|
|
3274
|
+
if (!s) return;
|
|
3275
|
+
let c = e.settings, { width: l, height: u } = this.options, d = this.options.padding ?? 3, f = e.computeExportBounds(o, s, this.options.roomId, d), p = ui(f, t, c.roomSize * .5), m = Math.min(l / p.w, u / p.h), h = p.w * m, g = p.h * m, _ = (l - h) / 2 - p.x * m, v = (u - g) / 2 - p.y * m, y = {
|
|
3276
|
+
scale: m,
|
|
3277
|
+
offsetX: _,
|
|
3278
|
+
offsetY: v
|
|
3279
|
+
}, b = D.forRenderCamera(l, u, m, _, v), S = {
|
|
3198
3280
|
forward: t.worldToScene ? (e, n) => t.worldToScene(e, n) : void 0,
|
|
3199
3281
|
inverse: t.sceneToWorld ? (e, n) => t.sceneToWorld(e, n) : void 0
|
|
3200
|
-
},
|
|
3201
|
-
|
|
3202
|
-
let
|
|
3203
|
-
if (!
|
|
3204
|
-
|
|
3205
|
-
let
|
|
3206
|
-
scale:
|
|
3207
|
-
roomSize:
|
|
3208
|
-
},
|
|
3209
|
-
return
|
|
3282
|
+
}, C = Pe(new E(e.mapReader, c).buildScene(o, s, i, e.lens), b.getViewportBounds(), c, S), w = k.Util.createCanvasElement();
|
|
3283
|
+
w.width = l, w.height = u;
|
|
3284
|
+
let T = w.getContext("2d");
|
|
3285
|
+
if (!T) return;
|
|
3286
|
+
T.fillStyle = c.backgroundColor, T.fillRect(0, 0, l, u);
|
|
3287
|
+
let ee = {
|
|
3288
|
+
scale: m,
|
|
3289
|
+
roomSize: c.roomSize
|
|
3290
|
+
}, te = (e) => t === x ? e : O(e, t, ee);
|
|
3291
|
+
return ae(C, {
|
|
3210
3292
|
state: e,
|
|
3211
|
-
viewportBounds:
|
|
3293
|
+
viewportBounds: D.forMapBounds(f.x, f.x + f.w, f.y, f.y + f.h).getViewportBounds(),
|
|
3212
3294
|
sceneOverlays: n,
|
|
3213
3295
|
overlays: this.options.overlays
|
|
3214
3296
|
}, (e, t) => {
|
|
3215
|
-
e.length !== 0 &&
|
|
3216
|
-
}),
|
|
3297
|
+
e.length !== 0 && si(T, qr(t ? e : te(e), y));
|
|
3298
|
+
}), w;
|
|
3217
3299
|
}
|
|
3218
|
-
},
|
|
3300
|
+
}, vi = class {
|
|
3219
3301
|
constructor(e) {
|
|
3220
|
-
this.options = e, this.canvasExporter = new
|
|
3302
|
+
this.options = e, this.canvasExporter = new _i(e);
|
|
3221
3303
|
}
|
|
3222
3304
|
render(e) {
|
|
3223
3305
|
let t = this.canvasExporter.render(e);
|
|
3224
|
-
if (t) return
|
|
3306
|
+
if (t) return gi(t, this.options.mimeType, this.options.quality);
|
|
3225
3307
|
}
|
|
3226
|
-
}, Z,
|
|
3227
|
-
function
|
|
3308
|
+
}, Z, yi, bi = 256;
|
|
3309
|
+
function xi(e, t, n) {
|
|
3228
3310
|
let r = `${e.toFixed(2)}:${t}:${n.toFixed(3)}`;
|
|
3229
|
-
if (
|
|
3230
|
-
let i =
|
|
3311
|
+
if (yi === r && Z) return Z;
|
|
3312
|
+
let i = bi, a = i / 2, o = document.createElement("canvas");
|
|
3231
3313
|
o.width = i, o.height = i;
|
|
3232
3314
|
let s = o.getContext("2d");
|
|
3233
3315
|
s.fillStyle = `rgba(0, 0, 0, ${e})`, s.fillRect(0, 0, i, i), s.globalCompositeOperation = "destination-out";
|
|
3234
3316
|
let c = s.createRadialGradient(a, a, 0, a, a, a), l = Math.min(n, .99);
|
|
3235
3317
|
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";
|
|
3236
3318
|
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);
|
|
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(),
|
|
3319
|
+
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(), yi = r, Z;
|
|
3238
3320
|
}
|
|
3239
|
-
function
|
|
3321
|
+
function Si(e, t, n, r) {
|
|
3240
3322
|
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);
|
|
3241
3323
|
return {
|
|
3242
3324
|
cx: e,
|
|
3243
3325
|
cy: t,
|
|
3244
3326
|
displaySize: u,
|
|
3245
|
-
src:
|
|
3327
|
+
src: xi(a, o, Math.round(i / (u / 2) * 50) / 50)
|
|
3246
3328
|
};
|
|
3247
3329
|
}
|
|
3248
3330
|
//#endregion
|
|
3249
3331
|
//#region src/overlay/AmbientLightOverlay.ts
|
|
3250
|
-
var
|
|
3332
|
+
var Ci = {
|
|
3251
3333
|
color: "#ffcc44",
|
|
3252
3334
|
radius: 12,
|
|
3253
3335
|
intensity: .7
|
|
3254
|
-
},
|
|
3336
|
+
}, wi = class {
|
|
3255
3337
|
constructor(e) {
|
|
3256
3338
|
this.onPosition = () => this.ctx?.invalidate(), this.params = {
|
|
3257
|
-
...
|
|
3339
|
+
...Ci,
|
|
3258
3340
|
...e
|
|
3259
3341
|
};
|
|
3260
3342
|
}
|
|
@@ -3277,7 +3359,7 @@ var ui = {
|
|
|
3277
3359
|
if (e.positionRoomId === void 0) return;
|
|
3278
3360
|
let n = e.mapReader.getRoom(e.positionRoomId);
|
|
3279
3361
|
if (!n) return;
|
|
3280
|
-
let r =
|
|
3362
|
+
let r = Si(n.x, n.y, t, this.params);
|
|
3281
3363
|
return {
|
|
3282
3364
|
type: "image",
|
|
3283
3365
|
x: r.cx - r.displaySize / 2,
|
|
@@ -3288,7 +3370,7 @@ var ui = {
|
|
|
3288
3370
|
layer: "overlay"
|
|
3289
3371
|
};
|
|
3290
3372
|
}
|
|
3291
|
-
},
|
|
3373
|
+
}, Ti = () => typeof performance < "u" ? performance.now() : Date.now(), Ei = typeof requestAnimationFrame < "u" ? requestAnimationFrame : (e) => setTimeout(() => e(Ti()), 16), Di = typeof cancelAnimationFrame < "u" ? cancelAnimationFrame : (e) => clearTimeout(e), Oi = class {
|
|
3292
3374
|
constructor(e, t, n = {}) {
|
|
3293
3375
|
this.worldX = e, this.worldY = t, this.cancelled = !1, this.transform = (e, t) => ({
|
|
3294
3376
|
x: e,
|
|
@@ -3297,7 +3379,7 @@ var ui = {
|
|
|
3297
3379
|
}
|
|
3298
3380
|
attach(e) {
|
|
3299
3381
|
let t = this.transform(this.worldX, this.worldY);
|
|
3300
|
-
this.ring = new
|
|
3382
|
+
this.ring = new k.Circle({
|
|
3301
3383
|
x: t.x,
|
|
3302
3384
|
y: t.y,
|
|
3303
3385
|
radius: this.startRadius,
|
|
@@ -3312,12 +3394,12 @@ var ui = {
|
|
|
3312
3394
|
n(1), this.onComplete?.();
|
|
3313
3395
|
return;
|
|
3314
3396
|
}
|
|
3315
|
-
let r =
|
|
3397
|
+
let r = Ti(), i = (e) => {
|
|
3316
3398
|
if (this.cancelled) return;
|
|
3317
3399
|
let t = Math.min((e - r) / this.duration, 1);
|
|
3318
|
-
n(t), t < 1 ? this.rafId =
|
|
3400
|
+
n(t), t < 1 ? this.rafId = Ei(i) : (this.rafId = void 0, this.onComplete?.());
|
|
3319
3401
|
};
|
|
3320
|
-
this.rafId =
|
|
3402
|
+
this.rafId = Ei(i);
|
|
3321
3403
|
}
|
|
3322
3404
|
updateViewport(e, t, n) {
|
|
3323
3405
|
if (this.transform = n, this.ring) {
|
|
@@ -3329,9 +3411,9 @@ var ui = {
|
|
|
3329
3411
|
}
|
|
3330
3412
|
}
|
|
3331
3413
|
destroy() {
|
|
3332
|
-
this.cancelled = !0, this.rafId !== void 0 && (
|
|
3414
|
+
this.cancelled = !0, this.rafId !== void 0 && (Di(this.rafId), this.rafId = void 0), this.ring?.destroy(), this.ring = void 0;
|
|
3333
3415
|
}
|
|
3334
|
-
},
|
|
3416
|
+
}, ki = {
|
|
3335
3417
|
n: {
|
|
3336
3418
|
x: 0,
|
|
3337
3419
|
y: -1
|
|
@@ -3364,7 +3446,7 @@ var ui = {
|
|
|
3364
3446
|
x: -Math.SQRT1_2,
|
|
3365
3447
|
y: Math.SQRT1_2
|
|
3366
3448
|
}
|
|
3367
|
-
},
|
|
3449
|
+
}, Ai = [
|
|
3368
3450
|
"n",
|
|
3369
3451
|
"s",
|
|
3370
3452
|
"e",
|
|
@@ -3373,22 +3455,22 @@ var ui = {
|
|
|
3373
3455
|
"nw",
|
|
3374
3456
|
"se",
|
|
3375
3457
|
"sw"
|
|
3376
|
-
],
|
|
3458
|
+
], ji = new Set([
|
|
3377
3459
|
"ne",
|
|
3378
3460
|
"nw",
|
|
3379
3461
|
"se",
|
|
3380
3462
|
"sw"
|
|
3381
|
-
]),
|
|
3463
|
+
]), Mi = {
|
|
3382
3464
|
clear: 10,
|
|
3383
3465
|
diagonal: .3,
|
|
3384
3466
|
preferred: 1,
|
|
3385
3467
|
distance: .05
|
|
3386
|
-
},
|
|
3468
|
+
}, Ni = [
|
|
3387
3469
|
"n",
|
|
3388
3470
|
"s",
|
|
3389
3471
|
"e",
|
|
3390
3472
|
"w"
|
|
3391
|
-
],
|
|
3473
|
+
], Pi = [
|
|
3392
3474
|
"n",
|
|
3393
3475
|
"s",
|
|
3394
3476
|
"e",
|
|
@@ -3398,16 +3480,16 @@ var ui = {
|
|
|
3398
3480
|
"se",
|
|
3399
3481
|
"sw"
|
|
3400
3482
|
];
|
|
3401
|
-
function
|
|
3483
|
+
function Fi(e, t) {
|
|
3402
3484
|
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
3485
|
}
|
|
3404
|
-
function
|
|
3486
|
+
function Ii(e, t) {
|
|
3405
3487
|
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
3488
|
return Math.hypot(n, r);
|
|
3407
3489
|
}
|
|
3408
3490
|
function Q(e, t, n) {
|
|
3409
|
-
let r =
|
|
3410
|
-
if (
|
|
3491
|
+
let r = ki[t];
|
|
3492
|
+
if (ji.has(t)) {
|
|
3411
3493
|
let t = e.x + r.x * n, i = e.y + r.y * n;
|
|
3412
3494
|
return {
|
|
3413
3495
|
x: r.x < 0 ? t - e.width : t,
|
|
@@ -3424,9 +3506,9 @@ function Q(e, t, n) {
|
|
|
3424
3506
|
height: e.height
|
|
3425
3507
|
};
|
|
3426
3508
|
}
|
|
3427
|
-
function
|
|
3428
|
-
let r = n.offset ?? .6, i = n.slots === 4 ?
|
|
3429
|
-
...
|
|
3509
|
+
function Li(e, t, n = {}) {
|
|
3510
|
+
let r = n.offset ?? .6, i = n.slots === 4 ? Ni : Ai, a = {
|
|
3511
|
+
...Mi,
|
|
3430
3512
|
...n.weights
|
|
3431
3513
|
}, o = [], s = [];
|
|
3432
3514
|
for (let c of e) {
|
|
@@ -3436,11 +3518,11 @@ function wi(e, t, n = {}) {
|
|
|
3436
3518
|
for (let n = r; n <= r + e + 1e-9; n += u) {
|
|
3437
3519
|
let e = Q(c, t, n), r = !1, o = Infinity;
|
|
3438
3520
|
for (let t of p) {
|
|
3439
|
-
if (t.kind !== "exit" &&
|
|
3521
|
+
if (t.kind !== "exit" && Fi(e, t) > 0) {
|
|
3440
3522
|
r = !0;
|
|
3441
3523
|
break;
|
|
3442
3524
|
}
|
|
3443
|
-
let n =
|
|
3525
|
+
let n = Ii(e, t);
|
|
3444
3526
|
n < o && (o = n);
|
|
3445
3527
|
}
|
|
3446
3528
|
if (r) {
|
|
@@ -3467,7 +3549,7 @@ function wi(e, t, n = {}) {
|
|
|
3467
3549
|
continue;
|
|
3468
3550
|
}
|
|
3469
3551
|
let o = 0;
|
|
3470
|
-
c.preferred ? t === c.preferred && (o -= a.preferred) :
|
|
3552
|
+
c.preferred ? t === c.preferred && (o -= a.preferred) : ji.has(t) && (o += a.diagonal);
|
|
3471
3553
|
let s = -i.value * a.clear + o;
|
|
3472
3554
|
n.onScored && h.push({
|
|
3473
3555
|
dir: t,
|
|
@@ -3490,9 +3572,9 @@ function wi(e, t, n = {}) {
|
|
|
3490
3572
|
off: r,
|
|
3491
3573
|
cost: 0,
|
|
3492
3574
|
clearance: 0
|
|
3493
|
-
}, m.clearance < (n.minClearance ?? 0)) for (let e of
|
|
3575
|
+
}, m.clearance < (n.minClearance ?? 0)) for (let e of Pi) {
|
|
3494
3576
|
let t = Q(c, e, r);
|
|
3495
|
-
if (!p.some((e) => e.kind !== "exit" &&
|
|
3577
|
+
if (!p.some((e) => e.kind !== "exit" && Fi(t, e) > 0)) {
|
|
3496
3578
|
m = {
|
|
3497
3579
|
box: t,
|
|
3498
3580
|
dir: e,
|
|
@@ -3504,7 +3586,7 @@ function wi(e, t, n = {}) {
|
|
|
3504
3586
|
}
|
|
3505
3587
|
}
|
|
3506
3588
|
n.onScored?.(c, h, m.dir);
|
|
3507
|
-
let g =
|
|
3589
|
+
let g = ki[m.dir];
|
|
3508
3590
|
s.push({
|
|
3509
3591
|
id: c.id,
|
|
3510
3592
|
x: m.box.x,
|
|
@@ -3525,7 +3607,7 @@ function wi(e, t, n = {}) {
|
|
|
3525
3607
|
}
|
|
3526
3608
|
//#endregion
|
|
3527
3609
|
//#region src/overlay/WaypointOverlay.ts
|
|
3528
|
-
var
|
|
3610
|
+
var Ri = class {
|
|
3529
3611
|
constructor() {
|
|
3530
3612
|
this.waypoints = [], this.placed = [];
|
|
3531
3613
|
}
|
|
@@ -3597,7 +3679,7 @@ var Ti = class {
|
|
|
3597
3679
|
});
|
|
3598
3680
|
}
|
|
3599
3681
|
if (f.length === 0) return [];
|
|
3600
|
-
let m = "rgba(20, 20, 24, 0.82)", h =
|
|
3682
|
+
let m = "rgba(20, 20, 24, 0.82)", h = Li(f, u, {
|
|
3601
3683
|
offset: a * .7,
|
|
3602
3684
|
extend: a * 4,
|
|
3603
3685
|
clearCap: a * 1.5,
|
|
@@ -3655,11 +3737,11 @@ var Ti = class {
|
|
|
3655
3737
|
width: n.width,
|
|
3656
3738
|
height: n.height
|
|
3657
3739
|
});
|
|
3658
|
-
let C = p[t].lines,
|
|
3740
|
+
let C = p[t].lines, w = (n.height - C.length * c) / 2;
|
|
3659
3741
|
for (let t = 0; t < C.length; t++) g.push({
|
|
3660
3742
|
type: "text",
|
|
3661
3743
|
x: n.x,
|
|
3662
|
-
y: n.y +
|
|
3744
|
+
y: n.y + w + t * c,
|
|
3663
3745
|
width: n.width,
|
|
3664
3746
|
height: c,
|
|
3665
3747
|
text: C[t],
|
|
@@ -3673,7 +3755,7 @@ var Ti = class {
|
|
|
3673
3755
|
}
|
|
3674
3756
|
return g;
|
|
3675
3757
|
}
|
|
3676
|
-
},
|
|
3758
|
+
}, zi = /* @__PURE__ */ A(((e, t) => {
|
|
3677
3759
|
t.exports = class {
|
|
3678
3760
|
constructor() {
|
|
3679
3761
|
this.keys = /* @__PURE__ */ new Set(), this.queue = [];
|
|
@@ -3703,14 +3785,14 @@ var Ti = class {
|
|
|
3703
3785
|
return this.queue.find((t) => t.key === e);
|
|
3704
3786
|
}
|
|
3705
3787
|
};
|
|
3706
|
-
})),
|
|
3788
|
+
})), Bi = /* @__PURE__ */ A(((e, t) => {
|
|
3707
3789
|
function n(e, t) {
|
|
3708
3790
|
let r = /* @__PURE__ */ new Map();
|
|
3709
3791
|
for (let [i, a] of e) i !== t && a instanceof Map ? r.set(i, n(a, t)) : i !== t && r.set(i, a);
|
|
3710
3792
|
return r;
|
|
3711
3793
|
}
|
|
3712
3794
|
t.exports = n;
|
|
3713
|
-
})),
|
|
3795
|
+
})), Vi = /* @__PURE__ */ A(((e, t) => {
|
|
3714
3796
|
function n(e) {
|
|
3715
3797
|
let t = Number(e);
|
|
3716
3798
|
return !(isNaN(t) || t <= 0);
|
|
@@ -3725,7 +3807,7 @@ var Ti = class {
|
|
|
3725
3807
|
}), t;
|
|
3726
3808
|
}
|
|
3727
3809
|
t.exports = r;
|
|
3728
|
-
})),
|
|
3810
|
+
})), Hi = /* @__PURE__ */ A(((e, t) => {
|
|
3729
3811
|
function n(e) {
|
|
3730
3812
|
if (!(e instanceof Map)) throw Error(`Invalid graph: Expected Map instead found ${typeof e}`);
|
|
3731
3813
|
e.forEach((e, t) => {
|
|
@@ -3737,8 +3819,8 @@ var Ti = class {
|
|
|
3737
3819
|
});
|
|
3738
3820
|
}
|
|
3739
3821
|
t.exports = n;
|
|
3740
|
-
})),
|
|
3741
|
-
var n =
|
|
3822
|
+
})), Ui = /* @__PURE__ */ Te((/* @__PURE__ */ A(((e, t) => {
|
|
3823
|
+
var n = zi(), r = Bi(), i = Vi(), a = Hi();
|
|
3742
3824
|
t.exports = class {
|
|
3743
3825
|
constructor(e) {
|
|
3744
3826
|
e instanceof Map ? (a(e), this.graph = e) : e ? this.graph = i(e) : this.graph = /* @__PURE__ */ new Map();
|
|
@@ -3788,7 +3870,7 @@ var Ti = class {
|
|
|
3788
3870
|
return this.path(...e);
|
|
3789
3871
|
}
|
|
3790
3872
|
};
|
|
3791
|
-
})))(), 1),
|
|
3873
|
+
})))(), 1), Wi = {
|
|
3792
3874
|
1: "north",
|
|
3793
3875
|
2: "northeast",
|
|
3794
3876
|
3: "northwest",
|
|
@@ -3801,7 +3883,7 @@ var Ti = class {
|
|
|
3801
3883
|
10: "down",
|
|
3802
3884
|
11: "in",
|
|
3803
3885
|
12: "out"
|
|
3804
|
-
},
|
|
3886
|
+
}, Gi = {
|
|
3805
3887
|
north: "n",
|
|
3806
3888
|
northeast: "ne",
|
|
3807
3889
|
northwest: "nw",
|
|
@@ -3814,7 +3896,7 @@ var Ti = class {
|
|
|
3814
3896
|
down: "down",
|
|
3815
3897
|
in: "in",
|
|
3816
3898
|
out: "out"
|
|
3817
|
-
},
|
|
3899
|
+
}, Ki = class {
|
|
3818
3900
|
constructor(e) {
|
|
3819
3901
|
this.mapReader = e, this.data = this.buildGraph();
|
|
3820
3902
|
}
|
|
@@ -3840,12 +3922,12 @@ var Ti = class {
|
|
|
3840
3922
|
buildGraph() {
|
|
3841
3923
|
let e = /* @__PURE__ */ new Map(), t = {}, n = 1, r = Infinity;
|
|
3842
3924
|
return this.mapReader.getRooms().forEach((i) => {
|
|
3843
|
-
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) =>
|
|
3925
|
+
let a = [], o = {}, s = new Set((i.exitLocks ?? []).map((e) => Wi[e]).filter((e) => !!e)), c = new Set(i.mSpecialExitLocks ?? []);
|
|
3844
3926
|
Object.entries(i.exits ?? {}).forEach(([e, t]) => {
|
|
3845
3927
|
if (s.has(e)) return;
|
|
3846
3928
|
let c = this.mapReader.getRoom(t);
|
|
3847
3929
|
if (c) {
|
|
3848
|
-
let s =
|
|
3930
|
+
let s = Gi[e] ?? e, l = this.resolveEdgeWeight(i, s, c);
|
|
3849
3931
|
a.push({
|
|
3850
3932
|
id: t,
|
|
3851
3933
|
weight: l
|
|
@@ -3876,7 +3958,7 @@ var Ti = class {
|
|
|
3876
3958
|
};
|
|
3877
3959
|
//#endregion
|
|
3878
3960
|
//#region src/PathFinder.ts
|
|
3879
|
-
function
|
|
3961
|
+
function qi(e, t) {
|
|
3880
3962
|
e.push(t);
|
|
3881
3963
|
let n = e.length - 1;
|
|
3882
3964
|
for (; n > 0;) {
|
|
@@ -3885,7 +3967,7 @@ function Pi(e, t) {
|
|
|
3885
3967
|
[e[t], e[n]] = [e[n], e[t]], n = t;
|
|
3886
3968
|
}
|
|
3887
3969
|
}
|
|
3888
|
-
function
|
|
3970
|
+
function Ji(e) {
|
|
3889
3971
|
if (e.length === 0) return;
|
|
3890
3972
|
let t = e[0], n = e.pop();
|
|
3891
3973
|
if (e.length > 0) {
|
|
@@ -3899,16 +3981,16 @@ function Fi(e) {
|
|
|
3899
3981
|
}
|
|
3900
3982
|
return t;
|
|
3901
3983
|
}
|
|
3902
|
-
function
|
|
3984
|
+
function Yi(e, t, n) {
|
|
3903
3985
|
let r = [n], i = n;
|
|
3904
3986
|
for (; i !== t;) i = e.get(i), r.push(i);
|
|
3905
3987
|
return r.reverse(), r;
|
|
3906
3988
|
}
|
|
3907
|
-
function
|
|
3989
|
+
function Xi(e, t, n) {
|
|
3908
3990
|
let r = e.path(t.toString(), n.toString()), i = Array.isArray(r) ? r : r?.path;
|
|
3909
3991
|
return i ? i.map((e) => Number(e)) : null;
|
|
3910
3992
|
}
|
|
3911
|
-
function
|
|
3993
|
+
function Zi(e, t, n, r) {
|
|
3912
3994
|
let i = r.getRoom(n);
|
|
3913
3995
|
if (!i) return null;
|
|
3914
3996
|
let a = i.x, o = i.y, s = i.z, c = r.getMaxEdgeDistance(), l = r.getMinEdgeWeight(), u = (e) => {
|
|
@@ -3917,16 +3999,16 @@ function Ri(e, t, n, r) {
|
|
|
3917
3999
|
let n = t.x - a, i = t.y - o, u = t.z - s;
|
|
3918
4000
|
return Math.sqrt(n * n + i * i + u * u) / c * l;
|
|
3919
4001
|
}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [];
|
|
3920
|
-
for (d.set(t, 0),
|
|
4002
|
+
for (d.set(t, 0), qi(p, {
|
|
3921
4003
|
id: t,
|
|
3922
4004
|
priority: u(t)
|
|
3923
4005
|
}); p.length > 0;) {
|
|
3924
|
-
let { id: r } =
|
|
3925
|
-
if (r === n) return
|
|
4006
|
+
let { id: r } = Ji(p);
|
|
4007
|
+
if (r === n) return Yi(f, t, n);
|
|
3926
4008
|
let i = d.get(r) ?? Infinity, a = e.get(r);
|
|
3927
4009
|
if (a) for (let e of a) {
|
|
3928
4010
|
let t = i + e.weight;
|
|
3929
|
-
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r),
|
|
4011
|
+
t < (d.get(e.id) ?? Infinity) && (d.set(e.id, t), f.set(e.id, r), qi(p, {
|
|
3930
4012
|
id: e.id,
|
|
3931
4013
|
priority: t + u(e.id)
|
|
3932
4014
|
}));
|
|
@@ -3934,9 +4016,9 @@ function Ri(e, t, n, r) {
|
|
|
3934
4016
|
}
|
|
3935
4017
|
return null;
|
|
3936
4018
|
}
|
|
3937
|
-
var
|
|
4019
|
+
var Qi = class {
|
|
3938
4020
|
constructor(e, t = "dijkstra") {
|
|
3939
|
-
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new
|
|
4021
|
+
this.cache = /* @__PURE__ */ new Map(), this._algorithm = t, this.mapGraph = new Ki(e), this.dijkstraGraph = new Ui.default(this.mapGraph.getGraphDefinition());
|
|
3940
4022
|
}
|
|
3941
4023
|
get algorithm() {
|
|
3942
4024
|
return this._algorithm;
|
|
@@ -3955,10 +4037,10 @@ var zi = class {
|
|
|
3955
4037
|
let r;
|
|
3956
4038
|
switch (this._algorithm) {
|
|
3957
4039
|
case "dijkstra":
|
|
3958
|
-
r =
|
|
4040
|
+
r = Xi(this.dijkstraGraph, e, t);
|
|
3959
4041
|
break;
|
|
3960
4042
|
case "astar":
|
|
3961
|
-
r =
|
|
4043
|
+
r = Zi(this.mapGraph.getAdj(), e, t, this.mapGraph);
|
|
3962
4044
|
break;
|
|
3963
4045
|
}
|
|
3964
4046
|
return this.cache.set(n, r), r;
|
|
@@ -3968,10 +4050,10 @@ var zi = class {
|
|
|
3968
4050
|
stub: 1,
|
|
3969
4051
|
full: 0
|
|
3970
4052
|
};
|
|
3971
|
-
function
|
|
4053
|
+
function $i(e, t, n) {
|
|
3972
4054
|
return n === "first" ? e : n === "least-restrictive" ? $[e] < $[t] ? e : t : $[e] > $[t] ? e : t;
|
|
3973
4055
|
}
|
|
3974
|
-
function
|
|
4056
|
+
function ea(e, ...t) {
|
|
3975
4057
|
let n = {}, r;
|
|
3976
4058
|
e && typeof e.isVisible == "function" ? r = [e, ...t] : (n = e ?? {}, r = t);
|
|
3977
4059
|
let i = n.exitStrategy ?? "most-restrictive", a = n.visibility ?? "and";
|
|
@@ -3984,10 +4066,10 @@ function Vi(e, ...t) {
|
|
|
3984
4066
|
},
|
|
3985
4067
|
getExitTreatment(e, t, n) {
|
|
3986
4068
|
let a;
|
|
3987
|
-
for (let
|
|
3988
|
-
let r =
|
|
4069
|
+
for (let o of r) {
|
|
4070
|
+
let r = o.getExitTreatment ? o.getExitTreatment(e, t, n) : d(o, e, t, n);
|
|
3989
4071
|
if (a === void 0) a = r;
|
|
3990
|
-
else if (a =
|
|
4072
|
+
else if (a = $i(a, r, i), i === "first") break;
|
|
3991
4073
|
}
|
|
3992
4074
|
return a ?? "full";
|
|
3993
4075
|
},
|
|
@@ -4000,7 +4082,7 @@ function Vi(e, ...t) {
|
|
|
4000
4082
|
}
|
|
4001
4083
|
//#endregion
|
|
4002
4084
|
//#region src/lens/ExplorationLens.ts
|
|
4003
|
-
var
|
|
4085
|
+
var ta = class {
|
|
4004
4086
|
constructor(e) {
|
|
4005
4087
|
this.version = 0, this.visited = e instanceof Set ? new Set(e) : new Set(e ?? []);
|
|
4006
4088
|
}
|
|
@@ -4035,7 +4117,7 @@ var Hi = class {
|
|
|
4035
4117
|
clear() {
|
|
4036
4118
|
this.visited.size !== 0 && (this.visited.clear(), this.version++);
|
|
4037
4119
|
}
|
|
4038
|
-
},
|
|
4120
|
+
}, na = {
|
|
4039
4121
|
1: "north",
|
|
4040
4122
|
2: "northeast",
|
|
4041
4123
|
3: "northwest",
|
|
@@ -4049,7 +4131,7 @@ var Hi = class {
|
|
|
4049
4131
|
11: "in",
|
|
4050
4132
|
12: "out"
|
|
4051
4133
|
};
|
|
4052
|
-
function
|
|
4134
|
+
function ra() {
|
|
4053
4135
|
return {
|
|
4054
4136
|
areaWidth: 150,
|
|
4055
4137
|
areaHeight: 80,
|
|
@@ -4063,14 +4145,14 @@ function Wi() {
|
|
|
4063
4145
|
highlightColor: "#ff9900"
|
|
4064
4146
|
};
|
|
4065
4147
|
}
|
|
4066
|
-
var
|
|
4148
|
+
var ia = class {
|
|
4067
4149
|
constructor(e, t, 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 ??
|
|
4150
|
+
this.areaNodes = /* @__PURE__ */ new Map(), this.connectionGroups = [], this.currentZoom = 1, this.domainInfo = /* @__PURE__ */ new Map(), this.domainFilter = "all", this.dotsMode = !1, this.settings = n ?? ra(), this.stage = new k.Stage({
|
|
4069
4151
|
container: e,
|
|
4070
4152
|
width: e.clientWidth,
|
|
4071
4153
|
height: e.clientHeight,
|
|
4072
4154
|
draggable: !0
|
|
4073
|
-
}), this.backgroundLayer = new
|
|
4155
|
+
}), this.backgroundLayer = new k.Layer({ listening: !1 }), this.stage.add(this.backgroundLayer), this.connectionLayer = new k.Layer({ listening: !1 }), this.stage.add(this.connectionLayer), this.areaLayer = new k.Layer(), this.stage.add(this.areaLayer), this.mapReader = t, this.initScaling(), this.initResize(e);
|
|
4074
4156
|
}
|
|
4075
4157
|
initResize(e) {
|
|
4076
4158
|
new ResizeObserver(() => {
|
|
@@ -4162,7 +4244,7 @@ var Gi = class {
|
|
|
4162
4244
|
if (this.backgroundLayer.destroyChildren(), !this.backgroundConfig) return;
|
|
4163
4245
|
let e = new Image();
|
|
4164
4246
|
e.crossOrigin = "anonymous", e.onload = () => {
|
|
4165
|
-
this.backgroundImage = new
|
|
4247
|
+
this.backgroundImage = new k.Image({
|
|
4166
4248
|
x: this.backgroundConfig.x,
|
|
4167
4249
|
y: this.backgroundConfig.y,
|
|
4168
4250
|
image: e,
|
|
@@ -4195,16 +4277,16 @@ var Gi = class {
|
|
|
4195
4277
|
roomCount: r.length
|
|
4196
4278
|
});
|
|
4197
4279
|
}
|
|
4198
|
-
let
|
|
4280
|
+
let i = 1;
|
|
4199
4281
|
for (let e of n.values()) {
|
|
4200
4282
|
let t = e.maxX - e.minX, n = e.maxY - e.minY;
|
|
4201
|
-
|
|
4283
|
+
i = Math.max(i, t, n);
|
|
4202
4284
|
}
|
|
4203
|
-
let
|
|
4285
|
+
let a = 200 / i;
|
|
4204
4286
|
for (let e of t) {
|
|
4205
4287
|
let t = e.getAreaId(), r = n.get(t);
|
|
4206
4288
|
if (!r || !this.isAreaInDomain(t)) continue;
|
|
4207
|
-
let
|
|
4289
|
+
let i = r.maxX - r.minX, o = r.maxY - r.minY, s = Math.max(100, i * a), c = Math.max(100, o * a), l = s / c;
|
|
4208
4290
|
l > 3 ? c = s / 3 : l < 1 / 3 && (s = c / 3), this.areaNodes.set(t, {
|
|
4209
4291
|
areaId: t,
|
|
4210
4292
|
name: e.getAreaName(),
|
|
@@ -4218,44 +4300,44 @@ var Gi = class {
|
|
|
4218
4300
|
realCenterY: r.centerY
|
|
4219
4301
|
});
|
|
4220
4302
|
}
|
|
4221
|
-
let
|
|
4303
|
+
let o = /* @__PURE__ */ new Map();
|
|
4222
4304
|
for (let t of e) {
|
|
4223
4305
|
let e = t.area;
|
|
4224
4306
|
if (!this.areaNodes.has(e)) continue;
|
|
4225
4307
|
let n = this.getLockedDirections(t), r = new Set(t.mSpecialExitLocks ?? []);
|
|
4226
4308
|
for (let [r, i] of Object.entries(t.exits ?? {})) {
|
|
4227
4309
|
if (n.has(r)) continue;
|
|
4228
|
-
let
|
|
4229
|
-
if (!
|
|
4230
|
-
let s = this.createConnection(t,
|
|
4231
|
-
s && this.addConnection(
|
|
4310
|
+
let a = this.mapReader.getRoom(i);
|
|
4311
|
+
if (!a || a.area === e || !this.areaNodes.has(a.area) || !this.areAreasInSameDomain(e, a.area)) continue;
|
|
4312
|
+
let s = this.createConnection(t, a, r);
|
|
4313
|
+
s && this.addConnection(o, s);
|
|
4232
4314
|
}
|
|
4233
4315
|
for (let [n, i] of Object.entries(t.specialExits ?? {})) {
|
|
4234
4316
|
if (r.has(i)) continue;
|
|
4235
|
-
let
|
|
4236
|
-
if (!
|
|
4237
|
-
let s = this.parseDirection(n), c = this.createConnection(t,
|
|
4238
|
-
c && this.addConnection(
|
|
4317
|
+
let a = this.mapReader.getRoom(i);
|
|
4318
|
+
if (!a || a.area === e || !this.areaNodes.has(a.area) || !this.areAreasInSameDomain(e, a.area)) continue;
|
|
4319
|
+
let s = this.parseDirection(n), c = this.createConnection(t, a, s);
|
|
4320
|
+
c && this.addConnection(o, c);
|
|
4239
4321
|
}
|
|
4240
4322
|
}
|
|
4241
|
-
for (let [e, t] of
|
|
4242
|
-
let [n,
|
|
4243
|
-
this.connectionGroups.push(
|
|
4244
|
-
let
|
|
4245
|
-
if (
|
|
4323
|
+
for (let [e, t] of o) {
|
|
4324
|
+
let [n, i] = e.split("-").map(Number), a = this.createConnectionGroup(n, i, t);
|
|
4325
|
+
this.connectionGroups.push(a);
|
|
4326
|
+
let o = this.areaNodes.get(n), s = this.areaNodes.get(i);
|
|
4327
|
+
if (o && o.connections.push(...t), s) for (let e of t) s.connections.push({
|
|
4246
4328
|
...e,
|
|
4247
4329
|
fromAreaId: e.toAreaId,
|
|
4248
4330
|
toAreaId: e.fromAreaId,
|
|
4249
4331
|
fromRoomId: e.toRoomId,
|
|
4250
4332
|
toRoomId: e.fromRoomId,
|
|
4251
|
-
direction: e.direction ?
|
|
4333
|
+
direction: e.direction ? r[e.direction] : null,
|
|
4252
4334
|
fromRoomPosition: e.toRoomPosition,
|
|
4253
4335
|
toRoomPosition: e.fromRoomPosition
|
|
4254
4336
|
});
|
|
4255
4337
|
}
|
|
4256
4338
|
}
|
|
4257
4339
|
getLockedDirections(e) {
|
|
4258
|
-
return new Set((e.exitLocks ?? []).map((e) =>
|
|
4340
|
+
return new Set((e.exitLocks ?? []).map((e) => na[e]).filter((e) => !!e));
|
|
4259
4341
|
}
|
|
4260
4342
|
createConnection(e, t, n) {
|
|
4261
4343
|
let r = this.toPlanarDirection(n);
|
|
@@ -4324,7 +4406,7 @@ var Gi = class {
|
|
|
4324
4406
|
}[e.toLowerCase().trim()] ?? null;
|
|
4325
4407
|
}
|
|
4326
4408
|
toPlanarDirection(e) {
|
|
4327
|
-
return e &&
|
|
4409
|
+
return e && f.includes(e) ? e : null;
|
|
4328
4410
|
}
|
|
4329
4411
|
layoutAreas() {
|
|
4330
4412
|
if (Array.from(this.areaNodes.values()).length === 0) return;
|
|
@@ -4717,7 +4799,7 @@ var Gi = class {
|
|
|
4717
4799
|
y: n.y + n.height / 2
|
|
4718
4800
|
}, a, o;
|
|
4719
4801
|
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;
|
|
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
|
|
4802
|
+
let s = this.dotsMode ? "#ffffff" : this.settings.connectionColor, c = this.dotsMode ? 1 : Math.min(this.settings.connectionLineWidth, 1 + e.connections.length * .5), l = new k.Line({
|
|
4721
4803
|
points: [
|
|
4722
4804
|
a.x,
|
|
4723
4805
|
a.y,
|
|
@@ -4750,16 +4832,16 @@ var Gi = class {
|
|
|
4750
4832
|
if (!isFinite(e.x) || !isFinite(e.y)) continue;
|
|
4751
4833
|
let t = e.areaId === this.highlightedArea;
|
|
4752
4834
|
if (this.dotsMode) {
|
|
4753
|
-
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new
|
|
4835
|
+
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = new k.Group({
|
|
4754
4836
|
x: n,
|
|
4755
4837
|
y: r,
|
|
4756
4838
|
draggable: !0
|
|
4757
|
-
}), a = new
|
|
4839
|
+
}), a = new k.Circle({
|
|
4758
4840
|
radius: 6,
|
|
4759
4841
|
fill: t ? this.settings.highlightColor : "#ffffff",
|
|
4760
4842
|
stroke: t ? this.settings.highlightColor : "#ffffff",
|
|
4761
4843
|
strokeWidth: 1
|
|
4762
|
-
}), o = new
|
|
4844
|
+
}), o = new k.Text({
|
|
4763
4845
|
text: e.name,
|
|
4764
4846
|
fontSize: 10,
|
|
4765
4847
|
fill: "#ffffff",
|
|
@@ -4780,18 +4862,18 @@ var Gi = class {
|
|
|
4780
4862
|
this.stage.container().style.cursor = "pointer";
|
|
4781
4863
|
}), this.areaLayer.add(i);
|
|
4782
4864
|
} else {
|
|
4783
|
-
let n = new
|
|
4865
|
+
let n = new k.Group({
|
|
4784
4866
|
x: e.x,
|
|
4785
4867
|
y: e.y,
|
|
4786
4868
|
draggable: !0
|
|
4787
|
-
}), r = new
|
|
4869
|
+
}), r = new k.Rect({
|
|
4788
4870
|
width: e.width,
|
|
4789
4871
|
height: e.height,
|
|
4790
4872
|
fill: this.settings.areaFillColor,
|
|
4791
4873
|
stroke: t ? this.settings.highlightColor : this.settings.areaStrokeColor,
|
|
4792
4874
|
strokeWidth: t ? 3 : 2,
|
|
4793
4875
|
cornerRadius: 8
|
|
4794
|
-
}), i = new
|
|
4876
|
+
}), i = new k.Text({
|
|
4795
4877
|
text: e.name,
|
|
4796
4878
|
fontSize: this.settings.fontSize,
|
|
4797
4879
|
fill: this.settings.textColor,
|
|
@@ -4803,7 +4885,7 @@ var Gi = class {
|
|
|
4803
4885
|
verticalAlign: "middle",
|
|
4804
4886
|
ellipsis: !0,
|
|
4805
4887
|
wrap: "word"
|
|
4806
|
-
}), a = new
|
|
4888
|
+
}), a = new k.Text({
|
|
4807
4889
|
text: `${e.roomCount} rooms`,
|
|
4808
4890
|
fontSize: 10,
|
|
4809
4891
|
fill: this.settings.connectionColor,
|
|
@@ -4867,6 +4949,6 @@ var Gi = class {
|
|
|
4867
4949
|
}
|
|
4868
4950
|
};
|
|
4869
4951
|
//#endregion
|
|
4870
|
-
export {
|
|
4952
|
+
export { u as ALL_VISIBLE, wi as AmbientLightOverlay, he as Area, ia as AreaMapRenderer, Mr as Blueprint, D as Camera, _i as CanvasExporter, Ir as Construction, ne as CullingManager, Ur as DarkModern, ze as DrawCommandLayerNode, ta as ExplorationLens, Rr as GradientRooms, Br as GraphPaper, oe as HitTester, e as IDENTITY_TRANSFORM, Fr as Isometric, Ki as MapGraph, _e as MapReader, Gr as MapRenderer, Ae as MapState, Be as MaterializingLayerNode, Nr as Neon, jr as Parchment, Qi as PathFinder, ge as Plane, hi as PngBlobExporter, vi as PngBytesExporter, mi as PngExporter, ee as ProjectedMapReader, a as ROOM_UI_BORDER_COLOR, c as ROOM_UI_BORDER_THICKNESS, l as ROOM_UI_HIDDEN, Le as RecordingGroupNode, N as RecordingLayerNode, Oi as RippleEffect, Lr as SciFi, Pr as Sketchy, zr as StainedGlass, pi as SvgExporter, Vr as Topographic, Wr as TreasureMap, Hr as Watercolor, Ri as WaypointOverlay, O as applyStyleToShapes, qr as buildDrawCommands, gi as canvasToBytes, s as colorLightness, te as compose, ea as composeLenses, b as computeNeighborSpill, se as computePathData, ra as createAreaMapSettings, ke as createSettings, _ as darkenColor, d as defaultExitTreatment, m as getRoomBorderColor, me as getRoomBorderThickness, y as hexToRgba, x as identityStyle, Ve as isGradientFill, v as isRoomHidden, Li as placeLabels, ue as projectRoom, si as renderToCanvas, Ue as shapeToRecording, pe as spillPositionMap, ri as svgFromBatches, P as transformFill, Ar as treasureMapDecorations };
|
|
4871
4953
|
|
|
4872
4954
|
//# sourceMappingURL=index.mjs.map
|