@skillre/dsh-plugin-sticky-wall 0.5.0 → 0.7.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/lib/transport.js CHANGED
@@ -45,13 +45,23 @@ const layoutSchema = z
45
45
  /**
46
46
  * The clear rectangle the Client reserves around the wall's centrepiece.
47
47
  *
48
+ * The half-extents describe its SIZE and `x`/`y` its POSITION in world space: the
49
+ * centrepiece is a screen-space overlay, so on a panned or zoomed wall the patch
50
+ * of world it covers is not the origin. Omitting the position means the origin,
51
+ * which is where a freshly framed wall puts the field.
52
+ *
48
53
  * Bounds are NOT enforced here for the same reason the layout's are not: the
49
54
  * store normalizes with `normalizeReserve`, which caps an absurd value instead of
50
55
  * erroring, so a deeply zoomed-out wall still gets a wall. Non-finite values are
51
56
  * refused, because there is no sensible clamp for NaN.
52
57
  */
53
58
  const reserveSchema = z
54
- .object({ halfWidth: z.number().finite(), halfHeight: z.number().finite() })
59
+ .object({
60
+ x: z.number().finite().optional(),
61
+ y: z.number().finite().optional(),
62
+ halfWidth: z.number().finite(),
63
+ halfHeight: z.number().finite(),
64
+ })
55
65
  .strict();
56
66
  const requestSchema = z.discriminatedUnion('action', [
57
67
  z.object({ action: z.literal('list'), includeArchived: z.boolean().optional(), sort: sortSchema.optional() }).strict(),
package/lib/types.d.ts CHANGED
@@ -66,8 +66,37 @@ export declare const CENTRE_RESERVE: Readonly<{
66
66
  halfWidth: 330;
67
67
  halfHeight: 136;
68
68
  }>;
69
- /** Half-extents of a clear rectangle around the wall's centrepiece. */
69
+ /**
70
+ * A clear rectangle around the wall's centrepiece, in WORLD pixels.
71
+ *
72
+ * The size is fixed, but the POSITION is not, and that distinction is the whole
73
+ * point. The centrepiece is a screen-space overlay: it stays at the middle of
74
+ * the viewport while the paper pans and zooms underneath it, so the patch of
75
+ * world it covers moves with the camera even though the patch keeps its size.
76
+ *
77
+ * A reserve that only carried half-extents therefore described the wrong place
78
+ * as soon as the camera moved: the Host kept the world ORIGIN clear while the
79
+ * field sat somewhere else, and a note captured from the field was placed —
80
+ * and then revealed — directly behind it. `x`/`y` are that missing position;
81
+ * they default to the origin, which is exactly where a freshly framed wall puts
82
+ * the field.
83
+ */
70
84
  export interface CentreReserve {
85
+ /** World x of the reserve's centre; defaults to the origin. */
86
+ x?: number | undefined;
87
+ /** World y of the reserve's centre; defaults to the origin. */
88
+ y?: number | undefined;
89
+ /** Half-width in world pixels. */
90
+ halfWidth: number;
91
+ /** Half-height in world pixels. */
92
+ halfHeight: number;
93
+ }
94
+ /** A reserve with its position resolved: what the geometry actually works on. */
95
+ export interface ReserveRect {
96
+ /** World x of the reserve's centre. */
97
+ x: number;
98
+ /** World y of the reserve's centre. */
99
+ y: number;
71
100
  /** Half-width in world pixels. */
72
101
  halfWidth: number;
73
102
  /** Half-height in world pixels. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillre/dsh-plugin-sticky-wall",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "便签墙:DSH 侧栏的自由画布便签板,可拖动摆放、一键整理,正文按 Markdown 渲染",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",