@seatmap-fyi/map-domain 0.1.0-alpha.58 → 0.1.0-alpha.60
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/catalog.d.ts +2 -1
- package/dist/catalog.js +1 -0
- package/dist/layers.d.ts +2 -1
- package/dist/layers.js +8 -1
- package/dist/physical-document.interface.d.ts +2 -0
- package/dist/schema.d.ts +21 -0
- package/dist/schema.js +2 -0
- package/dist/section-layout.d.ts +51 -2
- package/dist/section-layout.interface.d.ts +2 -1
- package/dist/section-layout.js +43 -14
- package/dist/section-scale.d.ts +6 -1
- package/dist/section-scale.js +77 -15
- package/package.json +1 -1
package/dist/catalog.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PhysicalDocumentV1, SeatingGroup, InventoryArea, UUID } from "./physical-document.interface.js";
|
|
1
|
+
import type { Decoration, PhysicalDocumentV1, SeatingGroup, InventoryArea, UUID } from "./physical-document.interface.js";
|
|
2
2
|
import { type SegmentedRowEntry } from "./row-segments.js";
|
|
3
3
|
import { type GeneratedSeat } from "./geometry/geometry.js";
|
|
4
4
|
export type DocumentSeat = GeneratedSeat & {
|
|
@@ -7,6 +7,7 @@ export type DocumentSeat = GeneratedSeat & {
|
|
|
7
7
|
/** Geometry remains shared; logical addresses are projected from the current document. */
|
|
8
8
|
export declare function documentGroupSeats(document: PhysicalDocumentV1, group: SeatingGroup): readonly DocumentSeat[];
|
|
9
9
|
export type DocumentCatalog = {
|
|
10
|
+
decorations: ReadonlyMap<UUID, Decoration>;
|
|
10
11
|
groups: ReadonlyMap<UUID, SeatingGroup>;
|
|
11
12
|
areas: ReadonlyMap<UUID, InventoryArea>;
|
|
12
13
|
seats: ReadonlyMap<UUID, {
|
package/dist/catalog.js
CHANGED
|
@@ -68,6 +68,7 @@ export function documentCatalog(document) {
|
|
|
68
68
|
rows.set(seat.rowId, group);
|
|
69
69
|
}
|
|
70
70
|
catalog = {
|
|
71
|
+
decorations: new Map(document.decorations.map((decoration) => [decoration.id, decoration])),
|
|
71
72
|
groups,
|
|
72
73
|
areas: new Map(document.areas.map((area) => [area.id, area])),
|
|
73
74
|
seats,
|
package/dist/layers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
|
|
1
|
+
import { type Decoration, type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
|
|
2
|
+
export declare function isOrdinaryShape(decoration?: Decoration): boolean;
|
|
2
3
|
export type LayerEntry = {
|
|
3
4
|
id: UUID;
|
|
4
5
|
parentId: UUID | null;
|
package/dist/layers.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { ReferencePlanLayer, SeatingKind, } from "./physical-document.interface.js";
|
|
1
|
+
import { DecorationKind, ReferencePlanLayer, SeatingKind, } from "./physical-document.interface.js";
|
|
2
2
|
import { isReferencePlan } from "./media.js";
|
|
3
|
+
export function isOrdinaryShape(decoration) {
|
|
4
|
+
if (decoration?.kind !== DecorationKind.Rectangle && decoration?.kind !== DecorationKind.Polygon)
|
|
5
|
+
return false;
|
|
6
|
+
if (decoration.gate || decoration.landmark || decoration.wayfindingBlock)
|
|
7
|
+
return false;
|
|
8
|
+
return decoration.kind === DecorationKind.Rectangle || !decoration.stage;
|
|
9
|
+
}
|
|
3
10
|
const catalogs = new WeakMap();
|
|
4
11
|
/**
|
|
5
12
|
* @method layerCatalog
|
|
@@ -418,6 +418,8 @@ export type InventoryArea = InventoryAreaBase & ({
|
|
|
418
418
|
kind: AreaKind.Booth;
|
|
419
419
|
});
|
|
420
420
|
export type DecorationStyle = {
|
|
421
|
+
/** Records explicit shape opacity, including the default fully opaque value. */
|
|
422
|
+
opacityAuthored?: true;
|
|
421
423
|
fill?: Paint;
|
|
422
424
|
stroke?: Paint;
|
|
423
425
|
strokeWidthM?: number;
|
package/dist/schema.d.ts
CHANGED
|
@@ -1039,6 +1039,7 @@ export declare const groupSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1039
1039
|
}, z.core.$strict>], "kind">>;
|
|
1040
1040
|
}, z.core.$strict>], "kind">;
|
|
1041
1041
|
export declare const decorationStyleSchema: z.ZodObject<{
|
|
1042
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1042
1043
|
fill: z.ZodOptional<z.ZodObject<{
|
|
1043
1044
|
color: z.ZodString;
|
|
1044
1045
|
opacity: z.ZodNumber;
|
|
@@ -1196,6 +1197,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
1196
1197
|
outlineGrowthFactor: z.ZodOptional<z.ZodNumber>;
|
|
1197
1198
|
rowRefitStrength: z.ZodOptional<z.ZodNumber>;
|
|
1198
1199
|
style: z.ZodOptional<z.ZodObject<{
|
|
1200
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1199
1201
|
fill: z.ZodOptional<z.ZodObject<{
|
|
1200
1202
|
color: z.ZodString;
|
|
1201
1203
|
opacity: z.ZodNumber;
|
|
@@ -2336,6 +2338,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2336
2338
|
label: z.ZodOptional<z.ZodString>;
|
|
2337
2339
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2338
2340
|
style: z.ZodOptional<z.ZodObject<{
|
|
2341
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2339
2342
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2340
2343
|
color: z.ZodString;
|
|
2341
2344
|
opacity: z.ZodNumber;
|
|
@@ -2377,6 +2380,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2377
2380
|
label: z.ZodOptional<z.ZodString>;
|
|
2378
2381
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2379
2382
|
style: z.ZodOptional<z.ZodObject<{
|
|
2383
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2380
2384
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2381
2385
|
color: z.ZodString;
|
|
2382
2386
|
opacity: z.ZodNumber;
|
|
@@ -2407,6 +2411,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2407
2411
|
label: z.ZodOptional<z.ZodString>;
|
|
2408
2412
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2409
2413
|
style: z.ZodOptional<z.ZodObject<{
|
|
2414
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2410
2415
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2411
2416
|
color: z.ZodString;
|
|
2412
2417
|
opacity: z.ZodNumber;
|
|
@@ -2447,6 +2452,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2447
2452
|
label: z.ZodOptional<z.ZodString>;
|
|
2448
2453
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2449
2454
|
style: z.ZodOptional<z.ZodObject<{
|
|
2455
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2450
2456
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2451
2457
|
color: z.ZodString;
|
|
2452
2458
|
opacity: z.ZodNumber;
|
|
@@ -2521,6 +2527,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2521
2527
|
label: z.ZodOptional<z.ZodString>;
|
|
2522
2528
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2523
2529
|
style: z.ZodOptional<z.ZodObject<{
|
|
2530
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2524
2531
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2525
2532
|
color: z.ZodString;
|
|
2526
2533
|
opacity: z.ZodNumber;
|
|
@@ -2554,6 +2561,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2554
2561
|
label: z.ZodOptional<z.ZodString>;
|
|
2555
2562
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2556
2563
|
style: z.ZodOptional<z.ZodObject<{
|
|
2564
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2557
2565
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2558
2566
|
color: z.ZodString;
|
|
2559
2567
|
opacity: z.ZodNumber;
|
|
@@ -2611,6 +2619,7 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
2611
2619
|
label: z.ZodOptional<z.ZodString>;
|
|
2612
2620
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2613
2621
|
style: z.ZodOptional<z.ZodObject<{
|
|
2622
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2614
2623
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2615
2624
|
color: z.ZodString;
|
|
2616
2625
|
opacity: z.ZodNumber;
|
|
@@ -2784,6 +2793,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2784
2793
|
label: z.ZodOptional<z.ZodString>;
|
|
2785
2794
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2786
2795
|
style: z.ZodOptional<z.ZodObject<{
|
|
2796
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2787
2797
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2788
2798
|
color: z.ZodString;
|
|
2789
2799
|
opacity: z.ZodNumber;
|
|
@@ -2825,6 +2835,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2825
2835
|
label: z.ZodOptional<z.ZodString>;
|
|
2826
2836
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2827
2837
|
style: z.ZodOptional<z.ZodObject<{
|
|
2838
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2828
2839
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2829
2840
|
color: z.ZodString;
|
|
2830
2841
|
opacity: z.ZodNumber;
|
|
@@ -2855,6 +2866,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2855
2866
|
label: z.ZodOptional<z.ZodString>;
|
|
2856
2867
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2857
2868
|
style: z.ZodOptional<z.ZodObject<{
|
|
2869
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2858
2870
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2859
2871
|
color: z.ZodString;
|
|
2860
2872
|
opacity: z.ZodNumber;
|
|
@@ -2895,6 +2907,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2895
2907
|
label: z.ZodOptional<z.ZodString>;
|
|
2896
2908
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2897
2909
|
style: z.ZodOptional<z.ZodObject<{
|
|
2910
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2898
2911
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2899
2912
|
color: z.ZodString;
|
|
2900
2913
|
opacity: z.ZodNumber;
|
|
@@ -2969,6 +2982,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2969
2982
|
label: z.ZodOptional<z.ZodString>;
|
|
2970
2983
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
2971
2984
|
style: z.ZodOptional<z.ZodObject<{
|
|
2985
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2972
2986
|
fill: z.ZodOptional<z.ZodObject<{
|
|
2973
2987
|
color: z.ZodString;
|
|
2974
2988
|
opacity: z.ZodNumber;
|
|
@@ -3002,6 +3016,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3002
3016
|
label: z.ZodOptional<z.ZodString>;
|
|
3003
3017
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
3004
3018
|
style: z.ZodOptional<z.ZodObject<{
|
|
3019
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
3005
3020
|
fill: z.ZodOptional<z.ZodObject<{
|
|
3006
3021
|
color: z.ZodString;
|
|
3007
3022
|
opacity: z.ZodNumber;
|
|
@@ -3059,6 +3074,7 @@ export declare const decorationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
3059
3074
|
label: z.ZodOptional<z.ZodString>;
|
|
3060
3075
|
heightM: z.ZodOptional<z.ZodNumber>;
|
|
3061
3076
|
style: z.ZodOptional<z.ZodObject<{
|
|
3077
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
3062
3078
|
fill: z.ZodOptional<z.ZodObject<{
|
|
3063
3079
|
color: z.ZodString;
|
|
3064
3080
|
opacity: z.ZodNumber;
|
|
@@ -3165,6 +3181,7 @@ export declare const sectionSchema: z.ZodObject<{
|
|
|
3165
3181
|
outlineGrowthFactor: z.ZodOptional<z.ZodNumber>;
|
|
3166
3182
|
rowRefitStrength: z.ZodOptional<z.ZodNumber>;
|
|
3167
3183
|
style: z.ZodOptional<z.ZodObject<{
|
|
3184
|
+
opacityAuthored: z.ZodOptional<z.ZodLiteral<true>>;
|
|
3168
3185
|
fill: z.ZodOptional<z.ZodObject<{
|
|
3169
3186
|
color: z.ZodString;
|
|
3170
3187
|
opacity: z.ZodNumber;
|
|
@@ -3215,6 +3232,10 @@ export declare const zonesSchema: z.ZodArray<z.ZodObject<{
|
|
|
3215
3232
|
export declare const uuidSchema: z.ZodString;
|
|
3216
3233
|
export declare const dimensionSchema: z.ZodNumber;
|
|
3217
3234
|
export declare const coordinateSchema: z.ZodNumber;
|
|
3235
|
+
export declare const pointSchema: z.ZodObject<{
|
|
3236
|
+
x: z.ZodNumber;
|
|
3237
|
+
y: z.ZodNumber;
|
|
3238
|
+
}, z.core.$strict>;
|
|
3218
3239
|
export declare const rotationSchema: z.ZodNumber;
|
|
3219
3240
|
export declare const positiveCountSchema: z.ZodNumber;
|
|
3220
3241
|
export declare const labelSequenceSchema: z.ZodObject<{
|
package/dist/schema.js
CHANGED
|
@@ -412,6 +412,7 @@ export const groupSchema = z.discriminatedUnion("kind", [
|
|
|
412
412
|
.refine(tableSellingValid, "Table selling requires valid guest limits and no personal chair settings."),
|
|
413
413
|
]);
|
|
414
414
|
export const decorationStyleSchema = z.strictObject({
|
|
415
|
+
opacityAuthored: z.literal(true).optional(),
|
|
415
416
|
fill: paint.optional(),
|
|
416
417
|
stroke: paint.optional(),
|
|
417
418
|
strokeWidthM: nonNegative.optional(),
|
|
@@ -704,6 +705,7 @@ export const zonesSchema = documentSchema.shape.zones.unwrap();
|
|
|
704
705
|
export const uuidSchema = uuid;
|
|
705
706
|
export const dimensionSchema = dimension;
|
|
706
707
|
export const coordinateSchema = coordinate;
|
|
708
|
+
export const pointSchema = point;
|
|
707
709
|
export const rotationSchema = angle;
|
|
708
710
|
export const positiveCountSchema = finite.int().min(1).max(DocumentLimits.PhysicalSeats);
|
|
709
711
|
export const labelSequenceSchema = sequence;
|
package/dist/section-layout.d.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type PhysicalDocumentV1 } from "./physical-document.interface.js";
|
|
3
3
|
import { SectionLayoutSaveKind, type SectionTransformInput } from "./section-layout.interface.js";
|
|
4
|
-
export { SectionLayoutSaveKind, type SectionLayoutInput, type SectionTransformInput, } from "./section-layout.interface.js";
|
|
4
|
+
export { SectionLayoutSaveKind, type SectionCornerScaleInput, type SectionLayoutInput, type SectionTransformInput, } from "./section-layout.interface.js";
|
|
5
5
|
export declare const sectionRotationInputSchema: z.ZodObject<{
|
|
6
6
|
sectionId: z.ZodUUID;
|
|
7
7
|
rotationDeg: z.ZodNumber;
|
|
8
8
|
}, z.core.$strict>;
|
|
9
|
+
export declare const sectionCornerScaleInputSchema: z.ZodObject<{
|
|
10
|
+
sectionId: z.ZodUUID;
|
|
11
|
+
scaleFactor: z.ZodNumber;
|
|
12
|
+
pivotM: z.ZodObject<{
|
|
13
|
+
x: z.ZodNumber;
|
|
14
|
+
y: z.ZodNumber;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
}, z.core.$strict>;
|
|
9
17
|
export declare const sectionTransformInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
10
18
|
sectionId: z.ZodUUID;
|
|
11
19
|
rotationDeg: z.ZodNumber;
|
|
20
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
21
|
+
sectionId: z.ZodUUID;
|
|
22
|
+
rotationDeltaDeg: z.ZodNumber;
|
|
12
23
|
}, z.core.$strict>, z.ZodObject<{
|
|
13
24
|
sectionId: z.ZodUUID;
|
|
14
25
|
scalePercent: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
27
|
+
sectionId: z.ZodUUID;
|
|
28
|
+
scaleFactor: z.ZodNumber;
|
|
29
|
+
pivotM: z.ZodObject<{
|
|
30
|
+
x: z.ZodNumber;
|
|
31
|
+
y: z.ZodNumber;
|
|
32
|
+
}, z.core.$strict>;
|
|
15
33
|
}, z.core.$strict>]>;
|
|
16
34
|
export declare const sectionLayoutInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
17
35
|
sectionId: z.ZodUUID;
|
|
@@ -20,9 +38,19 @@ export declare const sectionLayoutInputSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
20
38
|
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
21
39
|
sectionId: z.ZodUUID;
|
|
22
40
|
rotationDeg: z.ZodNumber;
|
|
41
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
42
|
+
sectionId: z.ZodUUID;
|
|
43
|
+
rotationDeltaDeg: z.ZodNumber;
|
|
23
44
|
}, z.core.$strict>, z.ZodObject<{
|
|
24
45
|
sectionId: z.ZodUUID;
|
|
25
46
|
scalePercent: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
sectionId: z.ZodUUID;
|
|
49
|
+
scaleFactor: z.ZodNumber;
|
|
50
|
+
pivotM: z.ZodObject<{
|
|
51
|
+
x: z.ZodNumber;
|
|
52
|
+
y: z.ZodNumber;
|
|
53
|
+
}, z.core.$strict>;
|
|
26
54
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
27
55
|
sectionId: z.ZodUUID;
|
|
28
56
|
fill: z.ZodObject<{
|
|
@@ -50,9 +78,19 @@ export declare const sectionLayoutSaveSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
50
78
|
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
51
79
|
sectionId: z.ZodUUID;
|
|
52
80
|
rotationDeg: z.ZodNumber;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
sectionId: z.ZodUUID;
|
|
83
|
+
rotationDeltaDeg: z.ZodNumber;
|
|
53
84
|
}, z.core.$strict>, z.ZodObject<{
|
|
54
85
|
sectionId: z.ZodUUID;
|
|
55
86
|
scalePercent: z.ZodNumber;
|
|
87
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
88
|
+
sectionId: z.ZodUUID;
|
|
89
|
+
scaleFactor: z.ZodNumber;
|
|
90
|
+
pivotM: z.ZodObject<{
|
|
91
|
+
x: z.ZodNumber;
|
|
92
|
+
y: z.ZodNumber;
|
|
93
|
+
}, z.core.$strict>;
|
|
56
94
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
57
95
|
sectionId: z.ZodUUID;
|
|
58
96
|
fill: z.ZodObject<{
|
|
@@ -80,9 +118,19 @@ export declare const sectionLayoutSaveSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
80
118
|
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
81
119
|
sectionId: z.ZodUUID;
|
|
82
120
|
rotationDeg: z.ZodNumber;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
sectionId: z.ZodUUID;
|
|
123
|
+
rotationDeltaDeg: z.ZodNumber;
|
|
83
124
|
}, z.core.$strict>, z.ZodObject<{
|
|
84
125
|
sectionId: z.ZodUUID;
|
|
85
126
|
scalePercent: z.ZodNumber;
|
|
127
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
128
|
+
sectionId: z.ZodUUID;
|
|
129
|
+
scaleFactor: z.ZodNumber;
|
|
130
|
+
pivotM: z.ZodObject<{
|
|
131
|
+
x: z.ZodNumber;
|
|
132
|
+
y: z.ZodNumber;
|
|
133
|
+
}, z.core.$strict>;
|
|
86
134
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
87
135
|
sectionId: z.ZodUUID;
|
|
88
136
|
fill: z.ZodObject<{
|
|
@@ -103,5 +151,6 @@ export declare const sectionLayoutSaveSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
103
151
|
}, z.core.$strict>]>;
|
|
104
152
|
beforeRevision: z.ZodNumber;
|
|
105
153
|
}, z.core.$strict>], "kind">;
|
|
106
|
-
|
|
154
|
+
export declare function sectionCornerScaleMinimum(document: PhysicalDocumentV1, sectionId: SectionTransformInput["sectionId"]): number;
|
|
155
|
+
/** Transform the existing outline and its editable contents. */
|
|
107
156
|
export declare function transformSection(document: PhysicalDocumentV1, input: SectionTransformInput): PhysicalDocumentV1 | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import type { sectionLayoutInputSchema, sectionTransformInputSchema } from "./section-layout.js";
|
|
2
|
+
import type { sectionCornerScaleInputSchema, sectionLayoutInputSchema, sectionTransformInputSchema } from "./section-layout.js";
|
|
3
3
|
export declare enum SectionLayoutSaveKind {
|
|
4
4
|
Apply = "apply",
|
|
5
5
|
Undo = "undo"
|
|
6
6
|
}
|
|
7
|
+
export type SectionCornerScaleInput = z.infer<typeof sectionCornerScaleInputSchema>;
|
|
7
8
|
export type SectionTransformInput = z.infer<typeof sectionTransformInputSchema>;
|
|
8
9
|
export type SectionLayoutInput = z.infer<typeof sectionLayoutInputSchema>;
|
package/dist/section-layout.js
CHANGED
|
@@ -9,18 +9,33 @@ import { sectionGrowInputSchema } from "./section-fill.js";
|
|
|
9
9
|
import { sectionRefitInputSchema } from "./section-refit.js";
|
|
10
10
|
import { sectionOutlineSampleCenter, sectionOutlineSamplingScale } from "./section-outline-refit.js";
|
|
11
11
|
import { SectionLayoutSaveKind } from "./section-layout.interface.js";
|
|
12
|
+
import { pointSchema } from "./schema.js";
|
|
12
13
|
import { sectionCatalog } from "./sections.js";
|
|
13
|
-
import { scaleSectionLayout } from "./section-scale.js";
|
|
14
|
+
import { minimumCornerScale, scaleSectionLayout } from "./section-scale.js";
|
|
14
15
|
export { SectionLayoutSaveKind, } from "./section-layout.interface.js";
|
|
15
16
|
export const sectionRotationInputSchema = z.strictObject({
|
|
16
17
|
sectionId: z.uuid(),
|
|
17
18
|
rotationDeg: z.number().int().min(SectionRotation.min).max(SectionRotation.max),
|
|
18
19
|
});
|
|
20
|
+
const sectionGripRotationInputSchema = z.strictObject({
|
|
21
|
+
sectionId: z.uuid(),
|
|
22
|
+
rotationDeltaDeg: z.number().min(SectionRotation.min).max(SectionRotation.max),
|
|
23
|
+
});
|
|
19
24
|
const sectionScaleInputSchema = z.strictObject({
|
|
20
25
|
sectionId: z.uuid(),
|
|
21
26
|
scalePercent: z.number().min(SectionScale.min).max(SectionScale.max),
|
|
22
27
|
});
|
|
23
|
-
export const
|
|
28
|
+
export const sectionCornerScaleInputSchema = z.strictObject({
|
|
29
|
+
sectionId: z.uuid(),
|
|
30
|
+
scaleFactor: z.number().positive(),
|
|
31
|
+
pivotM: pointSchema,
|
|
32
|
+
});
|
|
33
|
+
export const sectionTransformInputSchema = z.union([
|
|
34
|
+
sectionRotationInputSchema,
|
|
35
|
+
sectionGripRotationInputSchema,
|
|
36
|
+
sectionScaleInputSchema,
|
|
37
|
+
sectionCornerScaleInputSchema,
|
|
38
|
+
]);
|
|
24
39
|
export const sectionLayoutInputSchema = z.union([
|
|
25
40
|
sectionRefitInputSchema,
|
|
26
41
|
sectionTransformInputSchema,
|
|
@@ -37,37 +52,51 @@ export const sectionLayoutSaveSchema = z.discriminatedUnion("kind", [
|
|
|
37
52
|
beforeRevision: z.number().int().positive(),
|
|
38
53
|
}),
|
|
39
54
|
]);
|
|
40
|
-
|
|
55
|
+
export function sectionCornerScaleMinimum(document, sectionId) {
|
|
56
|
+
const entry = sectionCatalog(document).entries.get(sectionId);
|
|
57
|
+
return minimumCornerScale(document, entry?.editableObjects ?? new Set());
|
|
58
|
+
}
|
|
59
|
+
/** Transform the existing outline and its editable contents. */
|
|
41
60
|
export function transformSection(document, input) {
|
|
42
61
|
const { sectionId } = input;
|
|
43
62
|
const section = document.sections.find(({ id }) => id === sectionId);
|
|
44
63
|
if (!section?.outline)
|
|
45
64
|
return;
|
|
46
65
|
const { outline } = section;
|
|
47
|
-
const currentScale = section.scalePercent ?? SectionScale.initial;
|
|
48
|
-
const currentRotation = section.rotationDeg ?? SectionRotation.initial;
|
|
49
|
-
const scaling = "scalePercent" in input;
|
|
50
|
-
if (scaling ? input.scalePercent === currentScale : input.rotationDeg === currentRotation)
|
|
51
|
-
return document;
|
|
52
66
|
const entry = sectionCatalog(document).entries.get(sectionId);
|
|
53
|
-
|
|
67
|
+
if ("scaleFactor" in input) {
|
|
68
|
+
const factor = Math.max(minimumCornerScale(document, entry.editableObjects), input.scaleFactor);
|
|
69
|
+
if (factor === 1)
|
|
70
|
+
return document;
|
|
71
|
+
return scaleSectionLayout(document, sectionId, entry.editableObjects, { pivot: input.pivotM, factor });
|
|
72
|
+
}
|
|
73
|
+
const gripRotation = "rotationDeltaDeg" in input;
|
|
74
|
+
const curved = !gripRotation && (outline.edgeCurvature?.some(Boolean) || polygonCornerFillets(outline).some(Boolean));
|
|
54
75
|
const sampleCenter = curved ? sectionOutlineSampleCenter(outline, sectionOutlineSamplingScale(section)) : undefined;
|
|
55
|
-
if (
|
|
76
|
+
if ("scalePercent" in input) {
|
|
56
77
|
const { scalePercent } = input;
|
|
78
|
+
const currentScale = section.scalePercent ?? SectionScale.initial;
|
|
79
|
+
if (scalePercent === currentScale)
|
|
80
|
+
return document;
|
|
57
81
|
const factor = scalePercent / currentScale;
|
|
58
82
|
const { minX, minY, maxX, maxY } = pointsBounds(outline.outer);
|
|
59
83
|
const pivot = sampleCenter ?? { x: (minX + maxX) / 2, y: (minY + maxY) / 2 };
|
|
60
|
-
return scaleSectionLayout(document, sectionId, entry.editableObjects, pivot,
|
|
84
|
+
return scaleSectionLayout(document, sectionId, entry.editableObjects, { pivot, factor, scalePercent });
|
|
61
85
|
}
|
|
62
|
-
const
|
|
63
|
-
|
|
86
|
+
const delta = gripRotation
|
|
87
|
+
? input.rotationDeltaDeg
|
|
88
|
+
: input.rotationDeg - (section.rotationDeg ?? SectionRotation.initial);
|
|
89
|
+
if (delta === 0)
|
|
90
|
+
return document;
|
|
64
91
|
const rotated = transformLayout(document, {
|
|
65
92
|
sections: [sectionId],
|
|
66
93
|
objects: [...compactRowTargets(document, entry.editableObjects)],
|
|
67
94
|
pivot: sampleCenter ?? sectionOutlinePivot(outline),
|
|
68
95
|
}, { x: 0, y: 0 }, delta);
|
|
96
|
+
if (gripRotation)
|
|
97
|
+
return rotated;
|
|
69
98
|
return {
|
|
70
99
|
...rotated,
|
|
71
|
-
sections: rotated.sections.map((item) =>
|
|
100
|
+
sections: rotated.sections.map((item) => item.id === sectionId ? { ...item, rotationDeg: input.rotationDeg } : item),
|
|
72
101
|
};
|
|
73
102
|
}
|
package/dist/section-scale.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { type PhysicalDocumentV1, type PointM, type UUID } from "./physical-document.interface.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function minimumCornerScale(document: PhysicalDocumentV1, targets: ReadonlySet<UUID>): number;
|
|
3
|
+
export declare function scaleSectionLayout(document: PhysicalDocumentV1, sectionId: UUID, targets: ReadonlySet<UUID>, { pivot, factor, scalePercent }: {
|
|
4
|
+
pivot: PointM;
|
|
5
|
+
factor: number;
|
|
6
|
+
scalePercent?: number;
|
|
7
|
+
}): PhysicalDocumentV1;
|
package/dist/section-scale.js
CHANGED
|
@@ -4,16 +4,37 @@ import { LayoutUnitM } from "./geometry/units.js";
|
|
|
4
4
|
import { AreaKind, DecorationKind, SeatingKind, ShapeKind, } from "./physical-document.interface.js";
|
|
5
5
|
const SectionPitchUnits = { min: 14, max: 80 };
|
|
6
6
|
const SectionRoundRadiusUnitsMin = 18;
|
|
7
|
-
|
|
7
|
+
// A corner drag can reduce an empty Section to 10%. Rows stop at a 16-unit seat pitch.
|
|
8
|
+
const CornerMinimumFactor = 0.1;
|
|
9
|
+
const CornerMinimumPitchM = 16 * LayoutUnitM;
|
|
10
|
+
export function minimumCornerScale(document, targets) {
|
|
11
|
+
let minimum = CornerMinimumFactor;
|
|
12
|
+
for (const group of document.seatingGroups) {
|
|
13
|
+
if (!("rows" in group))
|
|
14
|
+
continue;
|
|
15
|
+
for (const [index, row] of group.rows.entries()) {
|
|
16
|
+
if (!targets.has(row.id))
|
|
17
|
+
continue;
|
|
18
|
+
const layout = resolveRowLayout(group, index);
|
|
19
|
+
if (layout)
|
|
20
|
+
minimum = Math.max(minimum, CornerMinimumPitchM / layout.seatPitchM);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Math.min(1, minimum);
|
|
24
|
+
}
|
|
25
|
+
export function scaleSectionLayout(document, sectionId, targets, { pivot, factor, scalePercent }) {
|
|
26
|
+
const numericScale = scalePercent !== undefined;
|
|
8
27
|
const scalePoint = (point, origin = pivot) => ({
|
|
9
28
|
x: origin.x + (point.x - origin.x) * factor,
|
|
10
29
|
y: origin.y + (point.y - origin.y) * factor,
|
|
11
30
|
});
|
|
12
31
|
const scaleLocalPoint = ({ x, y }) => ({ x: x * factor, y: y * factor });
|
|
32
|
+
const scaleSize = ({ width, height }) => ({ width: width * factor, height: height * factor });
|
|
13
33
|
const scalePolygon = (polygon, mapPoint) => ({
|
|
14
34
|
...polygon,
|
|
15
35
|
outer: polygon.outer.map(mapPoint),
|
|
16
36
|
holes: polygon.holes.map((ring) => ring.map(mapPoint)),
|
|
37
|
+
...(!numericScale && polygon.cornerRadiusM !== undefined && { cornerRadiusM: polygon.cornerRadiusM * factor }),
|
|
17
38
|
});
|
|
18
39
|
const matrices = worldMatrices(document);
|
|
19
40
|
const moveDrawable = (entity) => {
|
|
@@ -26,34 +47,73 @@ export function scaleSectionLayout(document, sectionId, targets, pivot, scalePer
|
|
|
26
47
|
if (!targets.has(area.id))
|
|
27
48
|
return area;
|
|
28
49
|
const moved = moveDrawable(area);
|
|
29
|
-
if (moved.kind !== AreaKind.GeneralAdmission)
|
|
50
|
+
if (numericScale && moved.kind !== AreaKind.GeneralAdmission)
|
|
30
51
|
return moved;
|
|
31
52
|
const { shape } = moved;
|
|
53
|
+
if (shape.kind === ShapeKind.Polygon) {
|
|
54
|
+
return { ...moved, shape: { ...shape, boundary: scalePolygon(shape.boundary, scaleLocalPoint) } };
|
|
55
|
+
}
|
|
32
56
|
return {
|
|
33
57
|
...moved,
|
|
34
|
-
shape:
|
|
35
|
-
|
|
36
|
-
|
|
58
|
+
shape: {
|
|
59
|
+
...shape,
|
|
60
|
+
widthM: shape.widthM * factor,
|
|
61
|
+
heightM: shape.heightM * factor,
|
|
62
|
+
cornerRadiusM: numericScale ? shape.cornerRadiusM : shape.cornerRadiusM * factor,
|
|
63
|
+
},
|
|
37
64
|
};
|
|
38
65
|
};
|
|
39
66
|
const scaleArtwork = (art) => {
|
|
40
67
|
if (!targets.has(art.id))
|
|
41
68
|
return art;
|
|
42
69
|
const moved = moveDrawable(art);
|
|
43
|
-
if (moved.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
if (!numericScale && moved.style?.strokeWidthM !== undefined) {
|
|
71
|
+
moved.style = { ...moved.style, strokeWidthM: moved.style.strokeWidthM * factor };
|
|
72
|
+
}
|
|
73
|
+
switch (moved.kind) {
|
|
74
|
+
case DecorationKind.Line:
|
|
75
|
+
return { ...moved, pointsM: moved.pointsM.map(scaleLocalPoint) };
|
|
76
|
+
case DecorationKind.Polygon: {
|
|
77
|
+
const result = { ...moved, boundary: scalePolygon(moved.boundary, scaleLocalPoint) };
|
|
78
|
+
if (!numericScale && moved.stage?.sizeM)
|
|
79
|
+
result.stage = { ...moved.stage, sizeM: scaleSize(moved.stage.sizeM) };
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
case DecorationKind.Rectangle:
|
|
83
|
+
return numericScale
|
|
84
|
+
? moved
|
|
85
|
+
: { ...moved, sizeM: scaleSize(moved.sizeM), cornerRadiusM: moved.cornerRadiusM * factor };
|
|
86
|
+
case DecorationKind.Circle:
|
|
87
|
+
return numericScale ? moved : { ...moved, radiusM: moved.radiusM * factor };
|
|
88
|
+
case DecorationKind.Text:
|
|
89
|
+
return numericScale ? moved : { ...moved, fontSizeM: moved.fontSizeM * factor };
|
|
90
|
+
case DecorationKind.Icon:
|
|
91
|
+
case DecorationKind.Image:
|
|
92
|
+
return numericScale ? moved : { ...moved, sizeM: scaleSize(moved.sizeM) };
|
|
93
|
+
}
|
|
48
94
|
};
|
|
49
95
|
const scaleGroup = (group) => {
|
|
50
96
|
if (group.kind === SeatingKind.Round || group.kind === SeatingKind.Rectangular) {
|
|
51
97
|
if (!targets.has(group.id))
|
|
52
98
|
return group;
|
|
53
|
-
if (group.kind === SeatingKind.Rectangular)
|
|
54
|
-
|
|
99
|
+
if (group.kind === SeatingKind.Rectangular) {
|
|
100
|
+
if (numericScale)
|
|
101
|
+
return moveDrawable(group);
|
|
102
|
+
const { widthM, depthM, chairPitchM } = group.recipe;
|
|
103
|
+
return moveDrawable({
|
|
104
|
+
...group,
|
|
105
|
+
recipe: {
|
|
106
|
+
...group.recipe,
|
|
107
|
+
widthM: widthM * factor,
|
|
108
|
+
depthM: depthM * factor,
|
|
109
|
+
...(chairPitchM !== undefined && { chairPitchM: chairPitchM * factor }),
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
55
113
|
const radiusUnits = Math.round((group.recipe.diameterM / (2 * LayoutUnitM)) * factor);
|
|
56
|
-
const diameterM =
|
|
114
|
+
const diameterM = numericScale
|
|
115
|
+
? 2 * Math.max(SectionRoundRadiusUnitsMin, radiusUnits) * LayoutUnitM
|
|
116
|
+
: group.recipe.diameterM * factor;
|
|
57
117
|
return moveDrawable({ ...group, recipe: { ...group.recipe, diameterM } });
|
|
58
118
|
}
|
|
59
119
|
if (!group.rows.some(({ id }) => targets.has(id)))
|
|
@@ -90,7 +150,9 @@ export function scaleSectionLayout(document, sectionId, targets, pivot, scalePer
|
|
|
90
150
|
const offset = rowPlacementOffset(group, index, row.offsetM);
|
|
91
151
|
const origin = scalePoint({ x: layout.originM.x + offset.x, y: layout.originM.y + offset.y }, localPivot);
|
|
92
152
|
const pitchUnits = Math.round((layout.seatPitchM / LayoutUnitM) * factor);
|
|
93
|
-
const seatPitchM =
|
|
153
|
+
const seatPitchM = numericScale
|
|
154
|
+
? Math.min(SectionPitchUnits.max, Math.max(SectionPitchUnits.min, pitchUnits)) * LayoutUnitM
|
|
155
|
+
: layout.seatPitchM * factor;
|
|
94
156
|
return {
|
|
95
157
|
...row,
|
|
96
158
|
layout: { ...layout, originM: { x: origin.x - offset.x, y: origin.y - offset.y }, seatPitchM },
|
|
@@ -114,7 +176,7 @@ export function scaleSectionLayout(document, sectionId, targets, pivot, scalePer
|
|
|
114
176
|
return section;
|
|
115
177
|
return {
|
|
116
178
|
...section,
|
|
117
|
-
scalePercent,
|
|
179
|
+
...(numericScale && { scalePercent }),
|
|
118
180
|
outline: scalePolygon(section.outline, (point) => scalePoint(point)),
|
|
119
181
|
...(section.labelPlacement
|
|
120
182
|
? { labelPlacement: { ...section.labelPlacement, positionM: scalePoint(section.labelPlacement.positionM) } }
|