@threekit-tools/treble 0.0.92 → 0.0.94

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.
Files changed (281) hide show
  1. package/dist/Treble/Treble.js +4 -3
  2. package/dist/Treble/snapshots.d.ts +2 -2
  3. package/dist/Treble/snapshots.js +1 -1
  4. package/dist/Treble/wishlist.d.ts +1 -1
  5. package/dist/Treble/wishlist.js +1 -1
  6. package/dist/api/assets.d.ts +1 -0
  7. package/dist/api/{products.js → assets.js} +12 -33
  8. package/dist/api/catalog.js +1 -1
  9. package/dist/api/configurations.d.ts +1 -0
  10. package/dist/api/configurations.js +10 -3
  11. package/dist/api/datatables.js +1 -1
  12. package/dist/api/index.d.ts +2 -2
  13. package/dist/api/index.js +2 -2
  14. package/dist/api/orders.js +1 -1
  15. package/dist/api/price.js +1 -1
  16. package/dist/components/AttributeTitle/index.d.ts +2 -2
  17. package/dist/components/AttributeValue/index.d.ts +2 -2
  18. package/dist/components/BreatheAnimation/index.js +1 -1
  19. package/dist/components/Button/index.d.ts +3 -3
  20. package/dist/components/Cards/index.d.ts +3 -3
  21. package/dist/components/DevTools/index.d.ts +2 -2
  22. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  23. package/dist/components/DraggableHint/index.d.ts +2 -2
  24. package/dist/components/Dropdown/index.d.ts +3 -3
  25. package/dist/components/FlatForm/index.d.ts +2 -2
  26. package/dist/components/FormComponentDescription/index.d.ts +1 -1
  27. package/dist/components/FormComponentTitle/index.d.ts +1 -1
  28. package/dist/components/Player/index.d.ts +9 -9
  29. package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
  30. package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
  31. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  32. package/dist/components/ProductDescription/index.d.ts +3 -3
  33. package/dist/components/ProductName/index.d.ts +3 -3
  34. package/dist/components/Share/index.d.ts +2 -2
  35. package/dist/components/Share/index.js +1 -1
  36. package/dist/components/Share/share.styles.d.ts +1 -1
  37. package/dist/components/Snapshots/index.d.ts +2 -2
  38. package/dist/components/Strips/index.d.ts +3 -3
  39. package/dist/components/Swatch/index.d.ts +3 -3
  40. package/dist/components/Switch/index.d.ts +3 -3
  41. package/dist/components/TextInput/index.d.ts +3 -3
  42. package/dist/components/ThreekitProvider/index.d.ts +6 -3
  43. package/dist/components/ThreekitProvider/index.js +27 -2
  44. package/dist/components/Tiles/index.d.ts +3 -3
  45. package/dist/components/TilesGroup/index.d.ts +3 -3
  46. package/dist/components/TotalPrice/index.d.ts +3 -3
  47. package/dist/components/TrebleApp/index.d.ts +3 -3
  48. package/dist/components/TrebleApp/index.js +5 -0
  49. package/dist/components/TurntableAnimation/index.js +1 -1
  50. package/dist/components/Upload/index.d.ts +3 -3
  51. package/dist/components/Upload/index.js +1 -1
  52. package/dist/components/UploadArea/index.d.ts +3 -3
  53. package/dist/components/UploadArea/index.js +1 -1
  54. package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
  55. package/dist/components/Wishlist/index.d.ts +4 -4
  56. package/dist/components/Wishlist/index.js +1 -1
  57. package/dist/components/Zoom/index.d.ts +6 -6
  58. package/dist/components/containers/formInputContainer.d.ts +2 -2
  59. package/dist/components/formComponents.d.ts +6 -6
  60. package/dist/components/message/index.d.ts +1 -1
  61. package/dist/constants.d.ts +6 -6
  62. package/dist/hooks/useAttribute/index.d.ts +4 -4
  63. package/dist/hooks/useAttribute/index.js +3 -3
  64. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  65. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  66. package/dist/hooks/useConfigurator/index.js +3 -5
  67. package/dist/hooks/useDevTools/index.d.ts +1 -1
  68. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  69. package/dist/hooks/useNestedConfigurator/index.js +3 -3
  70. package/dist/hooks/usePlayer/index.d.ts +1 -1
  71. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  72. package/dist/hooks/useProductCache/index.js +1 -1
  73. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  74. package/dist/hooks/useResetProduct/index.js +1 -1
  75. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1 -1
  76. package/dist/hooks/useRoomBuilder/constants.js +2 -2
  77. package/dist/hooks/useRoomBuilder/themes.js +1 -1
  78. package/dist/hooks/useRoomBuilder/types.d.ts +7 -7
  79. package/dist/hooks/useRoomBuilder/types.js +5 -5
  80. package/dist/hooks/useRoomBuilder/validators.d.ts +1 -1
  81. package/dist/hooks/useShare/index.d.ts +1 -1
  82. package/dist/hooks/useShare/index.js +4 -2
  83. package/dist/hooks/useSingleAnimation/index.js +1 -1
  84. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  85. package/dist/hooks/useWishlist/index.d.ts +1 -1
  86. package/dist/hooks/useZoom/index.d.ts +1 -1
  87. package/dist/http/assets.d.ts +2 -0
  88. package/dist/http/assets.js +16 -0
  89. package/dist/http/index.d.ts +2 -2
  90. package/dist/http/index.js +2 -2
  91. package/dist/http/orders.d.ts +1 -1
  92. package/dist/icons/Spinner.d.ts +2 -2
  93. package/dist/store/attributes.d.ts +4 -4
  94. package/dist/store/attributes.js +2 -4
  95. package/dist/store/index.d.ts +6 -6
  96. package/dist/store/price.d.ts +1 -1
  97. package/dist/store/price.js +1 -1
  98. package/dist/store/product.d.ts +2 -2
  99. package/dist/store/product.js +1 -1
  100. package/dist/store/translations.d.ts +10 -8
  101. package/dist/store/translations.js +39 -19
  102. package/dist/store/treble.d.ts +1 -1
  103. package/dist/store/treble.js +1 -1
  104. package/dist/store/wishlist.d.ts +2 -2
  105. package/dist/store/wishlist.js +1 -1
  106. package/dist/types.d.ts +19 -17
  107. package/dist/types.js +9 -9
  108. package/dist/utils.d.ts +2 -6
  109. package/dist/utils.js +12 -13
  110. package/package.json +1 -2
  111. package/dist/Treble/snapshot.d.ts +0 -22
  112. package/dist/Treble/snapshot.js +0 -247
  113. package/dist/api/products.d.ts +0 -4
  114. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  115. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  116. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -164
  117. package/dist/hooks/useSpaces/SpacesState.js +0 -1751
  118. package/dist/hooks/useSpaces/constants.d.ts +0 -64
  119. package/dist/hooks/useSpaces/constants.js +0 -109
  120. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -20
  121. package/dist/hooks/useSpaces/dataHandlers.js +0 -254
  122. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  123. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  124. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  125. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  126. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  127. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  128. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  129. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  130. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  131. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  132. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  133. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -33
  134. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  135. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  136. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  137. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  138. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  139. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  140. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -10
  141. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -88
  142. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  143. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  144. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  145. package/dist/hooks/useSpaces/draw/index.js +0 -129
  146. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  147. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  148. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  149. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  150. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  151. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  152. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  153. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  154. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  155. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  156. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  157. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  158. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  159. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  160. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  161. package/dist/hooks/useSpaces/geometry/findLoops.js +0 -117
  162. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  163. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  164. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  165. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  166. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  167. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  168. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  169. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  170. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  171. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  172. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  173. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  174. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  175. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  176. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  177. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  178. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  179. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  180. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  181. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  182. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  183. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  184. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  185. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  186. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  187. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  188. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  189. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  190. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  191. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  192. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  193. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  194. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  195. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  196. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  197. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  198. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  199. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  200. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  201. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  202. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  203. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  204. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  205. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  206. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  207. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  208. package/dist/hooks/useSpaces/index.d.ts +0 -82
  209. package/dist/hooks/useSpaces/index.js +0 -482
  210. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  211. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  212. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  213. package/dist/hooks/useSpaces/themes/default.js +0 -96
  214. package/dist/hooks/useSpaces/themes/index.d.ts +0 -11
  215. package/dist/hooks/useSpaces/themes/index.js +0 -21
  216. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  217. package/dist/hooks/useSpaces/themes/light.js +0 -96
  218. package/dist/hooks/useSpaces/types.d.ts +0 -339
  219. package/dist/hooks/useSpaces/types.js +0 -54
  220. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  221. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  222. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  223. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  224. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  225. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  226. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  227. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  228. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  229. package/dist/hooks/useSpaces/validators/index.js +0 -40
  230. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  231. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  232. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  233. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  234. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  235. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  236. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  237. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  238. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  239. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  240. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  241. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  242. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  243. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  244. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  245. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  246. package/dist/hooks/useSpaces/validators/messaging.d.ts +0 -8
  247. package/dist/hooks/useSpaces/validators/messaging.js +0 -18
  248. package/dist/http/products.d.ts +0 -1
  249. package/dist/http/products.js +0 -12
  250. package/dist/icons/AngleSnapping.d.ts +0 -3
  251. package/dist/icons/AngleSnapping.js +0 -28
  252. package/dist/icons/Center.d.ts +0 -3
  253. package/dist/icons/Center.js +0 -24
  254. package/dist/icons/GridSnapping.d.ts +0 -3
  255. package/dist/icons/GridSnapping.js +0 -28
  256. package/dist/icons/LayoutAlt.d.ts +0 -3
  257. package/dist/icons/LayoutAlt.js +0 -21
  258. package/dist/icons/Magnet.d.ts +0 -3
  259. package/dist/icons/Magnet.js +0 -27
  260. package/dist/icons/Player3D.d.ts +0 -3
  261. package/dist/icons/Player3D.js +0 -21
  262. package/dist/icons/Ruler copy.d.ts +0 -3
  263. package/dist/icons/Ruler copy.js +0 -22
  264. package/dist/icons/RulerBlank.d.ts +0 -3
  265. package/dist/icons/RulerBlank.js +0 -25
  266. package/dist/icons/RulerDetailed copy.d.ts +0 -3
  267. package/dist/icons/RulerDetailed copy.js +0 -27
  268. package/dist/icons/RulerDetailed.d.ts +0 -3
  269. package/dist/icons/RulerDetailed.js +0 -27
  270. package/dist/icons/Save.d.ts +0 -3
  271. package/dist/icons/Save.js +0 -21
  272. package/dist/icons/UnitCm.d.ts +0 -3
  273. package/dist/icons/UnitCm.js +0 -22
  274. package/dist/icons/UnitFeet.d.ts +0 -3
  275. package/dist/icons/UnitFeet.js +0 -22
  276. package/dist/icons/UnitInch.d.ts +0 -3
  277. package/dist/icons/UnitInch.js +0 -22
  278. package/dist/icons/UnitMeter.d.ts +0 -3
  279. package/dist/icons/UnitMeter.js +0 -21
  280. package/dist/store/spaces.d.ts +0 -47
  281. package/dist/store/spaces.js +0 -197
