@orbat-mapper/control-measures 0.2.0-alpha.10 → 0.2.0-alpha.12
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-D3uCYKe3.d.mts → index-CsJcNxFQ.d.mts} +335 -69
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/preview/index.d.mts +65 -10
- package/dist/preview/index.mjs +129 -18
- package/dist/{renderControlMeasure-BblcXXLp.mjs → renderControlMeasure-DHQO01PA.mjs} +1531 -615
- package/media/airborne-attack.svg +1 -1
- package/media/ambush.svg +1 -1
- package/media/antitank-ditch-completed.svg +1 -1
- package/media/antitank-ditch-under-construction.svg +1 -1
- package/media/antitank-wall.svg +1 -1
- package/media/area-of-operations.svg +1 -0
- package/media/assembly-area.svg +1 -0
- package/media/attack-by-fire.svg +1 -1
- package/media/attack-helicopter.svg +1 -1
- package/media/battle-handover-line.svg +1 -0
- package/media/battle-position.svg +1 -1
- package/media/block-arrow.svg +1 -1
- package/media/block-mission-task.svg +1 -1
- package/media/block.svg +1 -1
- package/media/boundary.svg +1 -1
- package/media/breach.svg +1 -1
- package/media/bypass.svg +1 -1
- package/media/canalize.svg +1 -1
- package/media/circle.svg +1 -1
- package/media/classic-arrow.svg +1 -1
- package/media/clear.svg +1 -1
- package/media/delay.svg +1 -1
- package/media/disrupt.svg +1 -1
- package/media/encirclement.svg +1 -1
- package/media/engineer-work-line.svg +1 -0
- package/media/final-protective-fire-left.svg +1 -1
- package/media/final-protective-fire-right.svg +1 -1
- package/media/fix.svg +1 -1
- package/media/flot.svg +1 -1
- package/media/fortified-area.svg +1 -1
- package/media/fortified-line.svg +1 -1
- package/media/generic-c2-line.svg +1 -0
- package/media/handover-line.svg +1 -0
- package/media/isolate.svg +1 -1
- package/media/joint-tactical-action-area.svg +1 -0
- package/media/landing-zone.svg +1 -0
- package/media/light-line.svg +1 -0
- package/media/line.svg +1 -1
- package/media/main-attack.svg +1 -1
- package/media/obstacle-bypass-difficult.svg +1 -1
- package/media/obstacle-bypass-easy.svg +1 -1
- package/media/obstacle-bypass-impossible.svg +1 -1
- package/media/phase-line.svg +1 -0
- package/media/pickup-zone.svg +1 -0
- package/media/polygon.svg +1 -1
- package/media/principal-direction-of-fire.svg +1 -1
- package/media/rectangle.svg +1 -1
- package/media/search-area.svg +1 -1
- package/media/strong-point.svg +1 -1
- package/media/support-by-fire.svg +1 -1
- package/media/supporting-attack.svg +1 -1
- package/media/turn.svg +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as getControlMeasureMetadata, $n as ControlMeasureMetadata, $t as DEFAULT_GENERIC_CIRCLE_OPTIONS, A as getMetersPerPixel, An as EncirclementOptions, At as DEFAULT_CANALIZE_OPTIONS, B as ControlMeasureSnapshot, Bn as GenericC2LineOptions, Bt as HandoverLineOptions, C as snapToMidpointPerpendicular, Cn as DEFAULT_LANDING_ZONE_OPTIONS, Ct as AntitankDitchOptions, D as BaselineFrameOrigin, Dn as AssemblyAreaOptions, Dt as ClearOptions, E as BaselineFrameOptions, En as JointTacticalActionAreaOptions, Et as DelayOptions, F as resolveStyleHints, Fn as DEFAULT_STRONG_POINT_OPTIONS, Ft as BlockMissionTaskOptions, G as cloneControlMeasure, Gn as LabelSizeOptions, Gt as AttackByFireOptions, H as StyleHints, Hn as EngineerWorkLineOptions, Ht as PhaseLineOptions, I as freezeOrientationOptions, In as StrongPointOptions, It as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, J as CONTROL_MEASURE_IDS, Jn as unproject, Jt as SupportByFireOptions, K as isKind, Kn as Point2D, Kt as DEFAULT_ATTACK_BY_FIRE_OPTIONS, L as RenderOptions, Ln as BattlePositionOptions, Lt as BattleHandoverLineOptions, M as SimpleStyleProps, Mn as FinalProtectiveFireOptions, Mt as DEFAULT_BYPASS_OPTIONS, N as SimpleStyleRender, Nn as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, Nt as BreachOptions, O as createBaselineFrame, On as DEFAULT_ASSEMBLY_AREA_OPTIONS, Ot as DEFAULT_CLEAR_OPTIONS, P as toSimpleStyle, Pn as PrincipalDirectionOfFireOptions, Pt as DEFAULT_BREACH_OPTIONS, Q as OptionsByKind, Qn as ControlMeasureGeometryType, Qt as DEFAULT_AIRBORNE_ATTACK_OPTIONS, R as renderControlMeasure, Rn as DEFAULT_BATTLE_POSITION_OPTIONS, Rt as DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, S as pointOnMidpointPerpendicularAxis, Sn as PickupZoneOptions, St as DEFAULT_ANTITANK_WALL_OPTIONS, T as BaselineFrameNormal, Tn as DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, Tt as DEFAULT_DELAY_OPTIONS, U as controlMeasureIdFromFeature, Un as DEFAULT_LIGHT_LINE_OPTIONS, Ut as DEFAULT_FLOT_OPTIONS, V as FeaturePartProps, Vn as DEFAULT_ENGINEER_WORK_LINE_OPTIONS, Vt as DEFAULT_PHASE_LINE_OPTIONS, W as ControlMeasure, Wn as LightLineOptions, Wt as FLOTOptions, X as ControlMeasureId, Xn as DEFAULT_BOUNDARY_OPTIONS, Xt as DEFAULT_ATTACK_HELICOPTER_OPTIONS, Y as CONTROL_MEASURE_METADATA, Yn as BoundaryOptions, Yt as AttackHelicopterOptions, Z as ControlMeasureKind, Zn as ControlMeasureGeometry, Zt as AirborneAttackOptions, _ as blockDrawRule, _n as calculateMetrics, _t as DEFAULT_FORTIFIED_AREA_OPTIONS, a as rectangleDrawRule, an as DEFAULT_GENERIC_LINE_OPTIONS, ar as
|
|
2
|
-
export { type AirborneAttackOptions, type AmbushOptions, type AnchorTransformEvent, type AntitankDitchOptions, type AntitankWallOptions, type AreaOfOperationsOptions, type AssemblyAreaOptions, type AttackByFireOptions, type AttackHelicopterOptions, type BaselineFrame, type BaselineFrameNormal, type BaselineFrameOptions, type BaselineFrameOrigin, type BattleHandoverLineOptions, type BattlePositionOptions, type BlockArrowHeadStyle, type BlockArrowOptions, type BlockMissionTaskOptions, type BlockOptions, type BoundaryOptions, type BreachOptions, type BypassOptions, CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, type CanalizeOptions, type CanonicalTextAmplifiers, type ClassicArrowHeadStyle, type ClassicArrowOptions, type ClearOptions, type ControlMeasure, type ControlMeasureDrawRule, type ControlMeasureGeometry, type ControlMeasureGeometryType, type ControlMeasureId, type ControlMeasureKind, type ControlMeasureMetadata, type ControlMeasureRender, type ControlMeasureSnapshot, type ControlMeasureStyle, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_AREA_OF_OPERATIONS_OPTIONS, DEFAULT_ASSEMBLY_AREA_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, DEFAULT_BATTLE_POSITION_OPTIONS, DEFAULT_BLOCK_ARROW_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BOUNDARY_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLASSIC_ARROW_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_ENGINEER_WORK_LINE_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_GENERIC_C2_LINE_OPTIONS, DEFAULT_GENERIC_CIRCLE_OPTIONS, DEFAULT_GENERIC_LINE_OPTIONS, DEFAULT_GENERIC_POLYGON_OPTIONS, DEFAULT_GENERIC_RECTANGLE_OPTIONS, DEFAULT_HANDOVER_LINE_OPTIONS, DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, DEFAULT_LANDING_ZONE_OPTIONS, DEFAULT_LIGHT_LINE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PHASE_LINE_OPTIONS, DEFAULT_PICKUP_ZONE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, type DelayOptions, type DisruptOptions, EPSILON, type EncirclementOptions, type EngineerWorkLineOptions, type FLOTOptions, type FeaturePartProps, type FinalProtectiveFireOptions, type FixOptions, type FortifiedAreaOptions, type FortifiedLineOptions, type GenericC2LineOptions, type GenericCircleOptions, type GenericLineOptions, type GenericPolygonOptions, type GenericRectangleOptions, type HandoverLineOptions, type JointTacticalActionAreaOptions, type LabelSizeOptions, type LandingZoneOptions, type LightLineOptions, type MainAttackOptions, type MidpointPerpendicularDrawRuleOptions, type ObstacleBypassDifficultOptions, type ObstacleBypassEasyOptions, type ObstacleBypassImpossibleOptions, type OptionsByKind, type ParamDescriptor, type PhaseLineOptions, type PickupZoneOptions, type Point2D, type PrincipalDirectionOfFireOptions, type RenderOptions, type SimpleStyleProps, type SimpleStyleRender, type StrongPointOptions, type StyleHints, type SupportByFireOptions, type SupportingAttackOptions, TEXT_AMPLIFIER_FIELDS, type TacticalArrowOptions, type TextAmplifierDescriptor, type TextAmplifierField, type TextAmplifierKey, type TextAmplifiers, type TurnOptions, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, canonicalTextAmplifierKey, centerRadiusDrawRule, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, normalizeTextAmplifiers, point12DrawRule, pointOnMidpointPerpendicularAxis, project, rectangleDrawRule, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
|
1
|
+
import { $ as getControlMeasureMetadata, $n as ControlMeasureMetadata, $t as DEFAULT_GENERIC_CIRCLE_OPTIONS, A as getMetersPerPixel, An as EncirclementOptions, At as DEFAULT_CANALIZE_OPTIONS, B as ControlMeasureSnapshot, Bn as GenericC2LineOptions, Bt as HandoverLineOptions, C as snapToMidpointPerpendicular, Cn as DEFAULT_LANDING_ZONE_OPTIONS, Ct as AntitankDitchOptions, D as BaselineFrameOrigin, Dn as AssemblyAreaOptions, Dt as ClearOptions, E as BaselineFrameOptions, En as JointTacticalActionAreaOptions, Et as DelayOptions, F as resolveStyleHints, Fn as DEFAULT_STRONG_POINT_OPTIONS, Ft as BlockMissionTaskOptions, G as cloneControlMeasure, Gn as LabelSizeOptions, Gt as AttackByFireOptions, H as StyleHints, Hn as EngineerWorkLineOptions, Ht as PhaseLineOptions, I as freezeOrientationOptions, In as StrongPointOptions, It as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, J as CONTROL_MEASURE_IDS, Jn as unproject, Jt as SupportByFireOptions, K as isKind, Kn as Point2D, Kt as DEFAULT_ATTACK_BY_FIRE_OPTIONS, L as RenderOptions, Ln as BattlePositionOptions, Lt as BattleHandoverLineOptions, M as SimpleStyleProps, Mn as FinalProtectiveFireOptions, Mt as DEFAULT_BYPASS_OPTIONS, N as SimpleStyleRender, Nn as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, Nt as BreachOptions, O as createBaselineFrame, On as DEFAULT_ASSEMBLY_AREA_OPTIONS, Ot as DEFAULT_CLEAR_OPTIONS, P as toSimpleStyle, Pn as PrincipalDirectionOfFireOptions, Pt as DEFAULT_BREACH_OPTIONS, Q as OptionsByKind, Qn as ControlMeasureGeometryType, Qt as DEFAULT_AIRBORNE_ATTACK_OPTIONS, R as renderControlMeasure, Rn as DEFAULT_BATTLE_POSITION_OPTIONS, Rt as DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, S as pointOnMidpointPerpendicularAxis, Sn as PickupZoneOptions, St as DEFAULT_ANTITANK_WALL_OPTIONS, T as BaselineFrameNormal, Tn as DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, Tt as DEFAULT_DELAY_OPTIONS, U as controlMeasureIdFromFeature, Un as DEFAULT_LIGHT_LINE_OPTIONS, Ut as DEFAULT_FLOT_OPTIONS, V as FeaturePartProps, Vn as DEFAULT_ENGINEER_WORK_LINE_OPTIONS, Vt as DEFAULT_PHASE_LINE_OPTIONS, W as ControlMeasure, Wn as LightLineOptions, Wt as FLOTOptions, X as ControlMeasureId, Xn as DEFAULT_BOUNDARY_OPTIONS, Xt as DEFAULT_ATTACK_HELICOPTER_OPTIONS, Y as CONTROL_MEASURE_METADATA, Yn as BoundaryOptions, Yt as AttackHelicopterOptions, Z as ControlMeasureKind, Zn as ControlMeasureGeometry, Zt as AirborneAttackOptions, _ as blockDrawRule, _n as calculateMetrics, _t as DEFAULT_FORTIFIED_AREA_OPTIONS, a as rectangleDrawRule, an as DEFAULT_GENERIC_LINE_OPTIONS, ar as TEXT_AMPLIFIER_FIELDS, at as DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, b as createMidpointPerpendicularDrawRule, bn as DEFAULT_AREA_OF_OPERATIONS_OPTIONS, bt as FortifiedLineOptions, c as line24DrawRule, cn as BlockArrowOptions, cr as TextAmplifiers, ct as ObstacleBypassEasyOptions, d as line1DrawRule, dn as ClassicArrowOptions, dr as AnchorTransformEvent, dt as DEFAULT_FIX_OPTIONS, en as GenericCircleOptions, er as ParamDescriptor, et as getControlMeasureMetadataByValue, f as ambushDrawRule, fn as DEFAULT_CLASSIC_ARROW_OPTIONS, fr as ControlMeasureDrawRule, ft as FixOptions, g as disruptDrawRule, gn as MainAttackOptions, gt as DEFAULT_BLOCK_OPTIONS, h as centerRadiusDrawRule, hn as DEFAULT_MAIN_ATTACK_OPTIONS, ht as BlockOptions, i as DEFAULT_AMBUSH_OPTIONS, in as GenericPolygonOptions, ir as GeneratedLabelKey, it as ObstacleBypassImpossibleOptions, j as roundToFixed, jn as DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, jt as BypassOptions, k as EPSILON, kn as DEFAULT_ENCIRCLEMENT_OPTIONS, kt as CanalizeOptions, l as line23DrawRule, ln as DEFAULT_BLOCK_ARROW_OPTIONS, lr as canonicalTextAmplifierKey, lt as DEFAULT_TURN_OPTIONS, m as point12DrawRule, mn as SupportingAttackOptions, mt as DisruptOptions, n as TacticalArrowOptions, nn as GenericRectangleOptions, nr as AmplifierPlacements, nt as listControlMeasureMetadata, o as axis1DrawRule, on as GenericLineOptions, or as TextAmplifierField, ot as ObstacleBypassDifficultOptions, p as attackByFireDrawRule, pn as DEFAULT_SUPPORTING_ATTACK_OPTIONS, pt as DEFAULT_DISRUPT_OPTIONS, q as ControlMeasureStyle, qn as project, qt as DEFAULT_SUPPORT_BY_FIRE_OPTIONS, r as AmbushOptions, rn as DEFAULT_GENERIC_POLYGON_OPTIONS, rr as CanonicalTextAmplifiers, rt as DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, s as supportByFireDrawRule, sn as BlockArrowHeadStyle, sr as TextAmplifierKey, st as DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, t as DEFAULT_TACTICAL_ARROW_OPTIONS, tn as DEFAULT_GENERIC_RECTANGLE_OPTIONS, tr as TextAmplifierDescriptor, tt as getDefaultOptions, u as turnDrawRule, un as ClassicArrowHeadStyle, ur as normalizeTextAmplifiers, ut as TurnOptions, v as MidpointPerpendicularDrawRuleOptions, vn as computeInitialWidthPoint, vt as FortifiedAreaOptions, w as BaselineFrame, wn as LandingZoneOptions, wt as DEFAULT_ANTITANK_DITCH_OPTIONS, x as getMidpointPerpendicularSignedDistance, xn as DEFAULT_PICKUP_ZONE_OPTIONS, xt as AntitankWallOptions, y as computeDefaultMidpointPerpendicularPoint, yn as AreaOfOperationsOptions, yt as DEFAULT_FORTIFIED_LINE_OPTIONS, z as ControlMeasureRender, zn as DEFAULT_GENERIC_C2_LINE_OPTIONS, zt as DEFAULT_HANDOVER_LINE_OPTIONS } from "./index-CsJcNxFQ.mjs";
|
|
2
|
+
export { type AirborneAttackOptions, type AmbushOptions, type AmplifierPlacements, type AnchorTransformEvent, type AntitankDitchOptions, type AntitankWallOptions, type AreaOfOperationsOptions, type AssemblyAreaOptions, type AttackByFireOptions, type AttackHelicopterOptions, type BaselineFrame, type BaselineFrameNormal, type BaselineFrameOptions, type BaselineFrameOrigin, type BattleHandoverLineOptions, type BattlePositionOptions, type BlockArrowHeadStyle, type BlockArrowOptions, type BlockMissionTaskOptions, type BlockOptions, type BoundaryOptions, type BreachOptions, type BypassOptions, CONTROL_MEASURE_IDS, CONTROL_MEASURE_METADATA, type CanalizeOptions, type CanonicalTextAmplifiers, type ClassicArrowHeadStyle, type ClassicArrowOptions, type ClearOptions, type ControlMeasure, type ControlMeasureDrawRule, type ControlMeasureGeometry, type ControlMeasureGeometryType, type ControlMeasureId, type ControlMeasureKind, type ControlMeasureMetadata, type ControlMeasureRender, type ControlMeasureSnapshot, type ControlMeasureStyle, DEFAULT_AIRBORNE_ATTACK_OPTIONS, DEFAULT_AMBUSH_OPTIONS, DEFAULT_ANTITANK_DITCH_OPTIONS, DEFAULT_ANTITANK_WALL_OPTIONS, DEFAULT_AREA_OF_OPERATIONS_OPTIONS, DEFAULT_ASSEMBLY_AREA_OPTIONS, DEFAULT_ATTACK_BY_FIRE_OPTIONS, DEFAULT_ATTACK_HELICOPTER_OPTIONS, DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, DEFAULT_BATTLE_POSITION_OPTIONS, DEFAULT_BLOCK_ARROW_OPTIONS, DEFAULT_BLOCK_MISSION_TASK_OPTIONS, DEFAULT_BLOCK_OPTIONS, DEFAULT_BOUNDARY_OPTIONS, DEFAULT_BREACH_OPTIONS, DEFAULT_BYPASS_OPTIONS, DEFAULT_CANALIZE_OPTIONS, DEFAULT_CLASSIC_ARROW_OPTIONS, DEFAULT_CLEAR_OPTIONS, DEFAULT_DELAY_OPTIONS, DEFAULT_DISRUPT_OPTIONS, DEFAULT_ENCIRCLEMENT_OPTIONS, DEFAULT_ENGINEER_WORK_LINE_OPTIONS, DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, DEFAULT_FIX_OPTIONS, DEFAULT_FLOT_OPTIONS, DEFAULT_FORTIFIED_AREA_OPTIONS, DEFAULT_FORTIFIED_LINE_OPTIONS, DEFAULT_GENERIC_C2_LINE_OPTIONS, DEFAULT_GENERIC_CIRCLE_OPTIONS, DEFAULT_GENERIC_LINE_OPTIONS, DEFAULT_GENERIC_POLYGON_OPTIONS, DEFAULT_GENERIC_RECTANGLE_OPTIONS, DEFAULT_HANDOVER_LINE_OPTIONS, DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, DEFAULT_LANDING_ZONE_OPTIONS, DEFAULT_LIGHT_LINE_OPTIONS, DEFAULT_MAIN_ATTACK_OPTIONS, DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, DEFAULT_PHASE_LINE_OPTIONS, DEFAULT_PICKUP_ZONE_OPTIONS, DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, DEFAULT_STRONG_POINT_OPTIONS, DEFAULT_SUPPORTING_ATTACK_OPTIONS, DEFAULT_SUPPORT_BY_FIRE_OPTIONS, DEFAULT_TACTICAL_ARROW_OPTIONS, DEFAULT_TURN_OPTIONS, type DelayOptions, type DisruptOptions, EPSILON, type EncirclementOptions, type EngineerWorkLineOptions, type FLOTOptions, type FeaturePartProps, type FinalProtectiveFireOptions, type FixOptions, type FortifiedAreaOptions, type FortifiedLineOptions, type GeneratedLabelKey, type GenericC2LineOptions, type GenericCircleOptions, type GenericLineOptions, type GenericPolygonOptions, type GenericRectangleOptions, type HandoverLineOptions, type JointTacticalActionAreaOptions, type LabelSizeOptions, type LandingZoneOptions, type LightLineOptions, type MainAttackOptions, type MidpointPerpendicularDrawRuleOptions, type ObstacleBypassDifficultOptions, type ObstacleBypassEasyOptions, type ObstacleBypassImpossibleOptions, type OptionsByKind, type ParamDescriptor, type PhaseLineOptions, type PickupZoneOptions, type Point2D, type PrincipalDirectionOfFireOptions, type RenderOptions, type SimpleStyleProps, type SimpleStyleRender, type StrongPointOptions, type StyleHints, type SupportByFireOptions, type SupportingAttackOptions, TEXT_AMPLIFIER_FIELDS, type TacticalArrowOptions, type TextAmplifierDescriptor, type TextAmplifierField, type TextAmplifierKey, type TextAmplifiers, type TurnOptions, ambushDrawRule, attackByFireDrawRule, axis1DrawRule, blockDrawRule, calculateMetrics, canonicalTextAmplifierKey, centerRadiusDrawRule, cloneControlMeasure, computeDefaultMidpointPerpendicularPoint, computeInitialWidthPoint, controlMeasureIdFromFeature, createBaselineFrame, createMidpointPerpendicularDrawRule, disruptDrawRule, freezeOrientationOptions, getControlMeasureMetadata, getControlMeasureMetadataByValue, getDefaultOptions, getMetersPerPixel, getMidpointPerpendicularSignedDistance, isKind, line1DrawRule, line23DrawRule, line24DrawRule, listControlMeasureMetadata, normalizeTextAmplifiers, point12DrawRule, pointOnMidpointPerpendicularAxis, project, rectangleDrawRule, renderControlMeasure, resolveStyleHints, roundToFixed, snapToMidpointPerpendicular, supportByFireDrawRule, toSimpleStyle, turnDrawRule, unproject };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DEFAULT_BATTLE_POSITION_OPTIONS, A as DEFAULT_PHASE_LINE_OPTIONS, At as unproject, B as DEFAULT_GENERIC_LINE_OPTIONS, C as DEFAULT_MAIN_ATTACK_OPTIONS, Ct as getMidpointPerpendicularSignedDistance, D as DEFAULT_FORTIFIED_LINE_OPTIONS, Dt as calculateMetrics, E as DEFAULT_FORTIFIED_AREA_OPTIONS, Et as createBaselineFrame, F as DEFAULT_DISRUPT_OPTIONS, G as DEFAULT_BREACH_OPTIONS, H as DEFAULT_CLASSIC_ARROW_OPTIONS, I as DEFAULT_DELAY_OPTIONS, J as DEFAULT_ENGINEER_WORK_LINE_OPTIONS, K as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, L as DEFAULT_CLEAR_OPTIONS, M as DEFAULT_FIX_OPTIONS, Mt as getMetersPerPixel, N as DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, Nt as roundToFixed, O as DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, Ot as computeInitialWidthPoint, P as DEFAULT_ENCIRCLEMENT_OPTIONS, Q as DEFAULT_BLOCK_OPTIONS, R as DEFAULT_GENERIC_RECTANGLE_OPTIONS, S as DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, St as createMidpointPerpendicularDrawRule, T as DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, Tt as snapToMidpointPerpendicular, U as DEFAULT_CANALIZE_OPTIONS, V as DEFAULT_GENERIC_CIRCLE_OPTIONS, W as DEFAULT_BYPASS_OPTIONS, X as DEFAULT_BOUNDARY_OPTIONS, Y as DEFAULT_LIGHT_LINE_OPTIONS, Z as DEFAULT_BLOCK_ARROW_OPTIONS, _ as DEFAULT_TACTICAL_ARROW_OPTIONS, _t as point12DrawRule, a as resolveStyleHints, at as DEFAULT_AREA_OF_OPERATIONS_OPTIONS, b as DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, bt as blockDrawRule, c as DEFINITIONS, ct as rectangleDrawRule, d as getDefaultOptions, dt as line24DrawRule, et as DEFAULT_ATTACK_HELICOPTER_OPTIONS, f as listControlMeasureMetadata, ft as line23DrawRule, g as DEFAULT_STRONG_POINT_OPTIONS, gt as attackByFireDrawRule, h as DEFAULT_SUPPORT_BY_FIRE_OPTIONS, ht as ambushDrawRule, i as normalizeTextAmplifiers, it as DEFAULT_ASSEMBLY_AREA_OPTIONS, j as DEFAULT_FLOT_OPTIONS, jt as EPSILON, k as DEFAULT_HANDOVER_LINE_OPTIONS, kt as project, l as getControlMeasureMetadata, lt as axis1DrawRule, m as DEFAULT_SUPPORTING_ATTACK_OPTIONS, mt as line1DrawRule, n as TEXT_AMPLIFIER_FIELDS, nt as DEFAULT_ANTITANK_WALL_OPTIONS, o as CONTROL_MEASURE_IDS, ot as DEFAULT_AMBUSH_OPTIONS, p as DEFAULT_TURN_OPTIONS, pt as turnDrawRule, q as DEFAULT_GENERIC_C2_LINE_OPTIONS, r as canonicalTextAmplifierKey, rt as DEFAULT_ANTITANK_DITCH_OPTIONS, s as CONTROL_MEASURE_METADATA, st as DEFAULT_AIRBORNE_ATTACK_OPTIONS, t as renderControlMeasure, tt as DEFAULT_ATTACK_BY_FIRE_OPTIONS, u as getControlMeasureMetadataByValue, ut as supportByFireDrawRule, v as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, vt as centerRadiusDrawRule, w as DEFAULT_LANDING_ZONE_OPTIONS, wt as pointOnMidpointPerpendicularAxis, x as DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, xt as computeDefaultMidpointPerpendicularPoint, y as DEFAULT_PICKUP_ZONE_OPTIONS, yt as disruptDrawRule, z as DEFAULT_GENERIC_POLYGON_OPTIONS } from "./renderControlMeasure-
|
|
1
|
+
import { $ as DEFAULT_BATTLE_POSITION_OPTIONS, A as DEFAULT_PHASE_LINE_OPTIONS, At as unproject, B as DEFAULT_GENERIC_LINE_OPTIONS, C as DEFAULT_MAIN_ATTACK_OPTIONS, Ct as getMidpointPerpendicularSignedDistance, D as DEFAULT_FORTIFIED_LINE_OPTIONS, Dt as calculateMetrics, E as DEFAULT_FORTIFIED_AREA_OPTIONS, Et as createBaselineFrame, F as DEFAULT_DISRUPT_OPTIONS, G as DEFAULT_BREACH_OPTIONS, H as DEFAULT_CLASSIC_ARROW_OPTIONS, I as DEFAULT_DELAY_OPTIONS, J as DEFAULT_ENGINEER_WORK_LINE_OPTIONS, K as DEFAULT_BLOCK_MISSION_TASK_OPTIONS, L as DEFAULT_CLEAR_OPTIONS, M as DEFAULT_FIX_OPTIONS, Mt as getMetersPerPixel, N as DEFAULT_FINAL_PROTECTIVE_FIRE_OPTIONS, Nt as roundToFixed, O as DEFAULT_BATTLE_HANDOVER_LINE_OPTIONS, Ot as computeInitialWidthPoint, P as DEFAULT_ENCIRCLEMENT_OPTIONS, Q as DEFAULT_BLOCK_OPTIONS, R as DEFAULT_GENERIC_RECTANGLE_OPTIONS, S as DEFAULT_OBSTACLE_BYPASS_DIFFICULT_OPTIONS, St as createMidpointPerpendicularDrawRule, T as DEFAULT_JOINT_TACTICAL_ACTION_AREA_OPTIONS, Tt as snapToMidpointPerpendicular, U as DEFAULT_CANALIZE_OPTIONS, V as DEFAULT_GENERIC_CIRCLE_OPTIONS, W as DEFAULT_BYPASS_OPTIONS, X as DEFAULT_BOUNDARY_OPTIONS, Y as DEFAULT_LIGHT_LINE_OPTIONS, Z as DEFAULT_BLOCK_ARROW_OPTIONS, _ as DEFAULT_TACTICAL_ARROW_OPTIONS, _t as point12DrawRule, a as resolveStyleHints, at as DEFAULT_AREA_OF_OPERATIONS_OPTIONS, b as DEFAULT_OBSTACLE_BYPASS_IMPOSSIBLE_OPTIONS, bt as blockDrawRule, c as DEFINITIONS, ct as rectangleDrawRule, d as getDefaultOptions, dt as line24DrawRule, et as DEFAULT_ATTACK_HELICOPTER_OPTIONS, f as listControlMeasureMetadata, ft as line23DrawRule, g as DEFAULT_STRONG_POINT_OPTIONS, gt as attackByFireDrawRule, h as DEFAULT_SUPPORT_BY_FIRE_OPTIONS, ht as ambushDrawRule, i as normalizeTextAmplifiers, it as DEFAULT_ASSEMBLY_AREA_OPTIONS, j as DEFAULT_FLOT_OPTIONS, jt as EPSILON, k as DEFAULT_HANDOVER_LINE_OPTIONS, kt as project, l as getControlMeasureMetadata, lt as axis1DrawRule, m as DEFAULT_SUPPORTING_ATTACK_OPTIONS, mt as line1DrawRule, n as TEXT_AMPLIFIER_FIELDS, nt as DEFAULT_ANTITANK_WALL_OPTIONS, o as CONTROL_MEASURE_IDS, ot as DEFAULT_AMBUSH_OPTIONS, p as DEFAULT_TURN_OPTIONS, pt as turnDrawRule, q as DEFAULT_GENERIC_C2_LINE_OPTIONS, r as canonicalTextAmplifierKey, rt as DEFAULT_ANTITANK_DITCH_OPTIONS, s as CONTROL_MEASURE_METADATA, st as DEFAULT_AIRBORNE_ATTACK_OPTIONS, t as renderControlMeasure, tt as DEFAULT_ATTACK_BY_FIRE_OPTIONS, u as getControlMeasureMetadataByValue, ut as supportByFireDrawRule, v as DEFAULT_PRINCIPAL_DIRECTION_OF_FIRE_OPTIONS, vt as centerRadiusDrawRule, w as DEFAULT_LANDING_ZONE_OPTIONS, wt as pointOnMidpointPerpendicularAxis, x as DEFAULT_OBSTACLE_BYPASS_EASY_OPTIONS, xt as computeDefaultMidpointPerpendicularPoint, y as DEFAULT_PICKUP_ZONE_OPTIONS, yt as disruptDrawRule, z as DEFAULT_GENERIC_POLYGON_OPTIONS } from "./renderControlMeasure-DHQO01PA.mjs";
|
|
2
2
|
//#region src/freeze-orientation.ts
|
|
3
3
|
/**
|
|
4
4
|
* Dispatches to a measure kind's `freezeOrientation` hook (see
|
package/dist/preview/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { X as ControlMeasureId } from "../index-
|
|
1
|
+
import { X as ControlMeasureId, cr as TextAmplifiers } from "../index-CsJcNxFQ.mjs";
|
|
2
2
|
import { FeatureCollection, Geometry } from "geojson";
|
|
3
3
|
|
|
4
4
|
//#region src/preview/index.d.ts
|
|
@@ -7,8 +7,16 @@ import { FeatureCollection, Geometry } from "geojson";
|
|
|
7
7
|
* so it runs identically at build time (docs catalog, README generator) and in
|
|
8
8
|
* the browser (preview app). Returns an empty collection if the generator
|
|
9
9
|
* throws, so a single broken measure never breaks a whole gallery.
|
|
10
|
+
*
|
|
11
|
+
* `overrides.textAmplifiers` and `overrides.options` are each merged over the
|
|
12
|
+
* sample's own amplifiers/options (override wins per key, sample-only keys
|
|
13
|
+
* survive) — used by the params panel's placement preview to substitute
|
|
14
|
+
* placeholder values (`<T>`, `<N>`, …) for whatever the sample carries.
|
|
10
15
|
*/
|
|
11
|
-
declare function renderRepresentative(id: ControlMeasureId
|
|
16
|
+
declare function renderRepresentative(id: ControlMeasureId, overrides?: {
|
|
17
|
+
textAmplifiers?: TextAmplifiers;
|
|
18
|
+
options?: Record<string, unknown>;
|
|
19
|
+
}): FeatureCollection<Geometry, unknown>;
|
|
12
20
|
/** A styling-free preview primitive. Consumers supply stroke, radius, font,
|
|
13
21
|
* and colors when they draw it. */
|
|
14
22
|
interface PreviewShape {
|
|
@@ -26,13 +34,14 @@ interface PreviewShape {
|
|
|
26
34
|
rotation?: number;
|
|
27
35
|
/**
|
|
28
36
|
* Text height in the same SVG units as `d`/`cx`/`cy`, derived from the
|
|
29
|
-
* source label's ground-anchored `
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
37
|
+
* source label's ground-anchored `textSizeMeters` (ADR-0028) scaled through
|
|
38
|
+
* the fit into the viewBox, then clamped so a long string can't exceed ~40%
|
|
39
|
+
* of the viewBox width. Present only when the label carried real
|
|
40
|
+
* ground-anchored sizing; a fixed glyph with no sizing (e.g. breach's "B",
|
|
41
|
+
* or Boundary's echelon-only sample) or a screen-anchored label (bare
|
|
42
|
+
* `textSizePixels`, unresolvable to a ground size without a live map
|
|
43
|
+
* resolution) leaves this `undefined` — a consumer should fall back to its
|
|
44
|
+
* own fixed font size, matching behavior from before this field existed.
|
|
36
45
|
*/
|
|
37
46
|
heightPx?: number;
|
|
38
47
|
/** Horizontal alignment relative to (`cx`, `cy`), mirroring the label
|
|
@@ -56,5 +65,51 @@ declare function projectRenderToShapes(fc: FeatureCollection<Geometry, unknown>,
|
|
|
56
65
|
shapes: PreviewShape[];
|
|
57
66
|
ok: boolean;
|
|
58
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Grows a viewBox to include every `text` shape's estimated on-screen box —
|
|
70
|
+
* {@link projectRenderToShapes} fits geometry coordinates only, so an
|
|
71
|
+
* anchor-aware label (e.g. a phase line's end-anchored "PL ECHO") can extend
|
|
72
|
+
* well past the plain `0 0 width height` viewBox. Consumers should build
|
|
73
|
+
* their SVG `viewBox` from this instead.
|
|
74
|
+
*
|
|
75
|
+
* For each text shape (skipping shapes without `cx`/`cy`), estimates a box
|
|
76
|
+
* from its glyph count (`CHAR_WIDTH_RATIO` × `fontSize`) and `fontSize`
|
|
77
|
+
* itself, placed per `textAnchor` horizontally and centered on `cy`
|
|
78
|
+
* vertically (SVG text uses `dominant-baseline="central"`), rotates its
|
|
79
|
+
* corners around `(cx, cy)` by the same angle the SVG transform applies
|
|
80
|
+
* (`renderedAngle = PI - rotation`, negated for SVG's y-down axis — see
|
|
81
|
+
* {@link svgTextTransform}; labels commonly carry `rotation = PI`,
|
|
82
|
+
* which renders flat, so an undefined rotation must not be treated as
|
|
83
|
+
* rotated), and unions the result with the base `[0, 0, width, height]` box.
|
|
84
|
+
*
|
|
85
|
+
* `fontSize` is supplied by the caller since each gallery picks its own
|
|
86
|
+
* fallback/cap for `heightPx`.
|
|
87
|
+
*/
|
|
88
|
+
declare function viewBoxWithLabels(shapes: PreviewShape[], dims: {
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
}, fontSize: (s: PreviewShape) => number): {
|
|
92
|
+
minX: number;
|
|
93
|
+
minY: number;
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The SVG `viewBox` string for a preview, grown to include every label's
|
|
99
|
+
* on-screen box (see {@link viewBoxWithLabels}). The convenience every Vue
|
|
100
|
+
* consumer wants — they only ever format the box into this exact string.
|
|
101
|
+
*/
|
|
102
|
+
declare function viewBoxString(shapes: PreviewShape[], dims: {
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
}, fontSize: (s: PreviewShape) => number): string;
|
|
106
|
+
/**
|
|
107
|
+
* The SVG `transform` attribute that rotates a `text` shape into place, or
|
|
108
|
+
* `undefined` for an unrotated/incomplete shape. Text rotations use the same
|
|
109
|
+
* generator convention as the map adapters (`renderedAngle = PI - rotation`);
|
|
110
|
+
* SVG's y-axis points down, so the angle is negated. Shared by every SVG
|
|
111
|
+
* preview consumer (sidebar gallery, docs catalog, README generator).
|
|
112
|
+
*/
|
|
113
|
+
declare function svgTextTransform(s: PreviewShape): string | undefined;
|
|
59
114
|
//#endregion
|
|
60
|
-
export { PreviewShape, ProjectDimensions, projectRenderToShapes, renderRepresentative };
|
|
115
|
+
export { PreviewShape, ProjectDimensions, projectRenderToShapes, renderRepresentative, svgTextTransform, viewBoxString, viewBoxWithLabels };
|
package/dist/preview/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DEFINITIONS, t as renderControlMeasure } from "../renderControlMeasure-
|
|
1
|
+
import { c as DEFINITIONS, t as renderControlMeasure } from "../renderControlMeasure-DHQO01PA.mjs";
|
|
2
2
|
//#region src/preview/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* Unitless `previewSample` points (~`[-1, 1]`) are scaled by this degree offset
|
|
@@ -59,16 +59,27 @@ function representativeSample(id) {
|
|
|
59
59
|
* so it runs identically at build time (docs catalog, README generator) and in
|
|
60
60
|
* the browser (preview app). Returns an empty collection if the generator
|
|
61
61
|
* throws, so a single broken measure never breaks a whole gallery.
|
|
62
|
+
*
|
|
63
|
+
* `overrides.textAmplifiers` and `overrides.options` are each merged over the
|
|
64
|
+
* sample's own amplifiers/options (override wins per key, sample-only keys
|
|
65
|
+
* survive) — used by the params panel's placement preview to substitute
|
|
66
|
+
* placeholder values (`<T>`, `<N>`, …) for whatever the sample carries.
|
|
62
67
|
*/
|
|
63
|
-
function renderRepresentative(id) {
|
|
68
|
+
function renderRepresentative(id, overrides) {
|
|
64
69
|
try {
|
|
65
70
|
const { controlPoints, options, textAmplifiers } = representativeSample(id);
|
|
66
71
|
return renderControlMeasure({
|
|
67
72
|
id: "preview",
|
|
68
73
|
kind: id,
|
|
69
74
|
controlPoints,
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
options: {
|
|
76
|
+
...options,
|
|
77
|
+
...overrides?.options
|
|
78
|
+
},
|
|
79
|
+
textAmplifiers: {
|
|
80
|
+
...textAmplifiers,
|
|
81
|
+
...overrides?.textAmplifiers
|
|
82
|
+
}
|
|
72
83
|
});
|
|
73
84
|
} catch {
|
|
74
85
|
return {
|
|
@@ -117,33 +128,133 @@ function projectRenderToShapes(fc, dims) {
|
|
|
117
128
|
ok: shapes.length > 0
|
|
118
129
|
};
|
|
119
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Meters per degree of latitude, converting a label's ground-meter height
|
|
133
|
+
* (`textSizeMeters`, ADR-0028) into the lon/lat degree frame the render was
|
|
134
|
+
* fit in. Preview samples sit near the origin (see `D`), where this holds for
|
|
135
|
+
* both axes. Without it the raw height overshoots by ~5 orders of magnitude,
|
|
136
|
+
* pinning every label to the width/height caps — larger than its geometric
|
|
137
|
+
* footprint, swallowing the clearance the generator baked in between line and
|
|
138
|
+
* label.
|
|
139
|
+
*/
|
|
140
|
+
const METERS_PER_DEGREE = 111320;
|
|
120
141
|
/** Rough average glyph width, as a ratio of height, for a bold sans-serif
|
|
121
142
|
* label — used only to estimate whether a string will overflow the viewBox,
|
|
122
143
|
* not to lay out real text. */
|
|
123
144
|
const CHAR_WIDTH_RATIO = .62;
|
|
145
|
+
/**
|
|
146
|
+
* Glyph-width ratio for {@link viewBoxWithLabels}' extent boxes. Deliberately
|
|
147
|
+
* wider than {@link CHAR_WIDTH_RATIO}: the average slightly undershoots bold
|
|
148
|
+
* uppercase strings ("PL ECHO"), and an extent estimate that undershoots crops
|
|
149
|
+
* the label edge while one that overshoots only costs a little slack.
|
|
150
|
+
*/
|
|
151
|
+
const EXTENT_CHAR_WIDTH_RATIO = .75;
|
|
124
152
|
/** A text shape may not claim more than this fraction of the viewBox width;
|
|
125
153
|
* longer strings shrink their `heightPx` to fit. */
|
|
126
154
|
const MAX_TEXT_WIDTH_RATIO = .4;
|
|
127
155
|
/**
|
|
128
156
|
* A text shape may not claim more than this fraction of the viewBox height —
|
|
129
157
|
* guards short strings (e.g. "LL", "BHL") whose ground-anchored size would
|
|
130
|
-
* otherwise fit the width cap easily but still tower over the sample line.
|
|
131
|
-
*
|
|
158
|
+
* otherwise fit the width cap easily but still tower over the sample line. The
|
|
159
|
+
* preview samples sit near the origin (see `D`), so the fit `scale` is large
|
|
160
|
+
* and a real-sized label's `raw` height overshoots this cap almost every time;
|
|
161
|
+
* the cap, not the ground size, is what sets the on-screen height. Kept well
|
|
162
|
+
* below the fixed glyph fallback so labels read as annotations on the line
|
|
163
|
+
* rather than dominating a 96×48 thumbnail.
|
|
132
164
|
*/
|
|
133
|
-
const MAX_TEXT_HEIGHT_RATIO = .
|
|
165
|
+
const MAX_TEXT_HEIGHT_RATIO = .16;
|
|
166
|
+
/**
|
|
167
|
+
* Grows a viewBox to include every `text` shape's estimated on-screen box —
|
|
168
|
+
* {@link projectRenderToShapes} fits geometry coordinates only, so an
|
|
169
|
+
* anchor-aware label (e.g. a phase line's end-anchored "PL ECHO") can extend
|
|
170
|
+
* well past the plain `0 0 width height` viewBox. Consumers should build
|
|
171
|
+
* their SVG `viewBox` from this instead.
|
|
172
|
+
*
|
|
173
|
+
* For each text shape (skipping shapes without `cx`/`cy`), estimates a box
|
|
174
|
+
* from its glyph count (`CHAR_WIDTH_RATIO` × `fontSize`) and `fontSize`
|
|
175
|
+
* itself, placed per `textAnchor` horizontally and centered on `cy`
|
|
176
|
+
* vertically (SVG text uses `dominant-baseline="central"`), rotates its
|
|
177
|
+
* corners around `(cx, cy)` by the same angle the SVG transform applies
|
|
178
|
+
* (`renderedAngle = PI - rotation`, negated for SVG's y-down axis — see
|
|
179
|
+
* {@link svgTextTransform}; labels commonly carry `rotation = PI`,
|
|
180
|
+
* which renders flat, so an undefined rotation must not be treated as
|
|
181
|
+
* rotated), and unions the result with the base `[0, 0, width, height]` box.
|
|
182
|
+
*
|
|
183
|
+
* `fontSize` is supplied by the caller since each gallery picks its own
|
|
184
|
+
* fallback/cap for `heightPx`.
|
|
185
|
+
*/
|
|
186
|
+
function viewBoxWithLabels(shapes, dims, fontSize) {
|
|
187
|
+
let minX = 0;
|
|
188
|
+
let minY = 0;
|
|
189
|
+
let maxX = dims.width;
|
|
190
|
+
let maxY = dims.height;
|
|
191
|
+
for (const s of shapes) {
|
|
192
|
+
if (s.type !== "text" || s.cx === void 0 || s.cy === void 0) continue;
|
|
193
|
+
const font = fontSize(s);
|
|
194
|
+
const w = (s.text?.length ?? 0) * EXTENT_CHAR_WIDTH_RATIO * font;
|
|
195
|
+
const h = font;
|
|
196
|
+
const left = s.textAnchor === "start" ? s.cx : s.textAnchor === "end" ? s.cx - w : s.cx - w / 2;
|
|
197
|
+
const right = left + w;
|
|
198
|
+
const top = s.cy - h / 2;
|
|
199
|
+
const bottom = s.cy + h / 2;
|
|
200
|
+
const theta = s.rotation === void 0 ? 0 : -(Math.PI - s.rotation);
|
|
201
|
+
const cos = Math.cos(theta);
|
|
202
|
+
const sin = Math.sin(theta);
|
|
203
|
+
for (const [x, y] of [
|
|
204
|
+
[left, top],
|
|
205
|
+
[right, top],
|
|
206
|
+
[right, bottom],
|
|
207
|
+
[left, bottom]
|
|
208
|
+
]) {
|
|
209
|
+
const rx = s.cx + (x - s.cx) * cos - (y - s.cy) * sin;
|
|
210
|
+
const ry = s.cy + (x - s.cx) * sin + (y - s.cy) * cos;
|
|
211
|
+
if (rx < minX) minX = rx;
|
|
212
|
+
if (rx > maxX) maxX = rx;
|
|
213
|
+
if (ry < minY) minY = ry;
|
|
214
|
+
if (ry > maxY) maxY = ry;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
minX,
|
|
219
|
+
minY,
|
|
220
|
+
width: maxX - minX,
|
|
221
|
+
height: maxY - minY
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The SVG `viewBox` string for a preview, grown to include every label's
|
|
226
|
+
* on-screen box (see {@link viewBoxWithLabels}). The convenience every Vue
|
|
227
|
+
* consumer wants — they only ever format the box into this exact string.
|
|
228
|
+
*/
|
|
229
|
+
function viewBoxString(shapes, dims, fontSize) {
|
|
230
|
+
const box = viewBoxWithLabels(shapes, dims, fontSize);
|
|
231
|
+
return `${box.minX} ${box.minY} ${box.width} ${box.height}`;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The SVG `transform` attribute that rotates a `text` shape into place, or
|
|
235
|
+
* `undefined` for an unrotated/incomplete shape. Text rotations use the same
|
|
236
|
+
* generator convention as the map adapters (`renderedAngle = PI - rotation`);
|
|
237
|
+
* SVG's y-axis points down, so the angle is negated. Shared by every SVG
|
|
238
|
+
* preview consumer (sidebar gallery, docs catalog, README generator).
|
|
239
|
+
*/
|
|
240
|
+
function svgTextTransform(s) {
|
|
241
|
+
if (s.rotation === void 0 || s.cx === void 0 || s.cy === void 0) return void 0;
|
|
242
|
+
return `rotate(${(-((Math.PI - s.rotation) * 180) / Math.PI).toFixed(3)} ${s.cx.toFixed(3)} ${s.cy.toFixed(3)})`;
|
|
243
|
+
}
|
|
134
244
|
/**
|
|
135
|
-
* Resolves a label's SVG-unit text height from its `
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
245
|
+
* Resolves a label's SVG-unit text height from its `textSizeMeters` property
|
|
246
|
+
* (ADR-0028's ground anchor), scaled by the same `scale` the geometry was fit
|
|
247
|
+
* with, then clamped by both the height cap and the width the string would
|
|
248
|
+
* occupy at that height (so a long string can't overflow `maxWidthPx`).
|
|
249
|
+
* Returns `undefined` when the label carries no ground-anchored sizing — a
|
|
250
|
+
* screen-anchored label (bare `textSizePixels`, meaningless without a live map
|
|
251
|
+
* resolution to convert it) or one with no size at all — and the caller
|
|
252
|
+
* leaves `heightPx` unset.
|
|
141
253
|
*/
|
|
142
254
|
function resolveTextHeightPx(labelProps, text, limits) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const raw = sizePixels * sizeResolution * limits.scale;
|
|
255
|
+
const sizeMeters = labelProps.textSizeMeters;
|
|
256
|
+
if (typeof sizeMeters !== "number") return void 0;
|
|
257
|
+
const raw = sizeMeters * limits.scale / METERS_PER_DEGREE;
|
|
147
258
|
const widthLimit = text.length > 0 ? limits.maxWidthPx / (text.length * CHAR_WIDTH_RATIO) : Infinity;
|
|
148
259
|
return Math.min(raw, limits.maxHeightPx, widthLimit);
|
|
149
260
|
}
|
|
@@ -251,4 +362,4 @@ function collectShapes(g, tx, out, bboxArea, textLimits, props) {
|
|
|
251
362
|
}
|
|
252
363
|
}
|
|
253
364
|
//#endregion
|
|
254
|
-
export { projectRenderToShapes, renderRepresentative };
|
|
365
|
+
export { projectRenderToShapes, renderRepresentative, svgTextTransform, viewBoxString, viewBoxWithLabels };
|