@threekit-tools/treble 0.0.95-next-01 → 0.0.96
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.d.ts +2 -2
- package/dist/Treble/Treble.js +2 -2
- package/dist/Treble/index.d.ts +1 -1
- package/dist/Treble/index.js +1 -1
- package/dist/hooks/useNestedConfigurator/index.js +2 -1
- package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
- package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
- package/dist/hooks/useRoomBuilder/constants.js +48 -0
- package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
- package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
- package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
- package/dist/hooks/useRoomBuilder/draw.js +573 -0
- package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
- package/dist/hooks/{useSpaces/geometry → useRoomBuilder}/findLoops.js +13 -31
- package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
- package/dist/hooks/useRoomBuilder/geometry.js +325 -0
- package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
- package/dist/hooks/useRoomBuilder/index.js +303 -0
- package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.js +1 -1
- package/dist/hooks/{useSpaces/themes/index.d.ts → useRoomBuilder/themes.d.ts} +4 -3
- package/dist/hooks/useRoomBuilder/themes.js +273 -0
- package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
- package/dist/hooks/{useSpaces → useRoomBuilder}/types.js +1 -19
- package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
- package/dist/hooks/useRoomBuilder/validators.js +362 -0
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/Window.js +4 -4
- package/dist/icons/index.js +0 -28
- package/dist/icons/types.d.ts +1 -1
- package/dist/index.d.ts +2 -17
- package/dist/index.js +5 -35
- package/dist/store/attributes.d.ts +0 -1
- package/dist/store/index.d.ts +0 -10
- package/dist/store/index.js +1 -3
- package/dist/store/product.js +7 -4
- package/dist/store/treble.d.ts +1 -1
- package/dist/store/treble.js +21 -14
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
- 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 -177
- package/dist/hooks/useSpaces/SpacesState.js +0 -1816
- package/dist/hooks/useSpaces/constants.d.ts +0 -79
- package/dist/hooks/useSpaces/constants.js +0 -130
- package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -38
- package/dist/hooks/useSpaces/dataHandlers.js +0 -411
- 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 -36
- 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 -11
- package/dist/hooks/useSpaces/draw/drawWalls.js +0 -90
- 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/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 -95
- package/dist/hooks/useSpaces/index.js +0 -625
- 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.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 -378
- 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/icons/AngleSnapping.d.ts +0 -3
- package/dist/icons/AngleSnapping.js +0 -28
- package/dist/icons/Boundary.d.ts +0 -3
- package/dist/icons/Boundary.js +0 -21
- 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/RulerBlank.d.ts +0 -3
- package/dist/icons/RulerBlank.js +0 -25
- 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 -74
- package/dist/store/spaces.js +0 -354
- /package/dist/Treble/{snapshot.d.ts → snapshots.d.ts} +0 -0
- /package/dist/Treble/{snapshot.js → snapshots.js} +0 -0
- /package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.d.ts +0 -0
|
@@ -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;
|
|
@@ -1,11 +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 getLengthOfLineSegment_1 = __importDefault(require("./getLengthOfLineSegment"));
|
|
7
|
-
function arePointsWithinProximity(point1, point2, proximity) {
|
|
8
|
-
var length = (0, getLengthOfLineSegment_1.default)([point1, point2]);
|
|
9
|
-
return length <= proximity;
|
|
10
|
-
}
|
|
11
|
-
exports.default = arePointsWithinProximity;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function closestPointOnLine(pointOnLine, angle, point) {
|
|
4
|
-
var x1 = point[0], y1 = point[1];
|
|
5
|
-
var x2 = pointOnLine[0], y2 = pointOnLine[1];
|
|
6
|
-
var dx = Math.cos(angle);
|
|
7
|
-
var dy = Math.sin(angle);
|
|
8
|
-
var t = ((x1 - x2) * dx + (y1 - y2) * dy) / (dx * dx + dy * dy);
|
|
9
|
-
var x = x2 + t * dx;
|
|
10
|
-
var y = y2 + t * dy;
|
|
11
|
-
return [x, y];
|
|
12
|
-
}
|
|
13
|
-
exports.default = closestPointOnLine;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function doLinesOverlap(line1, line2) {
|
|
4
|
-
var start1 = line1[0];
|
|
5
|
-
var end1 = line1[0] + line1[1];
|
|
6
|
-
var start2 = line2[0];
|
|
7
|
-
var end2 = line2[0] + line2[1];
|
|
8
|
-
if (start2 < start1 && start1 < end2)
|
|
9
|
-
return true;
|
|
10
|
-
if (start2 < end1 && end1 < end2)
|
|
11
|
-
return true;
|
|
12
|
-
if (start1 < start2 && start2 < end1 && start1 < end2 && end2 < end1)
|
|
13
|
-
return true;
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
exports.default = doLinesOverlap;
|
|
@@ -1,23 +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 getLineSegmentsIntersection_1 = __importDefault(require("./getLineSegmentsIntersection"));
|
|
7
|
-
function getAllLineIntersections(line, lines) {
|
|
8
|
-
var lineStr = [JSON.stringify(line[0]), JSON.stringify(line[1])];
|
|
9
|
-
return lines.reduce(function (output, existingLine, i) {
|
|
10
|
-
if (existingLine === null)
|
|
11
|
-
return output;
|
|
12
|
-
var startStr = JSON.stringify(existingLine[0]);
|
|
13
|
-
var endStr = JSON.stringify(existingLine[1]);
|
|
14
|
-
if (lineStr.includes(startStr) || lineStr.includes(endStr))
|
|
15
|
-
return output;
|
|
16
|
-
var intersectionPoint = (0, getLineSegmentsIntersection_1.default)(line, existingLine);
|
|
17
|
-
if (!intersectionPoint)
|
|
18
|
-
return output;
|
|
19
|
-
output.push({ index: i, point: intersectionPoint });
|
|
20
|
-
return output;
|
|
21
|
-
}, []);
|
|
22
|
-
}
|
|
23
|
-
exports.default = getAllLineIntersections;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getAngleOfLineSegment(line) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
return Math.atan2(y2 - y1, x2 - x1);
|
|
6
|
-
}
|
|
7
|
-
exports.default = getAngleOfLineSegment;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getClosestPointOnLineSegment(line, point) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
var lineVector = [x2 - x1, y2 - y1];
|
|
6
|
-
var pointVector = [point[0] - x1, point[1] - y1];
|
|
7
|
-
var lineLength = Math.pow(lineVector[0], 2) + Math.pow(lineVector[1], 2);
|
|
8
|
-
var dotProduct = (pointVector[0] * lineVector[0] + pointVector[1] * lineVector[1]) /
|
|
9
|
-
lineLength;
|
|
10
|
-
if (dotProduct < 0)
|
|
11
|
-
return [x1, y1];
|
|
12
|
-
if (dotProduct > 1)
|
|
13
|
-
return [x2, y2];
|
|
14
|
-
else
|
|
15
|
-
return [x1 + dotProduct * lineVector[0], y1 + dotProduct * lineVector[1]];
|
|
16
|
-
}
|
|
17
|
-
exports.default = getClosestPointOnLineSegment;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getDistanceToLine(pointOnLine, angle, point) {
|
|
4
|
-
var x1 = point[0], y1 = point[1];
|
|
5
|
-
var x2 = pointOnLine[0], y2 = pointOnLine[1];
|
|
6
|
-
var dx = Math.cos(angle);
|
|
7
|
-
var dy = Math.sin(angle);
|
|
8
|
-
return (Math.abs((y1 - y2) * dx - (x1 - x2) * dy) / Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)));
|
|
9
|
-
}
|
|
10
|
-
exports.default = getDistanceToLine;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getLengthOfLineSegment(line) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
|
|
6
|
-
}
|
|
7
|
-
exports.default = getLengthOfLineSegment;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getLineAtOffsetOnLineSegment(line, offset, length) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
var d = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
|
|
6
|
-
var startRatio = offset / d;
|
|
7
|
-
var endRatio = (offset + length) / d;
|
|
8
|
-
var startX = x1 + startRatio * (x2 - x1);
|
|
9
|
-
var startY = y1 + startRatio * (y2 - y1);
|
|
10
|
-
var endX = x1 + endRatio * (x2 - x1);
|
|
11
|
-
var endY = y1 + endRatio * (y2 - y1);
|
|
12
|
-
return [
|
|
13
|
-
[startX, startY],
|
|
14
|
-
[endX, endY],
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
exports.default = getLineAtOffsetOnLineSegment;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var geometry_1 = require("../geometry");
|
|
4
|
-
function getLineOtherPoint(line, point) {
|
|
5
|
-
var eq0 = (0, geometry_1.arePointsEqual)(line[0], point);
|
|
6
|
-
var eq1 = (0, geometry_1.arePointsEqual)(line[1], point);
|
|
7
|
-
if (eq0 === eq1)
|
|
8
|
-
console.warn('Unexpected. Is your wall of 0 length?', JSON.parse(JSON.stringify({ line: line, point: point })));
|
|
9
|
-
return eq0 ? line[1] : line[0];
|
|
10
|
-
}
|
|
11
|
-
exports.default = getLineOtherPoint;
|
|
@@ -1,43 +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 getLineSegmentsIntersection(line1, line2) {
|
|
8
|
-
if (arePointsEqual_1.default.apply(void 0, line1) || arePointsEqual_1.default.apply(void 0, line2))
|
|
9
|
-
return null;
|
|
10
|
-
if ((0, arePointsEqual_1.default)(line1[0], line2[0]))
|
|
11
|
-
return null;
|
|
12
|
-
if ((0, arePointsEqual_1.default)(line1[0], line2[1]))
|
|
13
|
-
return null;
|
|
14
|
-
if ((0, arePointsEqual_1.default)(line1[1], line2[0]))
|
|
15
|
-
return null;
|
|
16
|
-
if ((0, arePointsEqual_1.default)(line1[1], line2[1]))
|
|
17
|
-
return null;
|
|
18
|
-
var _a = line1.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
19
|
-
var _b = line2.flat(), x3 = _b[0], y3 = _b[1], x4 = _b[2], y4 = _b[3];
|
|
20
|
-
var a1 = y2 - y1;
|
|
21
|
-
var b1 = x1 - x2;
|
|
22
|
-
var c1 = a1 * x1 + b1 * y1;
|
|
23
|
-
var a2 = y4 - y3;
|
|
24
|
-
var b2 = x3 - x4;
|
|
25
|
-
var c2 = a2 * x3 + b2 * y3;
|
|
26
|
-
var determinant = a1 * b2 - a2 * b1;
|
|
27
|
-
if (determinant === 0)
|
|
28
|
-
return null;
|
|
29
|
-
var x = (b2 * c1 - b1 * c2) / determinant;
|
|
30
|
-
var y = (a1 * c2 - a2 * c1) / determinant;
|
|
31
|
-
if (x < Math.min(x1, x2) ||
|
|
32
|
-
x > Math.max(x1, x2) ||
|
|
33
|
-
x < Math.min(x3, x4) ||
|
|
34
|
-
x > Math.max(x3, x4))
|
|
35
|
-
return null;
|
|
36
|
-
if (y < Math.min(y1, y2) ||
|
|
37
|
-
y > Math.max(y1, y2) ||
|
|
38
|
-
y < Math.min(y3, y4) ||
|
|
39
|
-
y > Math.max(y3, y4))
|
|
40
|
-
return null;
|
|
41
|
-
return [x, y];
|
|
42
|
-
}
|
|
43
|
-
exports.default = getLineSegmentsIntersection;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getMidpointOfLineSegment(line) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
var xMidpoint = (x1 + x2) / 2;
|
|
6
|
-
var yMidpoint = (y1 + y2) / 2;
|
|
7
|
-
return [xMidpoint, yMidpoint];
|
|
8
|
-
}
|
|
9
|
-
exports.default = getMidpointOfLineSegment;
|
|
@@ -1,20 +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 getUnitVectorOfLineSegment_1 = __importDefault(require("./getUnitVectorOfLineSegment"));
|
|
7
|
-
function getParallelLineSegmentAtDistance(line, distance) {
|
|
8
|
-
if (!distance)
|
|
9
|
-
return line;
|
|
10
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
11
|
-
var unitVector = (0, getUnitVectorOfLineSegment_1.default)(line);
|
|
12
|
-
var _b = distance > 0
|
|
13
|
-
? [unitVector[1], -unitVector[0]]
|
|
14
|
-
: [-unitVector[1], unitVector[0]], xNormal = _b[0], yNormal = _b[1];
|
|
15
|
-
var length = Math.abs(distance);
|
|
16
|
-
var point1 = [x1 + xNormal * length, y1 + yNormal * length];
|
|
17
|
-
var point2 = [x2 + xNormal * length, y2 + yNormal * length];
|
|
18
|
-
return [point1, point2];
|
|
19
|
-
}
|
|
20
|
-
exports.default = getParallelLineSegmentAtDistance;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getPointAtOffsetOnLineSegment(line, offset) {
|
|
4
|
-
var _a = line.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
|
|
5
|
-
var d = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
|
|
6
|
-
var r = offset / d;
|
|
7
|
-
var x = x1 + r * (x2 - x1);
|
|
8
|
-
var y = y1 + r * (y2 - y1);
|
|
9
|
-
return [x, y];
|
|
10
|
-
}
|
|
11
|
-
exports.default = getPointAtOffsetOnLineSegment;
|
|
@@ -1,15 +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 getTriangleArea_1 = __importDefault(require("./getTriangleArea"));
|
|
7
|
-
function getPolygonArea(polygon) {
|
|
8
|
-
var origin = [0, 0];
|
|
9
|
-
return polygon.reduce(function (sum, point1, i) {
|
|
10
|
-
var point2 = polygon[(i + 1) % polygon.length];
|
|
11
|
-
sum += (0, getTriangleArea_1.default)(origin, point1, point2);
|
|
12
|
-
return sum;
|
|
13
|
-
}, 0);
|
|
14
|
-
}
|
|
15
|
-
exports.default = getPolygonArea;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getQuadrilateralArea(quadrilateral) {
|
|
4
|
-
var _a = quadrilateral.flat(), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3], x3 = _a[4], y3 = _a[5], x4 = _a[6], y4 = _a[7];
|
|
5
|
-
var area = Math.abs((x1 * y2 +
|
|
6
|
-
x2 * y3 +
|
|
7
|
-
x3 * y4 +
|
|
8
|
-
x4 * y1 -
|
|
9
|
-
x2 * y1 -
|
|
10
|
-
x3 * y2 -
|
|
11
|
-
x4 * y3 -
|
|
12
|
-
x1 * y4) /
|
|
13
|
-
2);
|
|
14
|
-
return area;
|
|
15
|
-
}
|
|
16
|
-
exports.default = getQuadrilateralArea;
|
|
@@ -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 getClosestPointOnLineSegment_1 = __importDefault(require("./getClosestPointOnLineSegment"));
|
|
7
|
-
var getLengthOfLineSegment_1 = __importDefault(require("./getLengthOfLineSegment"));
|
|
8
|
-
function getTangetIntersectionAndOffset(line, point) {
|
|
9
|
-
var interceptPoint = (0, getClosestPointOnLineSegment_1.default)(line, point);
|
|
10
|
-
if (!interceptPoint)
|
|
11
|
-
return undefined;
|
|
12
|
-
return {
|
|
13
|
-
point: interceptPoint,
|
|
14
|
-
offset: (0, getLengthOfLineSegment_1.default)([line[0], interceptPoint]),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.default = getTangetIntersectionAndOffset;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getTriangleArea(point1, point2, point3) {
|
|
4
|
-
return ((point1[0] * (point2[1] - point3[1]) +
|
|
5
|
-
point2[0] * (point3[1] - point1[1]) +
|
|
6
|
-
point3[0] * (point1[1] - point2[1])) /
|
|
7
|
-
2);
|
|
8
|
-
}
|
|
9
|
-
exports.default = getTriangleArea;
|