@threekit-tools/treble 0.0.90 → 0.0.91-next-02

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 (247) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +3 -3
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +1 -1
  6. package/dist/Treble/{snapshots.js → snapshot.js} +1 -1
  7. package/dist/Treble/wishlist.d.ts +1 -1
  8. package/dist/Treble/wishlist.js +1 -1
  9. package/dist/api/catalog.js +1 -1
  10. package/dist/api/configurations.js +1 -1
  11. package/dist/api/datatables.js +1 -1
  12. package/dist/api/orders.js +1 -1
  13. package/dist/api/price.js +1 -1
  14. package/dist/api/products.d.ts +2 -2
  15. package/dist/api/products.js +1 -1
  16. package/dist/components/BreatheAnimation/index.js +3 -3
  17. package/dist/components/Button/index.d.ts +2 -2
  18. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  19. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  20. package/dist/components/Share/index.js +1 -1
  21. package/dist/components/Share/share.styles.d.ts +1 -1
  22. package/dist/components/TurntableAnimation/index.js +3 -3
  23. package/dist/components/Upload/index.js +1 -1
  24. package/dist/components/UploadArea/index.js +1 -1
  25. package/dist/components/Wishlist/index.js +1 -1
  26. package/dist/components/containers/formInputContainer.js +3 -3
  27. package/dist/connection.js +1 -1
  28. package/dist/hooks/useAttribute/index.d.ts +4 -4
  29. package/dist/hooks/useAttribute/index.js +1 -1
  30. package/dist/hooks/useConfigurationChangeStatus/index.d.ts +2 -0
  31. package/dist/hooks/{usePlayerLoadingStatus → useConfigurationChangeStatus}/index.js +2 -2
  32. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  33. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  34. package/dist/hooks/useDevTools/index.d.ts +1 -1
  35. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  36. package/dist/hooks/useNestedConfigurator/index.js +2 -3
  37. package/dist/hooks/usePlayer/index.d.ts +1 -1
  38. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  39. package/dist/hooks/usePlayerReady/index.d.ts +2 -0
  40. package/dist/hooks/{useAnimationStart → usePlayerReady}/index.js +2 -2
  41. package/dist/hooks/useProductCache/index.js +1 -1
  42. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  43. package/dist/hooks/useResetProduct/index.js +1 -1
  44. package/dist/hooks/useShare/index.d.ts +1 -1
  45. package/dist/hooks/useShare/index.js +1 -1
  46. package/dist/hooks/useSingleAnimation/index.js +1 -1
  47. package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
  48. package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
  49. package/dist/hooks/useSpaces/SpacesState.d.ts +164 -0
  50. package/dist/hooks/useSpaces/SpacesState.js +1751 -0
  51. package/dist/hooks/useSpaces/constants.d.ts +64 -0
  52. package/dist/hooks/useSpaces/constants.js +109 -0
  53. package/dist/hooks/{useRoomBuilder → useSpaces}/dataHandlers.d.ts +6 -4
  54. package/dist/hooks/useSpaces/dataHandlers.js +254 -0
  55. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
  56. package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
  57. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
  58. package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
  59. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
  60. package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
  61. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
  62. package/dist/hooks/useSpaces/draw/drawDoors.js +99 -0
  63. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
  64. package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
  65. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
  66. package/dist/hooks/useSpaces/draw/drawGrid.js +33 -0
  67. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
  68. package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
  69. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
  70. package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
  71. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
  72. package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
  73. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +10 -0
  74. package/dist/hooks/useSpaces/draw/drawWalls.js +88 -0
  75. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
  76. package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
  77. package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
  78. package/dist/hooks/useSpaces/draw/index.js +129 -0
  79. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
  80. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
  81. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
  82. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
  83. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
  84. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
  85. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
  86. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
  87. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
  88. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
  89. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
  90. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
  91. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
  92. package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
  93. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
  94. package/dist/hooks/{useRoomBuilder → useSpaces/geometry}/findLoops.js +31 -13
  95. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
  96. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
  97. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
  98. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
  99. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
  100. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
  101. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
  102. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
  103. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
  104. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
  105. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
  106. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
  107. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
  108. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
  109. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
  110. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
  111. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
  112. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
  113. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
  114. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
  115. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
  116. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
  117. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
  118. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
  119. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
  120. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
  121. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
  122. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
  123. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
  124. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
  125. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
  126. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
  127. package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
  128. package/dist/hooks/useSpaces/geometry/index.js +64 -0
  129. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
  130. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
  131. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
  132. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
  133. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
  134. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
  135. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
  136. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
  137. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
  138. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
  139. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
  140. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
  141. package/dist/hooks/useSpaces/index.d.ts +76 -0
  142. package/dist/hooks/useSpaces/index.js +475 -0
  143. package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
  144. package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
  145. package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
  146. package/dist/hooks/useSpaces/themes/default.js +96 -0
  147. package/dist/hooks/{useRoomBuilder/themes.d.ts → useSpaces/themes/index.d.ts} +3 -4
  148. package/dist/hooks/useSpaces/themes/index.js +21 -0
  149. package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
  150. package/dist/hooks/useSpaces/themes/light.js +96 -0
  151. package/dist/hooks/useSpaces/types.d.ts +334 -0
  152. package/dist/hooks/{useRoomBuilder → useSpaces}/types.js +13 -1
  153. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
  154. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
  155. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
  156. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
  157. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
  158. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
  159. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
  160. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
  161. package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
  162. package/dist/hooks/useSpaces/validators/index.js +40 -0
  163. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
  164. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
  165. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
  166. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
  167. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
  168. package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
  169. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
  170. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
  171. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
  172. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
  173. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
  174. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
  175. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
  176. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
  177. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
  178. package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
  179. package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.js +1 -1
  180. package/dist/hooks/useWishlist/index.d.ts +1 -1
  181. package/dist/hooks/useZoom/index.d.ts +1 -1
  182. package/dist/http/orders.d.ts +1 -1
  183. package/dist/icons/AngleSnapping.d.ts +3 -0
  184. package/dist/icons/AngleSnapping.js +28 -0
  185. package/dist/icons/Center.d.ts +3 -0
  186. package/dist/icons/Center.js +24 -0
  187. package/dist/icons/Draw.js +3 -3
  188. package/dist/icons/GridSnapping.d.ts +3 -0
  189. package/dist/icons/GridSnapping.js +28 -0
  190. package/dist/icons/LayoutAlt.d.ts +3 -0
  191. package/dist/icons/LayoutAlt.js +21 -0
  192. package/dist/icons/Magnet.d.ts +3 -0
  193. package/dist/icons/Magnet.js +27 -0
  194. package/dist/icons/Player3D.d.ts +3 -0
  195. package/dist/icons/Player3D.js +21 -0
  196. package/dist/icons/Save.d.ts +3 -0
  197. package/dist/icons/Save.js +21 -0
  198. package/dist/icons/UnitCm.d.ts +3 -0
  199. package/dist/icons/UnitCm.js +22 -0
  200. package/dist/icons/UnitFeet.d.ts +3 -0
  201. package/dist/icons/UnitFeet.js +22 -0
  202. package/dist/icons/UnitInch.d.ts +3 -0
  203. package/dist/icons/UnitInch.js +22 -0
  204. package/dist/icons/UnitMeter.d.ts +3 -0
  205. package/dist/icons/UnitMeter.js +21 -0
  206. package/dist/icons/Window.js +4 -4
  207. package/dist/icons/index.js +22 -0
  208. package/dist/icons/types.d.ts +1 -1
  209. package/dist/index.d.ts +17 -3
  210. package/dist/index.js +35 -7
  211. package/dist/store/attributes.d.ts +3 -2
  212. package/dist/store/attributes.js +1 -1
  213. package/dist/store/index.d.ts +15 -8
  214. package/dist/store/index.js +3 -1
  215. package/dist/store/price.js +1 -1
  216. package/dist/store/product.d.ts +1 -1
  217. package/dist/store/product.js +5 -8
  218. package/dist/store/spaces.d.ts +47 -0
  219. package/dist/store/spaces.js +197 -0
  220. package/dist/store/translations.js +1 -1
  221. package/dist/store/treble.d.ts +1 -1
  222. package/dist/store/treble.js +27 -27
  223. package/dist/store/wishlist.d.ts +21 -3
  224. package/dist/store/wishlist.js +1 -1
  225. package/dist/types.d.ts +25 -17
  226. package/dist/utils.d.ts +1 -1
  227. package/dist/utils.js +1 -1
  228. package/package.json +1 -1
  229. package/dist/hooks/useAnimationStart/index.d.ts +0 -2
  230. package/dist/hooks/usePlayerLoadingStatus/index.d.ts +0 -2
  231. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
  232. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
  233. package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
  234. package/dist/hooks/useRoomBuilder/constants.js +0 -48
  235. package/dist/hooks/useRoomBuilder/dataHandlers.js +0 -187
  236. package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
  237. package/dist/hooks/useRoomBuilder/draw.js +0 -573
  238. package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
  239. package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
  240. package/dist/hooks/useRoomBuilder/geometry.js +0 -325
  241. package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
  242. package/dist/hooks/useRoomBuilder/index.js +0 -303
  243. package/dist/hooks/useRoomBuilder/themes.js +0 -273
  244. package/dist/hooks/useRoomBuilder/types.d.ts +0 -238
  245. package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
  246. package/dist/hooks/useRoomBuilder/validators.js +0 -362
  247. /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.drawFloorArea = exports.drawFloor = void 0;