@@ -1,64 +0,0 @@
1
- import { ICoordinate2D, ISpacesAttributes, IWallsValidationConfig } from './types';
2
- export declare enum SpacesMetadata {
3
- VALUE = "_tkSpace_value"
4
- }
5
- export declare enum WallAttributes {
6
- START_X = "_tkSpace_startX",
7
- START_Y = "_tkSpace_startY",
8
- START_Z = "_tkSpace_startZ",
9
- END_X = "_tkSpace_endX",
10
- END_Y = "_tkSpace_endY",
11
- END_Z = "_tkSpace_endZ",
12
- CONNECTIONS = "_tkSpace_connections",
13
- WALL_HEIGHT = "_tkSpace_wallHeight",
14
- WALL_THICKNESS = "_tkSpace_wallThickness",
15
- VISIBILITY = "_tkSpace_visibility"
16
- }
17
- export declare enum WallMetadata {
18
- MIN_LENGTH = "_tkSpace_minLength",
19
- PADDING = "_tkSpace_padding"
20
- }
21
- export declare enum DoorAttributes {
22
- ORIENTATION = "_tkSpace_doorOrientation",
23
- OPENING_DIRECTION = "_tkSpace_doorOpeningDirection",
24
- SHOW_SWING = "_tkSpace_doorShowSwing"
25
- }
26
- export declare enum DoorOrientations {
27
- LEFT = "left",
28
- RIGHT = "right"
29
- }
30
- export declare enum DoorOpeningDirections {
31
- INSIDE = "inside",
32
- OUTSIDE = "outside"
33
- }
34
- export declare const ATTRIBUTE_NAME_DEFAULTS: ISpacesAttributes;
35
- export declare const SCALE = 0.02;
36
- export declare const SNAP_PROXIMITY = 16;
37
- export declare const ZOOM_MAX = 100;
38
- export declare const ZOOM_MIN = 20;
39
- export declare const ZOOM_DEFAULT = 40;
40
- export declare const ZOOM_SENSITIVITY = 0.8;
41
- export declare const TRANSLATE_MAX: ICoordinate2D;
42
- export declare const TRANSLATE_MIN: ICoordinate2D;
43
- export declare const TRANSLATE_DEFAULT: ICoordinate2D;
44
- export declare const UNIT_LABELS: {
45
- feet: string;
46
- meter: string;
47
- inch: string;
48
- cm: string;
49
- };
50
- export declare const UNIT_FACTORS: {
51
- cm: number;
52
- meter: number;
53
- feet: number;
54
- inch: number;
55
- };
56
- export declare const FEATURE_LABELS: {
57
- windows: string;
58
- doors: string;
59
- openings: string;
60
- };
61
- export declare const VALIDATION_CONFIG_DEFAULT: IWallsValidationConfig;
62
- export declare const FEATURE_LENGTH = 120;
63
- export declare const UI_ANCHOR_DISTANCE = -60;
64
- export declare const WALL_SNAP_DISTANCE = 12;
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var _a, _b, _c, _d;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.WALL_SNAP_DISTANCE = exports.UI_ANCHOR_DISTANCE = exports.FEATURE_LENGTH = exports.VALIDATION_CONFIG_DEFAULT = exports.FEATURE_LABELS = exports.UNIT_FACTORS = exports.UNIT_LABELS = exports.TRANSLATE_DEFAULT = exports.TRANSLATE_MIN = exports.TRANSLATE_MAX = exports.ZOOM_SENSITIVITY = exports.ZOOM_DEFAULT = exports.ZOOM_MIN = exports.ZOOM_MAX = exports.SNAP_PROXIMITY = exports.SCALE = exports.ATTRIBUTE_NAME_DEFAULTS = exports.DoorOpeningDirections = exports.DoorOrientations = exports.DoorAttributes = exports.WallMetadata = exports.WallAttributes = exports.SpacesMetadata = void 0;
5
- var types_1 = require("./types");
6
- var SpacesAttributes;
7
- (function (SpacesAttributes) {
8
- SpacesAttributes["WALLS"] = "_tkSpace_walls";
9
- SpacesAttributes["WINDOWS"] = "_tkSpace_windows";
10
- SpacesAttributes["DOORS"] = "_tkSpace_doors";
11
- SpacesAttributes["OPENINGS"] = "_tkSpace_openings";
12
- })(SpacesAttributes || (SpacesAttributes = {}));
13
- var SpacesMetadata;
14
- (function (SpacesMetadata) {
15
- SpacesMetadata["VALUE"] = "_tkSpace_value";
16
- })(SpacesMetadata = exports.SpacesMetadata || (exports.SpacesMetadata = {}));
17
- var WallAttributes;
18
- (function (WallAttributes) {
19
- WallAttributes["START_X"] = "_tkSpace_startX";
20
- WallAttributes["START_Y"] = "_tkSpace_startY";
21
- WallAttributes["START_Z"] = "_tkSpace_startZ";
22
- WallAttributes["END_X"] = "_tkSpace_endX";
23
- WallAttributes["END_Y"] = "_tkSpace_endY";
24
- WallAttributes["END_Z"] = "_tkSpace_endZ";
25
- WallAttributes["CONNECTIONS"] = "_tkSpace_connections";
26
- WallAttributes["WALL_HEIGHT"] = "_tkSpace_wallHeight";
27
- WallAttributes["WALL_THICKNESS"] = "_tkSpace_wallThickness";
28
- WallAttributes["VISIBILITY"] = "_tkSpace_visibility";
29
- })(WallAttributes = exports.WallAttributes || (exports.WallAttributes = {}));
30
- var WallMetadata;
31
- (function (WallMetadata) {
32
- WallMetadata["MIN_LENGTH"] = "_tkSpace_minLength";
33
- WallMetadata["PADDING"] = "_tkSpace_padding";
34
- })(WallMetadata = exports.WallMetadata || (exports.WallMetadata = {}));
35
- var FeatureAttributes;
36
- (function (FeatureAttributes) {
37
- FeatureAttributes["POSITION_X"] = "_tkSpace_offsetX";
38
- FeatureAttributes["POSITION_Y"] = "_tkSpace_offsetY";
39
- FeatureAttributes["CONNECTED_TO"] = "_tkSpace_connectedTo";
40
- FeatureAttributes["FEATURE_HEIGHT"] = "_tkSpace_featureHeight";
41
- FeatureAttributes["FEATURE_LENGTH"] = "_tkSpace_featureWidth";
42
- })(FeatureAttributes || (FeatureAttributes = {}));
43
- var DoorAttributes;
44
- (function (DoorAttributes) {
45
- DoorAttributes["ORIENTATION"] = "_tkSpace_doorOrientation";
46
- DoorAttributes["OPENING_DIRECTION"] = "_tkSpace_doorOpeningDirection";
47
- DoorAttributes["SHOW_SWING"] = "_tkSpace_doorShowSwing";
48
- })(DoorAttributes = exports.DoorAttributes || (exports.DoorAttributes = {}));
49
- var DoorOrientations;
50
- (function (DoorOrientations) {
51
- DoorOrientations["LEFT"] = "left";
52
- DoorOrientations["RIGHT"] = "right";
53
- })(DoorOrientations = exports.DoorOrientations || (exports.DoorOrientations = {}));
54
- var DoorOpeningDirections;
55
- (function (DoorOpeningDirections) {
56
- DoorOpeningDirections["INSIDE"] = "inside";
57
- DoorOpeningDirections["OUTSIDE"] = "outside";
58
- })(DoorOpeningDirections = exports.DoorOpeningDirections || (exports.DoorOpeningDirections = {}));
59
- exports.ATTRIBUTE_NAME_DEFAULTS = (_a = {},
60
- _a[types_1.IElements.WALL] = SpacesAttributes.WALLS,
61
- _a[types_1.IElements.WINDOW] = SpacesAttributes.WINDOWS,
62
- _a[types_1.IElements.OPENING] = SpacesAttributes.OPENINGS,
63
- _a[types_1.IElements.DOOR] = SpacesAttributes.DOORS,
64
- _a.featurePositionX = FeatureAttributes.POSITION_X,
65
- _a.featurePositionY = FeatureAttributes.POSITION_Y,
66
- _a.featureConnectedTo = FeatureAttributes.CONNECTED_TO,
67
- _a.featureHeight = FeatureAttributes.FEATURE_HEIGHT,
68
- _a.featureLength = FeatureAttributes.FEATURE_LENGTH,
69
- _a.wallStartX = WallAttributes.START_X,
70
- _a.wallStartY = WallAttributes.START_Y,
71
- _a.wallStartZ = WallAttributes.START_Z,
72
- _a.wallEndX = WallAttributes.END_X,
73
- _a.wallEndY = WallAttributes.END_Y,
74
- _a.wallEndZ = WallAttributes.END_Z,
75
- _a.wallConnections = WallAttributes.CONNECTIONS,
76
- _a);
77
- exports.SCALE = 0.02;
78
- exports.SNAP_PROXIMITY = 16;
79
- exports.ZOOM_MAX = 100;
80
- exports.ZOOM_MIN = 20;
81
- exports.ZOOM_DEFAULT = 40;
82
- exports.ZOOM_SENSITIVITY = 0.8;
83
- exports.TRANSLATE_MAX = [-400, -400];
84
- exports.TRANSLATE_MIN = [400, 400];
85
- exports.TRANSLATE_DEFAULT = [-200, -200];
86
- exports.UNIT_LABELS = (_b = {},
87
- _b[types_1.IUnits.FEET] = 'ft',
88
- _b[types_1.IUnits.METER] = 'm',
89
- _b[types_1.IUnits.INCH] = 'in',
90
- _b[types_1.IUnits.CM] = 'cm',
91
- _b);
92
- exports.UNIT_FACTORS = (_c = {},
93
- _c[types_1.IUnits.CM] = 100,
94
- _c[types_1.IUnits.METER] = 1,
95
- _c[types_1.IUnits.FEET] = 3.28084,
96
- _c[types_1.IUnits.INCH] = 39.37,
97
- _c);
98
- exports.FEATURE_LABELS = (_d = {},
99
- _d[types_1.IElements.WINDOW] = 'Window',
100
- _d[types_1.IElements.DOOR] = 'Door',
101
- _d[types_1.IElements.OPENING] = 'Opening',
102
- _d);
103
- exports.VALIDATION_CONFIG_DEFAULT = {
104
- padding: 0.2,
105
- minLength: 0.5,
106
- };
107
- exports.FEATURE_LENGTH = 120;
108
- exports.UI_ANCHOR_DISTANCE = -60;
109
- exports.WALL_SNAP_DISTANCE = 12;
@@ -1,20 +0,0 @@
1
- import type { IWalls, ISpacesStateProps, IVerticesState, IFeatures, IWallsValidationConfig, IAttributeDefaults } from './types';
2
- import { IUnits } from './types';
3
- import type { IConfiguration, IHydratedAttribute } from '../../types';
4
- export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps): {
5
- validationConfig: IWallsValidationConfig;
6
- features: {};
7
- walls: IWalls;
8
- vertex: IVerticesState;
9
- };
10
- export declare function getAttributeDefaults(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps): IAttributeDefaults;
11
- export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: ISpacesStateProps): {
12
- [x: string]: import("../../types").IConfigurationAttribute | {
13
- assetId: string;
14
- configuration: IConfiguration;
15
- }[];
16
- };
17
- export declare function convertLengthUnit(value: number, from: IUnits, to: IUnits): number;
18
- export declare function convertAreaUnit(value: number, from: IUnits, to: IUnits): number;
19
- export declare function prepLengthForUser(value: number, unit: IUnits): string;
20
- export declare function prepAreaForUser(value: number, unit: IUnits): string;
@@ -1,254 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.prepAreaForUser = exports.prepLengthForUser = exports.convertAreaUnit = exports.convertLengthUnit = exports.prepAttributesOutgoing = exports.getAttributeDefaults = exports.prepAttributesIncoming = void 0;
15
- var types_1 = require("./types");
16
- var constants_1 = require("./constants");
17
- var geometry_1 = require("./geometry");
18
- function filterRestConfiguration(configuration, attributeNames) {
19
- var keysToFilter = new Set(Object.values(attributeNames));
20
- var filteredConfiguration = Object.entries(configuration).reduce(function (output, _a) {
21
- var _b;
22
- var key = _a[0], value = _a[1];
23
- if (keysToFilter.has(key))
24
- return output;
25
- return Object.assign(output, (_b = {}, _b[key] = value, _b));
26
- }, {});
27
- return filteredConfiguration;
28
- }
29
- function prepConnectionOutgoing(connection) {
30
- return "".concat(connection[0], ".").concat(connection[1]);
31
- }
32
- function prepConnectionIncoming(connection) {
33
- var _a = connection.split('.'), attributeName = _a[0], indexStr = _a[1];
34
- return [attributeName, parseInt(indexStr)];
35
- }
36
- function prepWallsAndVerticesIncoming(wallsAttribute, config) {
37
- var _a;
38
- var walls = [];
39
- var vertices = {};
40
- var attributeName = config.attributes;
41
- ((wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.value) || []).forEach(function (_a, i) {
42
- var _b, _c, _d;
43
- var assetId = _a.assetId, configuration = _a.configuration;
44
- var point1 = [
45
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallStartX]) / config.config.scale,
46
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallStartZ]) / config.config.scale,
47
- ];
48
- var point2 = [
49
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallEndX]) / config.config.scale,
50
- (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.wallEndZ]) / config.config.scale,
51
- ];
52
- var point1Str = JSON.stringify(point1);
53
- var point2Str = JSON.stringify(point2);
54
- if (vertices[point1Str])
55
- vertices[point1Str].push([i, 0]);
56
- else
57
- vertices[point1Str] = [[i, 0]];
58
- if (vertices[point2Str])
59
- vertices[point2Str].push([i, 1]);
60
- else
61
- vertices[point2Str] = [[i, 1]];
62
- var connections = [];
63
- var visible = ((_d = (_c = (_b = configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.WallAttributes.VISIBILITY]) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c[constants_1.SpacesMetadata.VALUE]) !== null && _d !== void 0 ? _d : 'true') === 'true';
64
- walls.push({
65
- assetId: assetId,
66
- visible: visible,
67
- line: [point1, point2],
68
- path: (0, geometry_1.addThicknessToLine)([point1, point2], config.config.styles.wall.thickness),
69
- connections: connections,
70
- restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
71
- });
72
- });
73
- return _a = {}, _a[types_1.IElements.WALL] = walls, _a[types_1.IElements.VERTEX] = vertices, _a;
74
- }
75
- function getWallsVaidationConfig(wallsAttribute, config) {
76
- var _a, _b;
77
- var metadata = (wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.values[0].metadata) || {};
78
- var validation = {
79
- minLength: ((_a = metadata[constants_1.WallMetadata.MIN_LENGTH]) !== null && _a !== void 0 ? _a : constants_1.VALIDATION_CONFIG_DEFAULT.minLength) / config.config.scale,
80
- padding: ((_b = metadata[constants_1.WallMetadata.PADDING]) !== null && _b !== void 0 ? _b : constants_1.VALIDATION_CONFIG_DEFAULT.padding) / config.config.scale,
81
- };
82
- return validation;
83
- }
84
- function prepFeatureIncoming(type, walls, featureAttribute, config) {
85
- var _a;
86
- var attributeName = config.attributes;
87
- var feature = [];
88
- (_a = featureAttribute === null || featureAttribute === void 0 ? void 0 : featureAttribute.value) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
89
- var _b, _c, _d, _e, _f, _g;
90
- var assetId = _a.assetId, configuration = _a.configuration;
91
- var offset = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionX]) / config.config.scale;
92
- var length = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureLength]) / config.config.scale;
93
- var height = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureHeight]) / config.config.scale;
94
- var altitude = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionY]) / config.config.scale;
95
- var connectedTo = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureConnectedTo]) || '';
96
- var wallIndex = prepConnectionIncoming(connectedTo)[1];
97
- var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(walls[wallIndex].line, offset, length);
98
- var element = {
99
- assetId: assetId,
100
- offset: offset,
101
- length: length,
102
- height: height,
103
- altitude: altitude,
104
- connectedTo: [types_1.IElements.WALL, wallIndex],
105
- path: (0, geometry_1.addThicknessToLine)(featureLine, config.config.styles.feature.thickness),
106
- restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
107
- };
108
- if (type === types_1.IElements.DOOR) {
109
- element.showSwing =
110
- (((_c = (_b = configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.DoorAttributes.SHOW_SWING]) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c[constants_1.SpacesMetadata.VALUE]) || 'true') === 'true';
111
- element.orientation =
112
- ((_e = (_d = configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.DoorAttributes.ORIENTATION]) === null || _d === void 0 ? void 0 : _d.metadata) === null || _e === void 0 ? void 0 : _e[constants_1.SpacesMetadata.VALUE]) === constants_1.DoorOrientations.LEFT
113
- ? constants_1.DoorOrientations.LEFT
114
- : constants_1.DoorOrientations.RIGHT;
115
- element.openingDirection =
116
- ((_g = (_f = configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.DoorAttributes.OPENING_DIRECTION]) === null || _f === void 0 ? void 0 : _f.metadata) === null || _g === void 0 ? void 0 : _g[constants_1.SpacesMetadata.VALUE]) === constants_1.DoorOpeningDirections.INSIDE
117
- ? constants_1.DoorOpeningDirections.INSIDE
118
- : constants_1.DoorOpeningDirections.OUTSIDE;
119
- }
120
- feature.push(element);
121
- });
122
- return feature;
123
- }
124
- function prepAttributesIncoming(attributes, config) {
125
- var _a;
126
- var wallsAttribute = attributes[config.attributes[types_1.IElements.WALL]];
127
- var wallsAndVertices = prepWallsAndVerticesIncoming(wallsAttribute, config);
128
- var wallsValidation = getWallsVaidationConfig(wallsAttribute, config);
129
- var featuresList = [
130
- types_1.IElements.WINDOW,
131
- types_1.IElements.DOOR,
132
- types_1.IElements.OPENING,
133
- ];
134
- var featuresData = featuresList.reduce(function (output, type) {
135
- output[type] = prepFeatureIncoming(type, wallsAndVertices[types_1.IElements.WALL], attributes[config.attributes[type]], config);
136
- return output;
137
- }, {});
138
- return __assign(__assign({}, wallsAndVertices), (_a = { validationConfig: wallsValidation }, _a[types_1.IElements.FEATURE] = featuresData, _a));
139
- }
140
- exports.prepAttributesIncoming = prepAttributesIncoming;
141
- function getAttributeDefaults(attributes, config) {
142
- return [
143
- types_1.IElements.WALL,
144
- types_1.IElements.WINDOW,
145
- types_1.IElements.DOOR,
146
- types_1.IElements.OPENING,
147
- ].reduce(function (output, elementName) {
148
- var _a;
149
- if (!config.attributes[elementName])
150
- return output;
151
- var attribute = attributes[config.attributes[elementName]];
152
- if (!attribute)
153
- return output;
154
- return Object.assign(output, (_a = {},
155
- _a[elementName] = attribute.values[0].assetId,
156
- _a));
157
- }, {});
158
- }
159
- exports.getAttributeDefaults = getAttributeDefaults;
160
- function prepFeaturesOutgoing(features, config) {
161
- var attributeName = config.attributes;
162
- return features.map(function (feature) {
163
- var _a, _b;
164
- var assetId = feature.assetId, offset = feature.offset, length = feature.length, height = feature.height, altitude = feature.altitude, restConfiguration = feature.restConfiguration;
165
- var connectedTo = prepConnectionOutgoing([
166
- config.attributes[feature.connectedTo[0]],
167
- feature.connectedTo[1],
168
- ]);
169
- var configurationToScale = (_a = {},
170
- _a[attributeName.featureLength] = length,
171
- _a[attributeName.featurePositionX] = offset,
172
- _a);
173
- if (altitude)
174
- configurationToScale[attributeName.featurePositionY] = altitude;
175
- if (height)
176
- configurationToScale[attributeName.featureHeight] = height;
177
- var configuration = Object.entries(configurationToScale).reduce(function (output, _a) {
178
- var _b;
179
- var key = _a[0], value = _a[1];
180
- return Object.assign(output, (_b = {},
181
- _b[key] = value ? value * config.config.scale : value,
182
- _b));
183
- }, __assign((_b = {}, _b[attributeName.featureConnectedTo] = connectedTo, _b), JSON.parse(restConfiguration)));
184
- return {
185
- assetId: assetId,
186
- configuration: configuration,
187
- };
188
- });
189
- }
190
- function prepWallsOutgoing(walls, config) {
191
- var attributeName = config.attributes;
192
- return walls.map(function (wall) {
193
- var _a, _b;
194
- var line = wall.line, restConfiguration = wall.restConfiguration;
195
- var connections = wall.connections.map(function (connection) {
196
- var attributeName = config.attributes[connection[0]];
197
- if (!attributeName)
198
- return;
199
- return prepConnectionOutgoing([attributeName, connection[1]]);
200
- });
201
- var _c = line.flat(), x1 = _c[0], y1 = _c[1], x2 = _c[2], y2 = _c[3];
202
- var configuration = Object.entries((_a = {},
203
- _a[attributeName.wallStartX] = x1,
204
- _a[attributeName.wallStartZ] = y1,
205
- _a[attributeName.wallEndX] = x2,
206
- _a[attributeName.wallEndZ] = y2,
207
- _a)).reduce(function (output, _a) {
208
- var _b;
209
- var key = _a[0], value = _a[1];
210
- return Object.assign(output, (_b = {},
211
- _b[key] = value ? value * config.config.scale : value,
212
- _b));
213
- }, __assign((_b = {}, _b[attributeName.wallConnections] = JSON.stringify(connections), _b), JSON.parse(restConfiguration)));
214
- return {
215
- assetId: wall.assetId,
216
- configuration: configuration,
217
- };
218
- });
219
- }
220
- function prepAttributesOutgoing(walls, features, config) {
221
- var _a;
222
- var wallsAttribute = prepWallsOutgoing(walls, config);
223
- var featuresAttributes = Object.entries(features).reduce(function (output, _a) {
224
- var type = _a[0], features = _a[1];
225
- var attributeName = config.attributes[type];
226
- if (!attributeName)
227
- return output;
228
- output[attributeName] = prepFeaturesOutgoing(features, config);
229
- return output;
230
- }, {});
231
- return __assign(__assign({}, featuresAttributes), (_a = {}, _a[config.attributes[types_1.IElements.WALL]] = wallsAttribute, _a));
232
- }
233
- exports.prepAttributesOutgoing = prepAttributesOutgoing;
234
- function convertLengthUnit(value, from, to) {
235
- return (value / constants_1.UNIT_FACTORS[from]) * constants_1.UNIT_FACTORS[to];
236
- }
237
- exports.convertLengthUnit = convertLengthUnit;
238
- function convertAreaUnit(value, from, to) {
239
- return (value / constants_1.UNIT_FACTORS[from]) * Math.pow(constants_1.UNIT_FACTORS[to], 2);
240
- }
241
- exports.convertAreaUnit = convertAreaUnit;
242
- function prepLengthForUser(value, unit) {
243
- if (unit === types_1.IUnits.FEET) {
244
- var feet = Math.floor(value);
245
- var inches = 12 * (value % 1);
246
- return "".concat(feet).concat(constants_1.UNIT_LABELS[types_1.IUnits.FEET], " ").concat(inches.toFixed(1)).concat(constants_1.UNIT_LABELS[types_1.IUnits.INCH]);
247
- }
248
- return "".concat(value.toFixed(2), " ").concat(constants_1.UNIT_LABELS[unit]);
249
- }
250
- exports.prepLengthForUser = prepLengthForUser;
251
- function prepAreaForUser(value, unit) {
252
- return "".concat(value.toFixed(2), " sq-").concat(constants_1.UNIT_LABELS[unit]);
253
- }
254
- exports.prepAreaForUser = prepAreaForUser;
@@ -1,2 +0,0 @@
1
- declare function clearCanvas(canvas: HTMLCanvasElement): void;
2
- export default clearCanvas;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function clearCanvas(canvas) {
4
- var ctx = canvas.getContext('2d');
5
- if (!ctx)
6
- return;
7
- ctx.clearRect(0, 0, canvas.width, canvas.height);
8
- }
9
- exports.default = clearCanvas;
@@ -1,2 +0,0 @@
1
- declare function drawBackground(canvas: HTMLCanvasElement, color?: string): void;
2
- export default drawBackground;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function drawBackground(canvas, color) {
4
- if (!color)
5
- return;
6
- var ctx = canvas.getContext('2d');
7
- if (!ctx)
8
- return;
9
- ctx.fillStyle = color;
10
- ctx.fillRect(0, 0, canvas.width, canvas.height);
11
- }
12
- exports.default = drawBackground;
@@ -1,3 +0,0 @@
1
- import { ICoordinatesLine, ILineDimensions, ISpacesConfigInternal, IStylesDimension } from '../types';
2
- export declare function drawDimension(canvas: HTMLCanvasElement, line: ICoordinatesLine, styles: IStylesDimension, message: string): void;
3
- export declare function drawDimensions(canvas: HTMLCanvasElement, dimensions: Array<ILineDimensions>, config: ISpacesConfigInternal): void;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawDimensions = exports.drawDimension = void 0;
4
- var geometry_1 = require("../geometry");
5
- function drawDimension(canvas, line, styles, message) {
6
- var ctx = canvas.getContext('2d');
7
- if (!ctx)
8
- return;
9
- var dimensionsBoxHeight = styles.fontSize + 6;
10
- var dimensionsHeight = dimensionsBoxHeight + 6;
11
- var line1 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding);
12
- var line2 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight / 2);
13
- var line3 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight);
14
- var textLine = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight / 3);
15
- var textCoordinates = (0, geometry_1.getMidpointOfLineSegment)(textLine);
16
- var textAngle = (0, geometry_1.getAngleOfLineSegment)(textLine);
17
- if (2 < textAngle || textAngle < -2)
18
- textAngle += Math.PI;
19
- ctx.strokeStyle = styles.lineColor;
20
- ctx.lineWidth = 1;
21
- ctx.beginPath();
22
- ctx.moveTo.apply(ctx, line2[0]);
23
- ctx.lineTo.apply(ctx, line2[1]);
24
- ctx.stroke();
25
- ctx.beginPath();
26
- ctx.moveTo.apply(ctx, line1[0]);
27
- ctx.lineTo.apply(ctx, line3[0]);
28
- ctx.stroke();
29
- ctx.beginPath();
30
- ctx.moveTo.apply(ctx, line1[1]);
31
- ctx.lineTo.apply(ctx, line3[1]);
32
- ctx.stroke();
33
- ctx.beginPath();
34
- ctx.font = "".concat(styles.fontSize, "px ").concat(styles.font);
35
- ctx.font = "".concat(styles.fontSize, "px ").concat(styles.font);
36
- ctx.translate.apply(ctx, textCoordinates);
37
- ctx.rotate(textAngle);
38
- ctx.fillStyle = styles.textBackgroundColor;
39
- var textWidth = ctx.measureText(message).width + 12;
40
- ctx.fillRect(-(textWidth / 2), -((dimensionsBoxHeight * 3) / 4), textWidth, dimensionsBoxHeight);
41
- ctx.fillStyle = styles.textColor;
42
- ctx.textAlign = 'center';
43
- ctx.fillText(message, 0, 0);
44
- ctx.resetTransform();
45
- }
46
- exports.drawDimension = drawDimension;
47
- function drawDimensions(canvas, dimensions, config) {
48
- dimensions.forEach(function (_a) {
49
- var line = _a.line, label = _a.label;
50
- drawDimension(canvas, line, config.styles.dimensions, label);
51
- });
52
- }
53
- exports.drawDimensions = drawDimensions;
@@ -1,9 +0,0 @@
1
- import { IFeatureDoor, ISpacesStyles } from '../types';
2
- import { IWallToDraw } from './drawWalls';
3
- declare function drawDoors(canvas: HTMLCanvasElement, walls: Array<IWallToDraw>, doors: Array<IFeatureDoor>, selections: {
4
- active: Array<number>;
5
- highlighted: Array<number>;
6
- error: Array<number>;
7
- hidden: Array<number>;
8
- }, styles: ISpacesStyles): void;
9
- export default drawDoors;
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- var constants_1 = require("../constants");
13
- var geometry_1 = require("../geometry");
14
- var types_1 = require("../types");
15
- function drawDoor(canvas, wall, offset, length, showSwing, openingDirection, orientation, style, mode) {
16
- var ctx = canvas.getContext('2d');
17
- if (!ctx)
18
- return;
19
- var doorLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
20
- var points = (0, geometry_1.addThicknessToLine)(doorLine, style.thickness);
21
- var angle = (0, geometry_1.getAngleOfLineSegment)(doorLine);
22
- var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
23
- if (mode) {
24
- stroke = style[mode].stroke;
25
- fill = style[mode].fill;
26
- }
27
- ctx.beginPath();
28
- ctx.strokeStyle = stroke || fill;
29
- ctx.lineWidth = 2;
30
- var swingRatio = showSwing ? 2 : 48;
31
- if (openingDirection === constants_1.DoorOpeningDirections.INSIDE) {
32
- if (orientation === constants_1.DoorOrientations.LEFT) {
33
- ctx.moveTo.apply(ctx, points[0]);
34
- ctx.arc.apply(ctx, __spreadArray(__spreadArray([], points[0], false), [length, angle - Math.PI / swingRatio, angle], false));
35
- }
36
- else {
37
- ctx.moveTo.apply(ctx, points[1]);
38
- ctx.arc.apply(ctx, __spreadArray(__spreadArray([], points[1], false), [length,
39
- angle - (Math.PI * (swingRatio - 1)) / swingRatio,
40
- angle - Math.PI,
41
- true], false));
42
- }
43
- }
44
- else {
45
- if (orientation === constants_1.DoorOrientations.LEFT) {
46
- ctx.moveTo.apply(ctx, points[2]);
47
- ctx.arc.apply(ctx, __spreadArray(__spreadArray([], points[2], false), [length,
48
- angle + (Math.PI * (swingRatio - 1)) / swingRatio,
49
- angle + Math.PI], false));
50
- }
51
- else {
52
- ctx.moveTo.apply(ctx, points[3]);
53
- ctx.arc.apply(ctx, __spreadArray(__spreadArray([], points[3], false), [length, angle + Math.PI / swingRatio, angle, true], false));
54
- }
55
- }
56
- ctx.stroke();
57
- ctx.strokeStyle = stroke || fill;
58
- ctx.fillStyle = fill;
59
- ctx.lineWidth = strokeWidth || 1;
60
- ctx.beginPath();
61
- ctx.moveTo.apply(ctx, points[0]);
62
- for (var i = 1; i < points.length; i++) {
63
- ctx.lineTo.apply(ctx, points[i]);
64
- }
65
- ctx.lineTo.apply(ctx, points[0]);
66
- ctx.fill();
67
- if (style.stroke)
68
- ctx.stroke();
69
- }
70
- function drawDoors(canvas, walls, doors, selections, styles) {
71
- var styled = [
72
- selections.active,
73
- selections.highlighted,
74
- selections.error,
75
- selections.hidden,
76
- ];
77
- var defaultOpenings = doors.reduce(function (output, _, i) {
78
- if (!styled.flat().includes(i))
79
- output.push(i);
80
- return output;
81
- }, []);
82
- var doorsMap = [
83
- [types_1.IElementStyleModes.ACTIVE, selections.active],
84
- [types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
85
- [types_1.IElementStyleModes.ERROR, selections.error],
86
- [undefined, defaultOpenings],
87
- ];
88
- doorsMap.forEach(function (_a) {
89
- var mode = _a[0], doorsIndexes = _a[1];
90
- return doorsIndexes.forEach(function (index) {
91
- var door = doors[index];
92
- if (!(door === null || door === void 0 ? void 0 : door.connectedTo.length))
93
- return;
94
- var wallIndex = door.connectedTo[1];
95
- drawDoor(canvas, walls[wallIndex], door.offset, door.length, door.showSwing, door.openingDirection, door.orientation, styles.feature, mode);
96
- });
97
- });
98
- }
99
- exports.default = drawDoors;
@@ -1,3 +0,0 @@
1
- import { IEnclosedSpace, IStylesFloor } from '../types';
2
- export declare function drawFloor(canvas: HTMLCanvasElement, enclosedSpaces: Array<IEnclosedSpace>, styles: IStylesFloor): void;
3
- export declare function drawFloorArea(canvas: HTMLCanvasElement, enclosedSpaces: Array<IEnclosedSpace>, styles: IStylesFloor): void;