@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.
- package/dist/Treble/Treble.js +4 -3
- package/dist/Treble/snapshots.d.ts +2 -2
- package/dist/Treble/snapshots.js +1 -1
- package/dist/Treble/wishlist.d.ts +1 -1
- package/dist/Treble/wishlist.js +1 -1
- package/dist/api/assets.d.ts +1 -0
- package/dist/api/{products.js → assets.js} +12 -33
- package/dist/api/catalog.js +1 -1
- package/dist/api/configurations.d.ts +1 -0
- package/dist/api/configurations.js +10 -3
- package/dist/api/datatables.js +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +2 -2
- package/dist/api/orders.js +1 -1
- package/dist/api/price.js +1 -1
- package/dist/components/AttributeTitle/index.d.ts +2 -2
- package/dist/components/AttributeValue/index.d.ts +2 -2
- package/dist/components/BreatheAnimation/index.js +1 -1
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Cards/index.d.ts +3 -3
- package/dist/components/DevTools/index.d.ts +2 -2
- package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
- package/dist/components/DraggableHint/index.d.ts +2 -2
- package/dist/components/Dropdown/index.d.ts +3 -3
- package/dist/components/FlatForm/index.d.ts +2 -2
- package/dist/components/FormComponentDescription/index.d.ts +1 -1
- package/dist/components/FormComponentTitle/index.d.ts +1 -1
- package/dist/components/Player/index.d.ts +9 -9
- package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
- package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
- package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
- package/dist/components/ProductDescription/index.d.ts +3 -3
- package/dist/components/ProductName/index.d.ts +3 -3
- package/dist/components/Share/index.d.ts +2 -2
- package/dist/components/Share/index.js +1 -1
- package/dist/components/Share/share.styles.d.ts +1 -1
- package/dist/components/Snapshots/index.d.ts +2 -2
- package/dist/components/Strips/index.d.ts +3 -3
- package/dist/components/Swatch/index.d.ts +3 -3
- package/dist/components/Switch/index.d.ts +3 -3
- package/dist/components/TextInput/index.d.ts +3 -3
- package/dist/components/ThreekitProvider/index.d.ts +6 -3
- package/dist/components/ThreekitProvider/index.js +27 -2
- package/dist/components/Tiles/index.d.ts +3 -3
- package/dist/components/TilesGroup/index.d.ts +3 -3
- package/dist/components/TotalPrice/index.d.ts +3 -3
- package/dist/components/TrebleApp/index.d.ts +3 -3
- package/dist/components/TrebleApp/index.js +5 -0
- package/dist/components/TurntableAnimation/index.js +1 -1
- package/dist/components/Upload/index.d.ts +3 -3
- package/dist/components/Upload/index.js +1 -1
- package/dist/components/UploadArea/index.d.ts +3 -3
- package/dist/components/UploadArea/index.js +1 -1
- package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
- package/dist/components/Wishlist/index.d.ts +4 -4
- package/dist/components/Wishlist/index.js +1 -1
- package/dist/components/Zoom/index.d.ts +6 -6
- package/dist/components/containers/formInputContainer.d.ts +2 -2
- package/dist/components/formComponents.d.ts +6 -6
- package/dist/components/message/index.d.ts +1 -1
- package/dist/constants.d.ts +6 -6
- package/dist/hooks/useAttribute/index.d.ts +4 -4
- package/dist/hooks/useAttribute/index.js +3 -3
- package/dist/hooks/useConfigurationLoader/index.js +1 -1
- package/dist/hooks/useConfigurator/index.d.ts +3 -3
- package/dist/hooks/useConfigurator/index.js +3 -5
- package/dist/hooks/useDevTools/index.d.ts +1 -1
- package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
- package/dist/hooks/useNestedConfigurator/index.js +3 -3
- package/dist/hooks/usePlayer/index.d.ts +1 -1
- package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
- package/dist/hooks/useProductCache/index.js +1 -1
- package/dist/hooks/useResetProduct/index.d.ts +1 -1
- package/dist/hooks/useResetProduct/index.js +1 -1
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1 -1
- package/dist/hooks/useRoomBuilder/constants.js +2 -2
- package/dist/hooks/useRoomBuilder/themes.js +1 -1
- package/dist/hooks/useRoomBuilder/types.d.ts +7 -7
- package/dist/hooks/useRoomBuilder/types.js +5 -5
- package/dist/hooks/useRoomBuilder/validators.d.ts +1 -1
- package/dist/hooks/useShare/index.d.ts +1 -1
- package/dist/hooks/useShare/index.js +4 -2
- package/dist/hooks/useSingleAnimation/index.js +1 -1
- package/dist/hooks/useSnapshot/index.d.ts +1 -1
- package/dist/hooks/useWishlist/index.d.ts +1 -1
- package/dist/hooks/useZoom/index.d.ts +1 -1
- package/dist/http/assets.d.ts +2 -0
- package/dist/http/assets.js +16 -0
- package/dist/http/index.d.ts +2 -2
- package/dist/http/index.js +2 -2
- package/dist/http/orders.d.ts +1 -1
- package/dist/icons/Spinner.d.ts +2 -2
- package/dist/store/attributes.d.ts +4 -4
- package/dist/store/attributes.js +2 -4
- package/dist/store/index.d.ts +6 -6
- package/dist/store/price.d.ts +1 -1
- package/dist/store/price.js +1 -1
- package/dist/store/product.d.ts +2 -2
- package/dist/store/product.js +1 -1
- package/dist/store/translations.d.ts +10 -8
- package/dist/store/translations.js +39 -19
- package/dist/store/treble.d.ts +1 -1
- package/dist/store/treble.js +1 -1
- package/dist/store/wishlist.d.ts +2 -2
- package/dist/store/wishlist.js +1 -1
- package/dist/types.d.ts +19 -17
- package/dist/types.js +9 -9
- package/dist/utils.d.ts +2 -6
- package/dist/utils.js +12 -13
- package/package.json +1 -2
- package/dist/Treble/snapshot.d.ts +0 -22
- package/dist/Treble/snapshot.js +0 -247
- package/dist/api/products.d.ts +0 -4
- package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
- package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
- package/dist/hooks/useSpaces/SpacesState.d.ts +0 -164
- package/dist/hooks/useSpaces/SpacesState.js +0 -1751
- package/dist/hooks/useSpaces/constants.d.ts +0 -64
- package/dist/hooks/useSpaces/constants.js +0 -109
- package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -20
- package/dist/hooks/useSpaces/dataHandlers.js +0 -254
- package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
- package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
- package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
- package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
- package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
- package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
- package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
- package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawGrid.js +0 -33
- package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
- package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
- package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
- package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
- package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -10
- package/dist/hooks/useSpaces/draw/drawWalls.js +0 -88
- package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
- package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
- package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
- package/dist/hooks/useSpaces/draw/index.js +0 -129
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
- package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
- package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
- package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
- package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
- package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
- package/dist/hooks/useSpaces/geometry/findLoops.js +0 -117
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
- package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
- package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
- package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
- package/dist/hooks/useSpaces/geometry/index.js +0 -64
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
- package/dist/hooks/useSpaces/index.d.ts +0 -82
- package/dist/hooks/useSpaces/index.js +0 -482
- package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
- package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
- package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
- package/dist/hooks/useSpaces/themes/default.js +0 -96
- package/dist/hooks/useSpaces/themes/index.d.ts +0 -11
- package/dist/hooks/useSpaces/themes/index.js +0 -21
- package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
- package/dist/hooks/useSpaces/themes/light.js +0 -96
- package/dist/hooks/useSpaces/types.d.ts +0 -339
- package/dist/hooks/useSpaces/types.js +0 -54
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
- package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
- package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
- package/dist/hooks/useSpaces/validators/index.js +0 -40
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
- package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
- package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
- package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
- package/dist/hooks/useSpaces/validators/messaging.d.ts +0 -8
- package/dist/hooks/useSpaces/validators/messaging.js +0 -18
- package/dist/http/products.d.ts +0 -1
- package/dist/http/products.js +0 -12
- package/dist/icons/AngleSnapping.d.ts +0 -3
- package/dist/icons/AngleSnapping.js +0 -28
- package/dist/icons/Center.d.ts +0 -3
- package/dist/icons/Center.js +0 -24
- package/dist/icons/GridSnapping.d.ts +0 -3
- package/dist/icons/GridSnapping.js +0 -28
- package/dist/icons/LayoutAlt.d.ts +0 -3
- package/dist/icons/LayoutAlt.js +0 -21
- package/dist/icons/Magnet.d.ts +0 -3
- package/dist/icons/Magnet.js +0 -27
- package/dist/icons/Player3D.d.ts +0 -3
- package/dist/icons/Player3D.js +0 -21
- package/dist/icons/Ruler copy.d.ts +0 -3
- package/dist/icons/Ruler copy.js +0 -22
- package/dist/icons/RulerBlank.d.ts +0 -3
- package/dist/icons/RulerBlank.js +0 -25
- package/dist/icons/RulerDetailed copy.d.ts +0 -3
- package/dist/icons/RulerDetailed copy.js +0 -27
- package/dist/icons/RulerDetailed.d.ts +0 -3
- package/dist/icons/RulerDetailed.js +0 -27
- package/dist/icons/Save.d.ts +0 -3
- package/dist/icons/Save.js +0 -21
- package/dist/icons/UnitCm.d.ts +0 -3
- package/dist/icons/UnitCm.js +0 -22
- package/dist/icons/UnitFeet.d.ts +0 -3
- package/dist/icons/UnitFeet.js +0 -22
- package/dist/icons/UnitInch.d.ts +0 -3
- package/dist/icons/UnitInch.js +0 -22
- package/dist/icons/UnitMeter.d.ts +0 -3
- package/dist/icons/UnitMeter.js +0 -21
- package/dist/store/spaces.d.ts +0 -47
- package/dist/store/spaces.js +0 -197
|
@@ -1,36 +0,0 @@
|
|
|
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;
|
|
@@ -1,33 +0,0 @@
|
|
|
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;
|
|
@@ -1,23 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,72 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,61 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
|
@@ -1,88 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,82 +0,0 @@
|
|
|
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;
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,129 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|