@orbat-mapper/tactical-draw 0.2.0-alpha.5 → 0.2.0-alpha.7

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/index.d.mts CHANGED
@@ -759,8 +759,10 @@ interface EditOptions {
759
759
  * polyline sourced from the working control points alongside the working
760
760
  * geometry preview. For `geometry === "area"` kinds, a separate
761
761
  * closing-segment `LineString` is also emitted once `workingPoints.length >= 3`.
762
- * The guide is suppressed mechanically when `geometry === "point"` or
763
- * `minCoordinates === maxCoordinates`, regardless of this flag. See ADR-0004.
762
+ * The guide is suppressed mechanically when `geometry === "point"`, and for
763
+ * fixed-length kinds (`minCoordinates === maxCoordinates` or `canonicalPointCount`
764
+ * set) unless the kind's draw rule opts back in via `showGuide`, regardless of
765
+ * this flag. See ADR-0004.
764
766
  */
765
767
  guide?: boolean;
766
768
  /**
@@ -829,8 +831,10 @@ interface DrawOptions {
829
831
  * polyline alongside the kind's generator preview. For `geometry === "area"`
830
832
  * kinds, a separate closing-segment `LineString` is also emitted once the
831
833
  * total point count (cursor included) is ≥ 3. The guide is suppressed
832
- * mechanically when `geometry === "point"` or `minCoordinates === maxCoordinates`,
833
- * regardless of this flag. See ADR-0004.
834
+ * mechanically when `geometry === "point"`, and for fixed-length kinds
835
+ * (`minCoordinates === maxCoordinates` or `canonicalPointCount` set) unless
836
+ * the kind's draw rule opts back in via `showGuide`, regardless of this
837
+ * flag. See ADR-0004.
834
838
  */
835
839
  guide?: boolean;
836
840
  /**
@@ -1171,4 +1175,18 @@ interface TransformBox {
1171
1175
  angle: number;
1172
1176
  }
1173
1177
  //#endregion
1174
- export { BaseMapAdapter, type CombinedAbort, type DrawMeasureDraft, type DrawOptions, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureOps, type GuideStyle, type HandleStyle, type InteractionStyle, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type NativeEventEntry, type PickEvent, type PickHandler, type PickOptions, type PixelCoordinate, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type SizeAnchor, type StyleOptions, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, bindAbortable, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, ignoreAbort, isTacticalDrawAbortError, pickHitTolerance, tryControlMeasureIdFromFeature };
1178
+ //#region src/world-wrap.d.ts
1179
+ /**
1180
+ * Shift `lng` by whole world widths (360°) onto the copy nearest `refLng`.
1181
+ *
1182
+ * Map engines that wrap pointer longitudes into [-180, 180] (OpenLayers'
1183
+ * `toLonLat`, MapLibre's globe unproject) make positions jump ~360° when a
1184
+ * gesture crosses the antimeridian. Adapters use this to keep delivered
1185
+ * longitudes continuous with the view center, and to project coordinates on
1186
+ * the world copy the view is actually looking at.
1187
+ */
1188
+ declare function nearestWorldCopyLng(lng: number, refLng: number): number;
1189
+ /** `nearestWorldCopyLng` applied to a lon/lat position. */
1190
+ declare function nearestWorldCopyPosition(position: Position, refLng: number): Position;
1191
+ //#endregion
1192
+ export { BaseMapAdapter, type CombinedAbort, type DrawMeasureDraft, type DrawOptions, type DrawSession, type EditChangeEvent, type EditManyOptions, type EditMode, type EditOptions, type EditPointerDriver, type EditSession, type FeatureOps, type GuideStyle, type HandleStyle, type InteractionStyle, type LayerId, type MapAdapter, type MapCursor, type MapEvent, type MapEventHandler, type NativeEventEntry, type PickEvent, type PickHandler, type PickOptions, type PixelCoordinate, type PointerCallback, PointerCallbackHub, type PointerEventInfo, type SizeAnchor, type StyleOptions, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, type TacticalDrawAbortReason, TacticalDrawDestroyedError, type TacticalDrawLayerOptions, type TacticalDrawOptions, type TextStyleOptions, type ToPixel, type TransformBox, type TransformChangeEvent, type TransformSession, bindAbortable, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, ignoreAbort, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, tryControlMeasureIdFromFeature };
package/dist/index.mjs CHANGED
@@ -528,12 +528,12 @@ const PIXEL_SIZE_OPTIONS = {
528
528
  meters: "radius"
529
529
  },
530
530
  "fortified-line": {
531
- pixels: "sizePixels",
532
- meters: "size"
531
+ pixels: "toothSizePixels",
532
+ meters: "toothSize"
533
533
  },
534
534
  "fortified-area": {
535
- pixels: "sizePixels",
536
- meters: "size"
535
+ pixels: "toothSizePixels",
536
+ meters: "toothSize"
537
537
  },
538
538
  "antitank-ditch-under-construction": {
539
539
  pixels: "toothHeightPixels",
@@ -600,7 +600,7 @@ function bakePixelSizeToGround(measure, adapter) {
600
600
  /**
601
601
  * Stamp the adapter's current `metersPerPixel` onto a measure that sizes itself
602
602
  * in pixels, so the generator resolves pixel options (`radiusPixels`,
603
- * `sizePixels`, `toothHeightPixels`) against the live map zoom. Returns the
603
+ * `toothSizePixels`, `toothHeightPixels`) against the live map zoom. Returns the
604
604
  * measure unchanged when the adapter has no usable resolution or the
605
605
  * kind/options don't opt into pixel sizing.
606
606
  */
@@ -3808,10 +3808,9 @@ const BUILT_IN_GRAPHICS_STYLE = {
3808
3808
  };
3809
3809
  /**
3810
3810
  * Built-in defaults for the interaction-affordance slots (ADR-0006, extended
3811
- * for the ADR-0017 transform box). The scale (corner) grips are white-filled
3812
- * with the same blue stroke as the box outline, so the box reads as one
3813
- * coherent affordance; the rotate grip keeps its distinct green fill so it
3814
- * doesn't get mistaken for a corner. Vertex/midpoint keep their existing
3811
+ * for the ADR-0017 transform box). The scale (corner) grips and the rotate
3812
+ * grip are white-filled with the same blue stroke as the box outline, so the
3813
+ * box reads as one coherent affordance. Vertex/midpoint keep their existing
3815
3814
  * white/gray family.
3816
3815
  */
3817
3816
  const BUILT_IN_INTERACTION_STYLE = {
@@ -3844,8 +3843,9 @@ const BUILT_IN_INTERACTION_STYLE = {
3844
3843
  },
3845
3844
  rotateHandle: {
3846
3845
  pointRadius: 5,
3847
- fillColor: "#16a34a",
3848
- strokeColor: "#ffffff"
3846
+ fillColor: "#ffffff",
3847
+ strokeColor: "#4f7cff",
3848
+ strokeWidth: 2
3849
3849
  }
3850
3850
  };
3851
3851
  const HANDLE_SLOTS = [
@@ -3896,4 +3896,22 @@ function resolveSlot(adapter, supplied, owned) {
3896
3896
  return id;
3897
3897
  }
3898
3898
  //#endregion
3899
- export { BaseMapAdapter, PointerCallbackHub, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, ignoreAbort, isTacticalDrawAbortError, pickHitTolerance, tryControlMeasureIdFromFeature };
3899
+ //#region src/world-wrap.ts
3900
+ /**
3901
+ * Shift `lng` by whole world widths (360°) onto the copy nearest `refLng`.
3902
+ *
3903
+ * Map engines that wrap pointer longitudes into [-180, 180] (OpenLayers'
3904
+ * `toLonLat`, MapLibre's globe unproject) make positions jump ~360° when a
3905
+ * gesture crosses the antimeridian. Adapters use this to keep delivered
3906
+ * longitudes continuous with the view center, and to project coordinates on
3907
+ * the world copy the view is actually looking at.
3908
+ */
3909
+ function nearestWorldCopyLng(lng, refLng) {
3910
+ return lng + 360 * Math.round((refLng - lng) / 360);
3911
+ }
3912
+ /** `nearestWorldCopyLng` applied to a lon/lat position. */
3913
+ function nearestWorldCopyPosition(position, refLng) {
3914
+ return [nearestWorldCopyLng(position[0], refLng), ...position.slice(1)];
3915
+ }
3916
+ //#endregion
3917
+ export { BaseMapAdapter, PointerCallbackHub, TOUCH_HIT_TOLERANCE_PX, TacticalDraw, TacticalDrawAbortError, TacticalDrawDestroyedError, bindAbortable, coerceHandleStyle, combineWithHostSignal, getSizeAnchor, hitTestFeature, ignoreAbort, isTacticalDrawAbortError, nearestWorldCopyLng, nearestWorldCopyPosition, pickHitTolerance, tryControlMeasureIdFromFeature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbat-mapper/tactical-draw",
3
- "version": "0.2.0-alpha.5",
3
+ "version": "0.2.0-alpha.7",
4
4
  "description": "Engine-agnostic draw/edit core for tactical control measures (MIL-STD-2525 / APP-6). The MapAdapter ABI and bring-your-own-engine entry point for the tactical-draw package family.",
5
5
  "license": "MIT",
6
6
  "author": "Orbat Mapper",
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@orbat-mapper/control-measures": "^0.2.0-alpha.6"
41
+ "@orbat-mapper/control-measures": "^0.2.0-alpha.8"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@arethetypeswrong/core": "^0.18.3",