4
+ function drawFloor(canvas, enclosedSpaces, styles) {
5
+ var ctx = canvas.getContext('2d');
6
+ if (!ctx)
7
+ return;
8
+ if (!enclosedSpaces.length)
9
+ return;
10
+ for (var _i = 0, enclosedSpaces_1 = enclosedSpaces; _i < enclosedSpaces_1.length; _i++) {
11
+ var enclosedSpace = enclosedSpaces_1[_i];
12
+ var loop = enclosedSpace.loop;
13
+ ctx.fillStyle = styles.color;
14
+ ctx.beginPath();
15
+ ctx.moveTo.apply(ctx, loop[0]);
16
+ for (var i = 1; i < loop.length; i++)
17
+ ctx.lineTo.apply(ctx, loop[i]);
18
+ ctx.fill();
19
+ }
20
+ }
21
+ exports.drawFloor = drawFloor;
22
+ function drawFloorArea(canvas, enclosedSpaces, styles) {
23
+ var ctx = canvas.getContext('2d');
24
+ if (!ctx)
25
+ return;
26
+ if (!enclosedSpaces.length)
27
+ return;
28
+ for (var _i = 0, enclosedSpaces_2 = enclosedSpaces; _i < enclosedSpaces_2.length; _i++) {
29
+ var enclosedSpace = enclosedSpaces_2[_i];
30
+ var center = enclosedSpace.center, area = enclosedSpace.area;
31
+ ctx.font = '20px Arial';
32
+ ctx.fillStyle = styles.textColor;
33
+ ctx.fillText(area, center[0], center[1]);
34
+ }
35
+ }
36
+ exports.drawFloorArea = drawFloorArea;
@@ -0,0 +1,3 @@
1
+ import { IGridToDraw, IStylesGrid } from '../types';
2
+ declare function drawGrid(canvas: HTMLCanvasElement, grid: IGridToDraw, styles: IStylesGrid): void;
3
+ export default drawGrid;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function drawGrid(canvas, grid, styles) {
4
+ var ctx = canvas.getContext('2d');
5
+ if (!ctx)
6
+ return;
7
+ var unitLength = grid.unitLength, offset = grid.offset, subdivisions = grid.subdivisions;
8
+ var showSubdivisions = styles.showSubdivisions &&
9
+ unitLength / subdivisions > styles.subdivisionThreshold;
10
+ var length = showSubdivisions ? unitLength / subdivisions : unitLength;
11
+ ctx.strokeStyle = styles.lineColor;
12
+ var numHorizontalLines = Math.ceil(canvas.height / length) +
13
+ 1 * (showSubdivisions ? subdivisions : 1);
14
+ var numVerticalLines = Math.ceil(canvas.width / length) +
15
+ 1 * (showSubdivisions ? subdivisions : 1);
16
+ for (var i = 0; i < numHorizontalLines; i++) {
17
+ var y = i * length + offset[1];
18
+ ctx.lineWidth = showSubdivisions && i % subdivisions === 0 ? 2 : 1;
19
+ ctx.beginPath();
20
+ ctx.moveTo(0, y);
21
+ ctx.lineTo(canvas.width, y);
22
+ ctx.stroke();
23
+ }
24
+ for (var i = 0; i < numVerticalLines; i++) {
25
+ var x = i * length + offset[0];
26
+ ctx.lineWidth = showSubdivisions && i % subdivisions === 0 ? 2 : 1;
27
+ ctx.beginPath();
28
+ ctx.moveTo(x, 0);
29
+ ctx.lineTo(x, canvas.height);
30
+ ctx.stroke();
31
+ }
32
+ }
33
+ exports.default = drawGrid;
@@ -0,0 +1,3 @@
1
+ import { GUIDE_ORIENTATIONS, ICoordinate2D, IStylesGuides } from '../types';
2
+ declare function drawGuides(canvas: HTMLCanvasElement, point: ICoordinate2D, orientations: Array<GUIDE_ORIENTATIONS>, style: IStylesGuides): void;
3
+ export default drawGuides;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var types_1 = require("../types");
4
+ function drawGuides(canvas, point, orientations, style) {
5
+ var ctx = canvas.getContext('2d');
6
+ if (!ctx)
7
+ return;
8
+ ctx.strokeStyle = style.color;
9
+ ctx.lineWidth = style.thickness;
10
+ if (orientations.includes(types_1.GUIDE_ORIENTATIONS.VERTICAL)) {
11
+ ctx.beginPath();
12
+ ctx.moveTo(point[0], 0);
13
+ ctx.lineTo(point[0], canvas.height);
14
+ ctx.stroke();
15
+ }
16
+ if (orientations.includes(types_1.GUIDE_ORIENTATIONS.HORIZONTAL)) {
17
+ ctx.beginPath();
18
+ ctx.moveTo(0, point[1]);
19
+ ctx.lineTo(canvas.width, point[1]);
20
+ ctx.stroke();
21
+ }
22
+ }
23
+ exports.default = drawGuides;
@@ -0,0 +1,9 @@
1
+ import { IFeature, ISpacesStyles } from '../types';
2
+ import { IWallToDraw } from './drawWalls';
3
+ declare function drawOpenings(canvas: HTMLCanvasElement, walls: Array<IWallToDraw>, openings: Array<IFeature>, selections: {
4
+ active: Array<number>;
5
+ highlighted: Array<number>;
6
+ error: Array<number>;
7
+ hidden: Array<number>;
8
+ }, styles: ISpacesStyles): void;
9
+ export default drawOpenings;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var geometry_1 = require("../geometry");
4
+ var types_1 = require("../types");
5
+ function drawOpening(canvas, wall, offset, length, style, mode) {
6
+ var ctx = canvas.getContext('2d');
7
+ if (!ctx)
8
+ return;
9
+ var openingLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
10
+ var points = (0, geometry_1.addThicknessToLine)(openingLine, style.thickness);
11
+ var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
12
+ if (mode) {
13
+ stroke = style[mode].stroke;
14
+ fill = style[mode].fill;
15
+ }
16
+ ctx.fillStyle = 'white';
17
+ ctx.beginPath();
18
+ ctx.moveTo.apply(ctx, points[0]);
19
+ for (var i = 1; i < points.length; i++) {
20
+ ctx.lineTo.apply(ctx, points[i]);
21
+ }
22
+ ctx.lineTo.apply(ctx, points[0]);
23
+ ctx.fill();
24
+ ctx.beginPath();
25
+ ctx.strokeStyle = stroke || fill;
26
+ ctx.fillStyle = fill;
27
+ ctx.lineWidth = strokeWidth || 1;
28
+ ctx.setLineDash([10, 10]);
29
+ ctx.moveTo.apply(ctx, openingLine[0]);
30
+ ctx.lineTo.apply(ctx, openingLine[1]);
31
+ ctx.stroke();
32
+ ctx.closePath();
33
+ ctx.beginPath();
34
+ ctx.setLineDash([]);
35
+ var angle = (0, geometry_1.getAngleOfLineSegment)(openingLine);
36
+ ctx.arc(openingLine[0][0], openingLine[0][1], style.thickness / 2, angle - Math.PI / 2, angle + Math.PI / 2);
37
+ ctx.fill();
38
+ ctx.closePath();
39
+ ctx.beginPath();
40
+ ctx.arc(openingLine[1][0], openingLine[1][1], style.thickness / 2, angle + Math.PI / 2, angle - Math.PI / 2);
41
+ ctx.fill();
42
+ }
43
+ function drawOpenings(canvas, walls, openings, selections, styles) {
44
+ var styled = [
45
+ selections.active,
46
+ selections.highlighted,
47
+ selections.error,
48
+ selections.hidden,
49
+ ];
50
+ var defaultOpenings = openings.reduce(function (output, _, i) {
51
+ if (!styled.flat().includes(i))
52
+ output.push(i);
53
+ return output;
54
+ }, []);
55
+ var openingsMap = [
56
+ [types_1.IElementStyleModes.ACTIVE, selections.active],
57
+ [types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
58
+ [types_1.IElementStyleModes.ERROR, selections.error],
59
+ [undefined, defaultOpenings],
60
+ ];
61
+ openingsMap.forEach(function (_a) {
62
+ var mode = _a[0], openingsIndexes = _a[1];
63
+ return openingsIndexes.forEach(function (index) {
64
+ var opening = openings[index];
65
+ if (!(opening === null || opening === void 0 ? void 0 : opening.connectedTo.length))
66
+ return;
67
+ var wallIndex = opening.connectedTo[1];
68
+ drawOpening(canvas, walls[wallIndex], opening.offset, opening.length, styles.feature, mode);
69
+ });
70
+ });
71
+ }
72
+ exports.default = drawOpenings;
@@ -0,0 +1,8 @@
1
+ import { ICoordinate2D, IVertex, IElementStyleModes, IStylesVertex } from '../types';
2
+ export declare function drawVertex(canvas: HTMLCanvasElement, point: ICoordinate2D, style: IStylesVertex, mode?: IElementStyleModes): void;
3
+ export declare function drawVertices(canvas: HTMLCanvasElement, vertices: Array<IVertex>, selections: {
4
+ active: Array<number>;
5
+ highlighted: Array<number>;
6
+ error: Array<number>;
7
+ hidden: Array<number>;
8
+ }, styles: IStylesVertex): void;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.drawVertices = exports.drawVertex = void 0;
4
+ var types_1 = require("../types");
5
+ function drawVertex(canvas, point, style, mode) {
6
+ var ctx = canvas.getContext('2d');
7
+ if (!ctx)
8
+ return;
9
+ var stroke = style.stroke, innerFill = style.innerFill, outerFill = style.outerFill, strokeWidth = style.strokeWidth, outerRadius = style.outerRadius;
10
+ if (mode) {
11
+ stroke = style[mode].stroke;
12
+ innerFill = style[mode].innerFill;
13
+ outerFill = style[mode].outerFill;
14
+ }
15
+ ctx.lineWidth = strokeWidth || 1;
16
+ ctx.strokeStyle = stroke || innerFill;
17
+ ctx.fillStyle = outerFill;
18
+ if (outerRadius) {
19
+ ctx.beginPath();
20
+ ctx.arc(point[0], point[1], outerRadius, 0, 2 * Math.PI);
21
+ if (style.strokeWidth)
22
+ ctx.stroke();
23
+ ctx.fill();
24
+ }
25
+ ctx.lineWidth = strokeWidth || 1;
26
+ ctx.fillStyle = innerFill;
27
+ ctx.strokeStyle = stroke || innerFill;
28
+ ctx.beginPath();
29
+ ctx.arc(point[0], point[1], style.innerRadius, 0, 2 * Math.PI);
30
+ ctx.fill();
31
+ if (!outerRadius && strokeWidth)
32
+ ctx.stroke();
33
+ }
34
+ exports.drawVertex = drawVertex;
35
+ function drawVertices(canvas, vertices, selections, styles) {
36
+ var styled = [
37
+ selections.active,
38
+ selections.highlighted,
39
+ selections.error,
40
+ selections.hidden,
41
+ ];
42
+ var defaultOpenings = vertices.reduce(function (output, _, i) {
43
+ if (!styled.flat().includes(i))
44
+ output.push(i);
45
+ return output;
46
+ }, []);
47
+ var verticesMap = [
48
+ [types_1.IElementStyleModes.ACTIVE, selections.active],
49
+ [types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
50
+ [types_1.IElementStyleModes.ERROR, selections.error],
51
+ [undefined, defaultOpenings],
52
+ ];
53
+ verticesMap.forEach(function (_a) {
54
+ var mode = _a[0], vertexIndexes = _a[1];
55
+ return vertexIndexes.forEach(function (index) {
56
+ var point = vertices[index].point;
57
+ drawVertex(canvas, point, styles, mode);
58
+ });
59
+ });
60
+ }
61
+ exports.drawVertices = drawVertices;
@@ -0,0 +1,10 @@
1
+ import { IWall, ICoordinatesLine, ISpacesStyles, IStylesWall, IElementStyleModes } from '../types';
2
+ export interface IWallToDraw extends Pick<IWall, 'line' | 'path' | 'visible'> {
3
+ }
4
+ export declare function drawNewWall(canvas: HTMLCanvasElement, line: ICoordinatesLine, styles: ISpacesStyles, mode?: IElementStyleModes.ERROR): void;
5
+ export declare function drawWalls(canvas: HTMLCanvasElement, walls: Array<IWallToDraw>, selections: {
6
+ active: Array<number>;
7
+ highlighted: Array<number>;
8
+ error: Array<number>;
9
+ hidden: Array<number>;
10
+ }, styles: IStylesWall): void;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.drawWalls = exports.drawNewWall = void 0;
4
+ var types_1 = require("../types");
5
+ var geometry_1 = require("../geometry");
6
+ var drawVertices_1 = require("./drawVertices");
7
+ function drawInvisibleWall(canvas, wall, style, mode) {
8
+ var ctx = canvas.getContext('2d');
9
+ if (!ctx)
10
+ return;
11
+ var stroke = style.stroke, fill = style.fill;
12
+ if (mode) {
13
+ stroke = style[mode].stroke;
14
+ fill = style[mode].fill;
15
+ }
16
+ ctx.strokeStyle = stroke || fill;
17
+ ctx.fillStyle = fill;
18
+ ctx.lineWidth = style.thickness;
19
+ ctx.beginPath();
20
+ ctx.setLineDash([10, 10]);
21
+ ctx.moveTo.apply(ctx, wall.line[0]);
22
+ ctx.lineTo.apply(ctx, wall.line[1]);
23
+ ctx.stroke();
24
+ ctx.closePath();
25
+ ctx.beginPath();
26
+ ctx.setLineDash([]);
27
+ }
28
+ function drawWall(canvas, wall, style, mode) {
29
+ var _a;
30
+ var ctx = canvas.getContext('2d');
31
+ if (!ctx)
32
+ return;
33
+ var path = (_a = wall.path) !== null && _a !== void 0 ? _a : (0, geometry_1.addThicknessToLine)(wall.line, style.thickness);
34
+ var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
35
+ if (mode) {
36
+ stroke = style[mode].stroke;
37
+ fill = style[mode].fill;
38
+ }
39
+ ctx.strokeStyle = stroke || fill;
40
+ ctx.fillStyle = fill;
41
+ ctx.lineWidth = strokeWidth || 1;
42
+ ctx.beginPath();
43
+ ctx.moveTo.apply(ctx, path[0]);
44
+ for (var i = 1; i < path.length; i++) {
45
+ ctx.lineTo.apply(ctx, path[i]);
46
+ }
47
+ ctx.lineTo.apply(ctx, path[0]);
48
+ ctx.fill();
49
+ if (style.stroke && style.strokeWidth)
50
+ ctx.stroke();
51
+ }
52
+ function drawNewWall(canvas, line, styles, mode) {
53
+ drawWall(canvas, {
54
+ line: line,
55
+ path: (0, geometry_1.addThicknessToLine)(line, styles.wall.thickness),
56
+ }, styles.wall, mode !== null && mode !== void 0 ? mode : types_1.IElementStyleModes.ACTIVE);
57
+ line.forEach(function (point) {
58
+ return (0, drawVertices_1.drawVertex)(canvas, point, styles.vertex, mode !== null && mode !== void 0 ? mode : types_1.IElementStyleModes.HIGHLIGHT);
59
+ });
60
+ }
61
+ exports.drawNewWall = drawNewWall;
62
+ function drawWalls(canvas, walls, selections, styles) {
63
+ var styled = [
64
+ selections.active,
65
+ selections.highlighted,
66
+ selections.error,
67
+ selections.hidden,
68
+ ];
69
+ var defaultOpenings = walls.reduce(function (output, _, i) {
70
+ if (!styled.flat().includes(i))
71
+ output.push(i);
72
+ return output;
73
+ }, []);
74
+ var wallsMap = [
75
+ [types_1.IElementStyleModes.ACTIVE, selections.active],
76
+ [types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
77
+ [types_1.IElementStyleModes.ERROR, selections.error],
78
+ [undefined, defaultOpenings],
79
+ ];
80
+ wallsMap.forEach(function (_a) {
81
+ var mode = _a[0], wallIndexes = _a[1];
82
+ return wallIndexes.forEach(function (index) {
83
+ var draw = walls[index].visible ? drawWall : drawInvisibleWall;
84
+ draw(canvas, walls[index], styles, mode);
85
+ });
86
+ });
87
+ }
88
+ exports.drawWalls = drawWalls;
@@ -0,0 +1,9 @@
1
+ import { IFeature, ISpacesStyles } from '../types';
2
+ import { IWallToDraw } from './drawWalls';
3
+ declare function drawWindows(canvas: HTMLCanvasElement, walls: Array<IWallToDraw>, windows: Array<IFeature>, selections: {
4
+ active: Array<number>;
5
+ highlighted: Array<number>;
6
+ error: Array<number>;
7
+ hidden: Array<number>;
8
+ }, styles: ISpacesStyles): void;
9
+ export default drawWindows;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var geometry_1 = require("../geometry");
4
+ var types_1 = require("../types");
5
+ function drawWindow(canvas, wall, offset, length, style, mode) {
6
+ var ctx = canvas.getContext('2d');
7
+ if (!ctx)
8
+ return;
9
+ var windowLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
10
+ var windowRectangleLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset + style.thickness / 2, length - style.thickness);
11
+ var points = (0, geometry_1.addThicknessToLine)(windowLine, style.thickness);
12
+ var rectanglePoints = (0, geometry_1.addThicknessToLine)(windowRectangleLine, style.thickness);
13
+ var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
14
+ if (mode) {
15
+ stroke = style[mode].stroke;
16
+ fill = style[mode].fill;
17
+ }
18
+ ctx.fillStyle = 'white';
19
+ ctx.beginPath();
20
+ ctx.moveTo.apply(ctx, points[0]);
21
+ for (var i = 1; i < points.length; i++) {
22
+ ctx.lineTo.apply(ctx, points[i]);
23
+ }
24
+ ctx.lineTo.apply(ctx, points[0]);
25
+ ctx.fill();
26
+ ctx.closePath();
27
+ ctx.strokeStyle = stroke || fill;
28
+ ctx.fillStyle = fill;
29
+ ctx.lineWidth = strokeWidth || 1;
30
+ ctx.moveTo.apply(ctx, rectanglePoints[0]);
31
+ ctx.beginPath();
32
+ for (var i = 1; i < points.length; i++) {
33
+ ctx.lineTo.apply(ctx, rectanglePoints[i]);
34
+ }
35
+ ctx.lineTo.apply(ctx, rectanglePoints[0]);
36
+ ctx.fill();
37
+ ctx.closePath();
38
+ ctx.beginPath();
39
+ ctx.moveTo.apply(ctx, windowLine[0]);
40
+ ctx.lineTo.apply(ctx, windowLine[1]);
41
+ if (style.stroke)
42
+ ctx.stroke();
43
+ ctx.closePath();
44
+ var angle = (0, geometry_1.getAngleOfLineSegment)(windowLine);
45
+ ctx.beginPath();
46
+ ctx.arc(windowLine[0][0], windowLine[0][1], style.thickness / 2, angle - Math.PI / 2, angle + Math.PI / 2);
47
+ ctx.fill();
48
+ ctx.closePath();
49
+ ctx.beginPath();
50
+ ctx.arc(windowLine[1][0], windowLine[1][1], style.thickness / 2, angle + Math.PI / 2, angle - Math.PI / 2);
51
+ ctx.fill();
52
+ }
53
+ function drawWindows(canvas, walls, windows, selections, styles) {
54
+ var styled = [
55
+ selections.active,
56
+ selections.highlighted,
57
+ selections.error,
58
+ selections.hidden,
59
+ ];
60
+ var defaultOpenings = windows.reduce(function (output, _, i) {
61
+ if (!styled.flat().includes(i))
62
+ output.push(i);
63
+ return output;
64
+ }, []);
65
+ var windowsMap = [
66
+ [types_1.IElementStyleModes.ACTIVE, selections.active],
67
+ [types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
68
+ [types_1.IElementStyleModes.ERROR, selections.error],
69
+ [undefined, defaultOpenings],
70
+ ];
71
+ windowsMap.forEach(function (_a) {
72
+ var mode = _a[0], windowIndexes = _a[1];
73
+ return windowIndexes.forEach(function (index) {
74
+ var window = windows[index];
75
+ if (!(window === null || window === void 0 ? void 0 : window.connectedTo.length))
76
+ return;
77
+ var wallIndex = window.connectedTo[1];
78
+ drawWindow(canvas, walls[wallIndex], window.offset, window.length, styles.feature, mode);
79
+ });
80
+ });
81
+ }
82
+ exports.default = drawWindows;
@@ -0,0 +1,11 @@
1
+ import { IElementAddress, IEnclosedSpace, IFeatures, IGridToDraw, IGuides, ILineDimensions, ISpacesConfigInternal, IVertex } from '../types';
2
+ import { drawDimensions } from './drawDimensions';
3
+ import { drawVertex } from './drawVertices';
4
+ import { IWallToDraw, drawNewWall } from './drawWalls';
5
+ export { drawNewWall, drawVertex, drawDimensions };
6
+ export declare function drawSpaces(canvas: HTMLCanvasElement, grid: IGridToDraw, enclosedSpaces: Array<IEnclosedSpace>, walls: Array<IWallToDraw>, vertices: Array<IVertex>, features: IFeatures, dimensions: Array<ILineDimensions> | undefined, guides: null | IGuides, selections: {
7
+ active?: Array<IElementAddress> | IElementAddress;
8
+ highlighted?: Array<IElementAddress> | IElementAddress;
9
+ hidden?: Array<IElementAddress> | IElementAddress;
10
+ error?: Array<IElementAddress> | IElementAddress;
11
+ }, config: ISpacesConfigInternal): void;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.drawSpaces = exports.drawDimensions = exports.drawVertex = exports.drawNewWall = void 0;
7
+ var types_1 = require("../types");
8
+ var clearCanvas_1 = __importDefault(require("./clearCanvas"));
9
+ var drawBackground_1 = __importDefault(require("./drawBackground"));
10
+ var drawDimensions_1 = require("./drawDimensions");
11
+ Object.defineProperty(exports, "drawDimensions", { enumerable: true, get: function () { return drawDimensions_1.drawDimensions; } });
12
+ var drawDoors_1 = __importDefault(require("./drawDoors"));
13
+ var drawFloor_1 = require("./drawFloor");
14
+ var drawGrid_1 = __importDefault(require("./drawGrid"));
15
+ var drawGuides_1 = __importDefault(require("./drawGuides"));
16
+ var drawOpenings_1 = __importDefault(require("./drawOpenings"));
17
+ var drawVertices_1 = require("./drawVertices");
18
+ Object.defineProperty(exports, "drawVertex", { enumerable: true, get: function () { return drawVertices_1.drawVertex; } });
19
+ var drawWalls_1 = require("./drawWalls");
20
+ Object.defineProperty(exports, "drawNewWall", { enumerable: true, get: function () { return drawWalls_1.drawNewWall; } });
21
+ var drawWindows_1 = __importDefault(require("./drawWindows"));
22
+ function drawElements(canvas, walls, vertices, features, selections, styles) {
23
+ var wallSelections = {
24
+ active: [],
25
+ highlighted: [],
26
+ hidden: [],
27
+ error: [],
28
+ };
29
+ var verticesSelections = {
30
+ active: [],
31
+ highlighted: [],
32
+ hidden: [],
33
+ error: [],
34
+ };
35
+ var windowSelections = {
36
+ active: [],
37
+ highlighted: [],
38
+ hidden: [],
39
+ error: [],
40
+ };
41
+ var doorSelections = {
42
+ active: [],
43
+ highlighted: [],
44
+ hidden: [],
45
+ error: [],
46
+ };
47
+ var openingSelections = {
48
+ active: [],
49
+ highlighted: [],
50
+ hidden: [],
51
+ error: [],
52
+ };
53
+ selections.active.forEach(function (address) {
54
+ if (address.type === types_1.IElements.WALL)
55
+ wallSelections.active.push(address.index);
56
+ else if (address.type === types_1.IElements.VERTEX)
57
+ verticesSelections.active.push(address.index);
58
+ else if (address.type === types_1.IElements.WINDOW)
59
+ windowSelections.active.push(address.index);
60
+ else if (address.type === types_1.IElements.DOOR)
61
+ doorSelections.active.push(address.index);
62
+ else if (address.type === types_1.IElements.OPENING)
63
+ openingSelections.active.push(address.index);
64
+ });
65
+ selections.highlighted.forEach(function (address) {
66
+ if (address.type === types_1.IElements.WALL)
67
+ wallSelections.highlighted.push(address.index);
68
+ else if (address.type === types_1.IElements.VERTEX)
69
+ verticesSelections.highlighted.push(address.index);
70
+ else if (address.type === types_1.IElements.WINDOW)
71
+ windowSelections.highlighted.push(address.index);
72
+ else if (address.type === types_1.IElements.DOOR)
73
+ doorSelections.highlighted.push(address.index);
74
+ else if (address.type === types_1.IElements.OPENING)
75
+ openingSelections.highlighted.push(address.index);
76
+ });
77
+ selections.hidden.forEach(function (address) {
78
+ if (address.type === types_1.IElements.WALL)
79
+ wallSelections.hidden.push(address.index);
80
+ else if (address.type === types_1.IElements.VERTEX)
81
+ verticesSelections.hidden.push(address.index);
82
+ else if (address.type === types_1.IElements.WINDOW)
83
+ windowSelections.hidden.push(address.index);
84
+ else if (address.type === types_1.IElements.DOOR)
85
+ doorSelections.hidden.push(address.index);
86
+ else if (address.type === types_1.IElements.OPENING)
87
+ openingSelections.hidden.push(address.index);
88
+ });
89
+ selections.error.forEach(function (address) {
90
+ if (address.type === types_1.IElements.WALL)
91
+ wallSelections.error.push(address.index);
92
+ else if (address.type === types_1.IElements.VERTEX)
93
+ verticesSelections.error.push(address.index);
94
+ else if (address.type === types_1.IElements.WINDOW)
95
+ windowSelections.error.push(address.index);
96
+ else if (address.type === types_1.IElements.DOOR)
97
+ doorSelections.error.push(address.index);
98
+ else if (address.type === types_1.IElements.OPENING)
99
+ openingSelections.error.push(address.index);
100
+ });
101
+ (0, drawWalls_1.drawWalls)(canvas, walls, wallSelections, styles.wall);
102
+ (0, drawVertices_1.drawVertices)(canvas, vertices, verticesSelections, styles.vertex);
103
+ if (features[types_1.IElements.WINDOW])
104
+ (0, drawWindows_1.default)(canvas, walls, features[types_1.IElements.WINDOW] || [], windowSelections, styles);
105
+ if (features[types_1.IElements.DOOR])
106
+ (0, drawDoors_1.default)(canvas, walls, features[types_1.IElements.DOOR] || [], doorSelections, styles);
107
+ if (features[types_1.IElements.OPENING])
108
+ (0, drawOpenings_1.default)(canvas, walls, features[types_1.IElements.OPENING] || [], openingSelections, styles);
109
+ }
110
+ function drawSpaces(canvas, grid, enclosedSpaces, walls, vertices, features, dimensions, guides, selections, config) {
111
+ var preppedSelections = {
112
+ active: [(selections === null || selections === void 0 ? void 0 : selections.active) || []].flat(),
113
+ highlighted: [(selections === null || selections === void 0 ? void 0 : selections.highlighted) || []].flat(),
114
+ error: [(selections === null || selections === void 0 ? void 0 : selections.error) || []].flat(),
115
+ hidden: [(selections === null || selections === void 0 ? void 0 : selections.hidden) || []].flat(),
116
+ };
117
+ (0, clearCanvas_1.default)(canvas);
118
+ (0, drawBackground_1.default)(canvas, config.styles.grid.backgroundColor);
119
+ (0, drawGrid_1.default)(canvas, grid, config.styles.grid);
120
+ (0, drawFloor_1.drawFloor)(canvas, enclosedSpaces, config.styles.floor);
121
+ drawElements(canvas, walls, vertices, features, preppedSelections, config.styles);
122
+ if (dimensions) {
123
+ (0, drawDimensions_1.drawDimensions)(canvas, dimensions, config);
124
+ (0, drawFloor_1.drawFloorArea)(canvas, enclosedSpaces, config.styles.floor);
125
+ }
126
+ if (guides)
127
+ (0, drawGuides_1.default)(canvas, guides.point, guides.orientations, config.styles.guides);
128
+ }
129
+ exports.drawSpaces = drawSpaces;
@@ -0,0 +1,3 @@
1
+ import { ICoordinatesLine, ICoordinatesQuadrilateral } from '../types';
2
+ declare function addThicknessToLine(line: ICoordinatesLine, thickness: number): ICoordinatesQuadrilateral;
3
+ export default addThicknessToLine;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var getParallelLineSegmentAtDistance_1 = __importDefault(require("./getParallelLineSegmentAtDistance"));
7
+ function addThicknessToLine(line, thickness) {
8
+ var offset = thickness / 2;
9
+ var _a = (0, getParallelLineSegmentAtDistance_1.default)(line, offset), point1 = _a[0], point2 = _a[1];
10
+ var _b = (0, getParallelLineSegmentAtDistance_1.default)(line, -offset), point4 = _b[0], point3 = _b[1];
11
+ return [point1, point2, point3, point4];
12
+ }
13
+ exports.default = addThicknessToLine;
@@ -0,0 +1,3 @@
1
+ import { ICoordinatesLine } from '../types';
2
+ declare function areLinesEqual(line1: ICoordinatesLine, line2: ICoordinatesLine): boolean;
3
+ export default areLinesEqual;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var arePointsEqual_1 = __importDefault(require("./arePointsEqual"));
7
+ function areLinesEqual(line1, line2) {
8
+ if (!line1 || !line2)
9
+ return false;
10
+ if (((0, arePointsEqual_1.default)(line1[0], line2[0]) &&
11
+ (0, arePointsEqual_1.default)(line1[1], line2[1])) ||
12
+ ((0, arePointsEqual_1.default)(line1[0], line2[1]) && (0, arePointsEqual_1.default)(line1[1], line2[0]))) {
13
+ return true;
14
+ }
15
+ return false;
16
+ }
17
+ exports.default = areLinesEqual;
@@ -0,0 +1,3 @@
1
+ import { ICoordinate2D } from '../types';
2
+ declare function arePointsEqual(point1: ICoordinate2D, point2: ICoordinate2D): boolean;
3
+ export default arePointsEqual;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function arePointsEqual(point1, point2) {
4
+ if (!point1 || !point2)
5
+ return false;
6
+ return point1[0] === point2[0] && point1[1] === point2[1];
7
+ }
8
+ exports.default = arePointsEqual;
@@ -0,0 +1,3 @@
1
+ import { ICoordinate2D } from '../types';
2
+ declare function arePointsWithinProximity(point1: ICoordinate2D, point2: ICoordinate2D, proximity: number): boolean;
3
+ export default arePointsWithinProximity;