@threekit-tools/treble 0.0.91 → 0.0.92-next-01
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/components/ThreekitProvider/index.js +3 -2
- package/dist/connection.d.ts +4 -1
- package/dist/connection.js +16 -53
- package/dist/hooks/useAttribute/index.js +1 -5
- package/dist/hooks/useNestedConfigurator/index.js +1 -2
- package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
- package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
- package/dist/hooks/useSpaces/SpacesState.d.ts +177 -0
- package/dist/hooks/useSpaces/SpacesState.js +1814 -0
- package/dist/hooks/useSpaces/constants.d.ts +79 -0
- package/dist/hooks/useSpaces/constants.js +130 -0
- package/dist/hooks/useSpaces/dataHandlers.d.ts +38 -0
- package/dist/hooks/useSpaces/dataHandlers.js +407 -0
- package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
- package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
- package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
- package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
- package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
- package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawDoors.js +99 -0
- package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawGrid.js +36 -0
- package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
- package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
- package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
- package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
- package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +11 -0
- package/dist/hooks/useSpaces/draw/drawWalls.js +90 -0
- package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
- package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
- package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
- package/dist/hooks/useSpaces/draw/index.js +129 -0
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
- package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
- package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
- package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
- package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
- package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
- package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
- package/dist/hooks/{useRoomBuilder → useSpaces/geometry}/findLoops.js +31 -13
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
- package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
- package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
- package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
- package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
- package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
- package/dist/hooks/useSpaces/geometry/index.js +64 -0
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
- package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
- package/dist/hooks/useSpaces/index.d.ts +95 -0
- package/dist/hooks/useSpaces/index.js +557 -0
- package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
- package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/default.js +96 -0
- package/dist/hooks/{useRoomBuilder/themes.d.ts → useSpaces/themes/index.d.ts} +3 -4
- package/dist/hooks/useSpaces/themes/index.js +21 -0
- package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
- package/dist/hooks/useSpaces/themes/light.js +96 -0
- package/dist/hooks/useSpaces/types.d.ts +378 -0
- package/dist/hooks/{useRoomBuilder → useSpaces}/types.js +19 -1
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
- package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
- package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
- package/dist/hooks/useSpaces/validators/index.js +40 -0
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
- package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
- package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
- package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
- package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
- package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.js +1 -1
- package/dist/icons/Boundary.d.ts +3 -0
- package/dist/icons/Boundary.js +21 -0
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/Player3D.d.ts +3 -0
- package/dist/icons/Player3D.js +21 -0
- package/dist/icons/RulerBlank.d.ts +3 -0
- package/dist/icons/RulerBlank.js +25 -0
- package/dist/icons/RulerDetailed.d.ts +3 -0
- package/dist/icons/RulerDetailed.js +27 -0
- package/dist/icons/Window.js +4 -4
- package/dist/icons/index.js +28 -0
- package/dist/icons/types.d.ts +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +35 -5
- package/dist/store/attributes.d.ts +2 -1
- package/dist/store/index.d.ts +17 -31
- package/dist/store/index.js +3 -1
- package/dist/store/product.js +4 -7
- package/dist/store/spaces.d.ts +74 -0
- package/dist/store/spaces.js +354 -0
- package/dist/store/treble.d.ts +4 -2
- package/dist/store/treble.js +58 -50
- package/dist/store/wishlist.d.ts +20 -2
- package/dist/types.d.ts +14 -3
- package/package.json +2 -1
- package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
- package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
- package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
- package/dist/hooks/useRoomBuilder/constants.js +0 -48
- package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +0 -18
- package/dist/hooks/useRoomBuilder/dataHandlers.js +0 -187
- package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
- package/dist/hooks/useRoomBuilder/draw.js +0 -573
- package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
- package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
- package/dist/hooks/useRoomBuilder/geometry.js +0 -325
- package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
- package/dist/hooks/useRoomBuilder/index.js +0 -303
- package/dist/hooks/useRoomBuilder/themes.js +0 -273
- package/dist/hooks/useRoomBuilder/types.d.ts +0 -238
- package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
- package/dist/hooks/useRoomBuilder/validators.js +0 -362
- package/dist/hooks/useSpaces/Canvas.d.ts +0 -37
- package/dist/hooks/useSpaces/Canvas.js +0 -199
- /package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +0 -0
- /package/dist/Treble/{snapshots.js → snapshot.js} +0 -0
- /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
|
@@ -1,573 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.drawRoom = exports.drawElements = exports.drawOpenings = exports.drawDoors = exports.drawWindows = exports.drawDimensions = exports.drawVertices = exports.drawWalls = exports.drawNewWall = exports.drawVertex = exports.drawFloor = exports.drawGrid = exports.drawBackground = exports.clearCanvas = void 0;
|
|
13
|
-
var types_1 = require("./types");
|
|
14
|
-
var types_2 = require("./types");
|
|
15
|
-
var geometry_1 = require("./geometry");
|
|
16
|
-
var debug = false;
|
|
17
|
-
function clearCanvas(canvas) {
|
|
18
|
-
var ctx = canvas.getContext('2d');
|
|
19
|
-
if (!ctx)
|
|
20
|
-
return;
|
|
21
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
22
|
-
}
|
|
23
|
-
exports.clearCanvas = clearCanvas;
|
|
24
|
-
function drawBackground(canvas, color) {
|
|
25
|
-
if (!color)
|
|
26
|
-
return;
|
|
27
|
-
var ctx = canvas.getContext('2d');
|
|
28
|
-
if (!ctx)
|
|
29
|
-
return;
|
|
30
|
-
ctx.fillStyle = color;
|
|
31
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
32
|
-
}
|
|
33
|
-
exports.drawBackground = drawBackground;
|
|
34
|
-
function drawGrid(canvas, styles) {
|
|
35
|
-
var ctx = canvas.getContext('2d');
|
|
36
|
-
if (!ctx)
|
|
37
|
-
return;
|
|
38
|
-
ctx.strokeStyle = styles.lineColor;
|
|
39
|
-
var numHorizontalLines = Math.ceil(canvas.width / styles.gridStepGap);
|
|
40
|
-
var numVerticalLines = Math.ceil(canvas.height / styles.gridStepGap);
|
|
41
|
-
for (var i = 0; i < numHorizontalLines; i++) {
|
|
42
|
-
var y = i * styles.gridStepGap;
|
|
43
|
-
ctx.lineWidth =
|
|
44
|
-
styles.secondaryLineIncrement !== undefined &&
|
|
45
|
-
i % styles.secondaryLineIncrement === 0
|
|
46
|
-
? styles.secondaryLineThickness
|
|
47
|
-
: styles.lineThickness;
|
|
48
|
-
ctx.beginPath();
|
|
49
|
-
ctx.moveTo(0, y);
|
|
50
|
-
ctx.lineTo(canvas.width, y);
|
|
51
|
-
ctx.stroke();
|
|
52
|
-
}
|
|
53
|
-
for (var i = 0; i < numVerticalLines; i++) {
|
|
54
|
-
var x = i * styles.gridStepGap;
|
|
55
|
-
ctx.lineWidth =
|
|
56
|
-
styles.secondaryLineIncrement !== undefined &&
|
|
57
|
-
i % styles.secondaryLineIncrement === 0
|
|
58
|
-
? styles.secondaryLineThickness
|
|
59
|
-
: styles.lineThickness;
|
|
60
|
-
ctx.beginPath();
|
|
61
|
-
ctx.moveTo(x, 0);
|
|
62
|
-
ctx.lineTo(x, canvas.height);
|
|
63
|
-
ctx.stroke();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.drawGrid = drawGrid;
|
|
67
|
-
function drawFloor(canvas, enclosedSpaces, styles) {
|
|
68
|
-
var ctx = canvas.getContext('2d');
|
|
69
|
-
if (!ctx)
|
|
70
|
-
return;
|
|
71
|
-
if (!enclosedSpaces.length)
|
|
72
|
-
return;
|
|
73
|
-
for (var _i = 0, enclosedSpaces_1 = enclosedSpaces; _i < enclosedSpaces_1.length; _i++) {
|
|
74
|
-
var enclosedSpace = enclosedSpaces_1[_i];
|
|
75
|
-
var loop = enclosedSpace.loop;
|
|
76
|
-
ctx.fillStyle = styles.color;
|
|
77
|
-
if (debug)
|
|
78
|
-
ctx.fillStyle = 'rgba(255,0,0,.2)';
|
|
79
|
-
ctx.beginPath();
|
|
80
|
-
ctx.moveTo.apply(ctx, loop[0]);
|
|
81
|
-
for (var i = 1; i < loop.length; i++)
|
|
82
|
-
ctx.lineTo.apply(ctx, loop[i]);
|
|
83
|
-
ctx.fill();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.drawFloor = drawFloor;
|
|
87
|
-
function drawWall(canvas, wall, style, mode) {
|
|
88
|
-
var _a;
|
|
89
|
-
var ctx = canvas.getContext('2d');
|
|
90
|
-
if (!ctx)
|
|
91
|
-
return;
|
|
92
|
-
var path = (_a = wall.path) !== null && _a !== void 0 ? _a : (0, geometry_1.addThicknessToLine)(wall.line, style.thickness);
|
|
93
|
-
var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
|
|
94
|
-
if (mode) {
|
|
95
|
-
stroke = style[mode].stroke;
|
|
96
|
-
fill = style[mode].fill;
|
|
97
|
-
}
|
|
98
|
-
ctx.strokeStyle = stroke || fill;
|
|
99
|
-
ctx.fillStyle = fill;
|
|
100
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
101
|
-
ctx.beginPath();
|
|
102
|
-
ctx.moveTo.apply(ctx, path[0]);
|
|
103
|
-
for (var i = 1; i < path.length; i++) {
|
|
104
|
-
ctx.lineTo.apply(ctx, path[i]);
|
|
105
|
-
}
|
|
106
|
-
ctx.lineTo.apply(ctx, path[0]);
|
|
107
|
-
ctx.fill();
|
|
108
|
-
if (style.stroke && style.strokeWidth)
|
|
109
|
-
ctx.stroke();
|
|
110
|
-
}
|
|
111
|
-
function drawFloorArea(canvas, enclosedSpaces, styles) {
|
|
112
|
-
var ctx = canvas.getContext('2d');
|
|
113
|
-
if (!ctx)
|
|
114
|
-
return;
|
|
115
|
-
if (!enclosedSpaces.length)
|
|
116
|
-
return;
|
|
117
|
-
for (var _i = 0, enclosedSpaces_2 = enclosedSpaces; _i < enclosedSpaces_2.length; _i++) {
|
|
118
|
-
var enclosedSpace = enclosedSpaces_2[_i];
|
|
119
|
-
var center = enclosedSpace.center, area = enclosedSpace.area;
|
|
120
|
-
ctx.font = '20px Arial';
|
|
121
|
-
ctx.fillStyle = styles.textColor;
|
|
122
|
-
ctx.fillText(area, center[0], center[1]);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function drawDimension(canvas, line, styles, message) {
|
|
126
|
-
var ctx = canvas.getContext('2d');
|
|
127
|
-
if (!ctx)
|
|
128
|
-
return;
|
|
129
|
-
var dimensionsBoxHeight = styles.fontSize + 6;
|
|
130
|
-
var dimensionsHeight = dimensionsBoxHeight + 6;
|
|
131
|
-
var line1 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding);
|
|
132
|
-
var line2 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight / 2);
|
|
133
|
-
var line3 = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight);
|
|
134
|
-
var textLine = (0, geometry_1.getParallelLineSegmentAtDistance)(line, styles.padding + dimensionsHeight / 2 - dimensionsBoxHeight / 2);
|
|
135
|
-
var textCoordinates = (0, geometry_1.getMidpointOfLineSegment)(textLine);
|
|
136
|
-
var textAngle = (0, geometry_1.getAngleOfLineSegment)(textLine);
|
|
137
|
-
ctx.strokeStyle = styles.lineColor;
|
|
138
|
-
ctx.lineWidth = 1;
|
|
139
|
-
ctx.beginPath();
|
|
140
|
-
ctx.moveTo.apply(ctx, line2[0]);
|
|
141
|
-
ctx.lineTo.apply(ctx, line2[1]);
|
|
142
|
-
ctx.stroke();
|
|
143
|
-
ctx.beginPath();
|
|
144
|
-
ctx.moveTo.apply(ctx, line1[0]);
|
|
145
|
-
ctx.lineTo.apply(ctx, line3[0]);
|
|
146
|
-
ctx.stroke();
|
|
147
|
-
ctx.beginPath();
|
|
148
|
-
ctx.moveTo.apply(ctx, line1[1]);
|
|
149
|
-
ctx.lineTo.apply(ctx, line3[1]);
|
|
150
|
-
ctx.stroke();
|
|
151
|
-
ctx.beginPath();
|
|
152
|
-
ctx.font = "".concat(styles.fontSize, "px ").concat(styles.font);
|
|
153
|
-
ctx.font = "".concat(styles.fontSize, "px ").concat(styles.font);
|
|
154
|
-
ctx.translate.apply(ctx, textCoordinates);
|
|
155
|
-
ctx.rotate(textAngle);
|
|
156
|
-
ctx.fillStyle = styles.textBackgroundColor;
|
|
157
|
-
var textWidth = ctx.measureText(message).width + 12;
|
|
158
|
-
ctx.fillRect(-(textWidth / 2), -((dimensionsBoxHeight * 3) / 4), textWidth, dimensionsBoxHeight);
|
|
159
|
-
ctx.fillStyle = styles.textColor;
|
|
160
|
-
ctx.textAlign = 'center';
|
|
161
|
-
ctx.fillText(message, 0, 0);
|
|
162
|
-
ctx.resetTransform();
|
|
163
|
-
}
|
|
164
|
-
function drawVertex(canvas, point, style, mode) {
|
|
165
|
-
var ctx = canvas.getContext('2d');
|
|
166
|
-
if (!ctx)
|
|
167
|
-
return;
|
|
168
|
-
var stroke = style.stroke, innerFill = style.innerFill, outerFill = style.outerFill, strokeWidth = style.strokeWidth, outerRadius = style.outerRadius;
|
|
169
|
-
if (mode) {
|
|
170
|
-
stroke = style[mode].stroke;
|
|
171
|
-
innerFill = style[mode].innerFill;
|
|
172
|
-
outerFill = style[mode].outerFill;
|
|
173
|
-
}
|
|
174
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
175
|
-
ctx.strokeStyle = stroke || innerFill;
|
|
176
|
-
ctx.fillStyle = outerFill;
|
|
177
|
-
if (outerRadius) {
|
|
178
|
-
ctx.beginPath();
|
|
179
|
-
ctx.arc(point[0], point[1], outerRadius, 0, 2 * Math.PI);
|
|
180
|
-
if (style.strokeWidth)
|
|
181
|
-
ctx.stroke();
|
|
182
|
-
ctx.fill();
|
|
183
|
-
}
|
|
184
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
185
|
-
ctx.fillStyle = innerFill;
|
|
186
|
-
ctx.strokeStyle = stroke || innerFill;
|
|
187
|
-
ctx.beginPath();
|
|
188
|
-
ctx.arc(point[0], point[1], style.innerRadius, 0, 2 * Math.PI);
|
|
189
|
-
ctx.fill();
|
|
190
|
-
if (!outerRadius && strokeWidth)
|
|
191
|
-
ctx.stroke();
|
|
192
|
-
if (debug) {
|
|
193
|
-
ctx.font = '20px Arial';
|
|
194
|
-
ctx.fillStyle = 'red';
|
|
195
|
-
ctx.fillText.apply(ctx, __spreadArray([Math.round(point[0]) + ',' + Math.round(point[1])], point, false));
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
exports.drawVertex = drawVertex;
|
|
199
|
-
function drawWindow(canvas, wall, offset, length, style, mode) {
|
|
200
|
-
var ctx = canvas.getContext('2d');
|
|
201
|
-
if (!ctx)
|
|
202
|
-
return;
|
|
203
|
-
var windowLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
|
|
204
|
-
var windowRectangleLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset + style.thickness / 2, length - style.thickness);
|
|
205
|
-
var points = (0, geometry_1.addThicknessToLine)(windowLine, style.thickness);
|
|
206
|
-
var rectanglePoints = (0, geometry_1.addThicknessToLine)(windowRectangleLine, style.thickness);
|
|
207
|
-
var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
|
|
208
|
-
if (mode) {
|
|
209
|
-
stroke = style[mode].stroke;
|
|
210
|
-
fill = style[mode].fill;
|
|
211
|
-
}
|
|
212
|
-
ctx.fillStyle = 'white';
|
|
213
|
-
ctx.beginPath();
|
|
214
|
-
ctx.moveTo.apply(ctx, points[0]);
|
|
215
|
-
for (var i = 1; i < points.length; i++) {
|
|
216
|
-
ctx.lineTo.apply(ctx, points[i]);
|
|
217
|
-
}
|
|
218
|
-
ctx.lineTo.apply(ctx, points[0]);
|
|
219
|
-
ctx.fill();
|
|
220
|
-
ctx.closePath();
|
|
221
|
-
ctx.strokeStyle = stroke || fill;
|
|
222
|
-
ctx.fillStyle = fill;
|
|
223
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
224
|
-
ctx.moveTo.apply(ctx, rectanglePoints[0]);
|
|
225
|
-
ctx.beginPath();
|
|
226
|
-
for (var i = 1; i < points.length; i++) {
|
|
227
|
-
ctx.lineTo.apply(ctx, rectanglePoints[i]);
|
|
228
|
-
}
|
|
229
|
-
ctx.lineTo.apply(ctx, rectanglePoints[0]);
|
|
230
|
-
ctx.fill();
|
|
231
|
-
ctx.closePath();
|
|
232
|
-
ctx.beginPath();
|
|
233
|
-
ctx.moveTo.apply(ctx, windowLine[0]);
|
|
234
|
-
ctx.lineTo.apply(ctx, windowLine[1]);
|
|
235
|
-
if (style.stroke)
|
|
236
|
-
ctx.stroke();
|
|
237
|
-
ctx.closePath();
|
|
238
|
-
var angle = (0, geometry_1.getAngleOfLineSegment)(windowLine);
|
|
239
|
-
ctx.beginPath();
|
|
240
|
-
ctx.arc(windowLine[0][0], windowLine[0][1], style.thickness / 2, angle - Math.PI / 2, angle + Math.PI / 2);
|
|
241
|
-
ctx.fill();
|
|
242
|
-
ctx.closePath();
|
|
243
|
-
ctx.beginPath();
|
|
244
|
-
ctx.arc(windowLine[1][0], windowLine[1][1], style.thickness / 2, angle + Math.PI / 2, angle - Math.PI / 2);
|
|
245
|
-
ctx.fill();
|
|
246
|
-
}
|
|
247
|
-
function drawDoor(canvas, wall, offset, length, style, mode) {
|
|
248
|
-
var ctx = canvas.getContext('2d');
|
|
249
|
-
if (!ctx)
|
|
250
|
-
return;
|
|
251
|
-
var doorLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
|
|
252
|
-
var points = (0, geometry_1.addThicknessToLine)(doorLine, style.thickness);
|
|
253
|
-
var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
|
|
254
|
-
if (mode) {
|
|
255
|
-
stroke = style[mode].stroke;
|
|
256
|
-
fill = style[mode].fill;
|
|
257
|
-
}
|
|
258
|
-
ctx.strokeStyle = stroke || fill;
|
|
259
|
-
ctx.fillStyle = fill;
|
|
260
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
261
|
-
ctx.beginPath();
|
|
262
|
-
ctx.moveTo.apply(ctx, points[0]);
|
|
263
|
-
for (var i = 1; i < points.length; i++) {
|
|
264
|
-
ctx.lineTo.apply(ctx, points[i]);
|
|
265
|
-
}
|
|
266
|
-
ctx.lineTo.apply(ctx, points[0]);
|
|
267
|
-
ctx.fill();
|
|
268
|
-
if (style.stroke)
|
|
269
|
-
ctx.stroke();
|
|
270
|
-
}
|
|
271
|
-
function drawOpening(canvas, wall, offset, length, style, mode) {
|
|
272
|
-
var ctx = canvas.getContext('2d');
|
|
273
|
-
if (!ctx)
|
|
274
|
-
return;
|
|
275
|
-
var openingLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, offset, length);
|
|
276
|
-
var points = (0, geometry_1.addThicknessToLine)(openingLine, style.thickness);
|
|
277
|
-
var stroke = style.stroke, fill = style.fill, strokeWidth = style.strokeWidth;
|
|
278
|
-
if (mode) {
|
|
279
|
-
stroke = style[mode].stroke;
|
|
280
|
-
fill = style[mode].fill;
|
|
281
|
-
}
|
|
282
|
-
ctx.fillStyle = 'white';
|
|
283
|
-
ctx.beginPath();
|
|
284
|
-
ctx.moveTo.apply(ctx, points[0]);
|
|
285
|
-
for (var i = 1; i < points.length; i++) {
|
|
286
|
-
ctx.lineTo.apply(ctx, points[i]);
|
|
287
|
-
}
|
|
288
|
-
ctx.lineTo.apply(ctx, points[0]);
|
|
289
|
-
ctx.fill();
|
|
290
|
-
ctx.beginPath();
|
|
291
|
-
ctx.strokeStyle = stroke || fill;
|
|
292
|
-
ctx.fillStyle = fill;
|
|
293
|
-
ctx.lineWidth = strokeWidth || 1;
|
|
294
|
-
ctx.setLineDash([10, 10]);
|
|
295
|
-
ctx.moveTo.apply(ctx, openingLine[0]);
|
|
296
|
-
ctx.lineTo.apply(ctx, openingLine[1]);
|
|
297
|
-
ctx.stroke();
|
|
298
|
-
ctx.closePath();
|
|
299
|
-
ctx.beginPath();
|
|
300
|
-
ctx.setLineDash([]);
|
|
301
|
-
var angle = (0, geometry_1.getAngleOfLineSegment)(openingLine);
|
|
302
|
-
ctx.arc(openingLine[0][0], openingLine[0][1], style.thickness / 2, angle - Math.PI / 2, angle + Math.PI / 2);
|
|
303
|
-
ctx.fill();
|
|
304
|
-
ctx.closePath();
|
|
305
|
-
ctx.beginPath();
|
|
306
|
-
ctx.arc(openingLine[1][0], openingLine[1][1], style.thickness / 2, angle + Math.PI / 2, angle - Math.PI / 2);
|
|
307
|
-
ctx.fill();
|
|
308
|
-
}
|
|
309
|
-
function drawNewWall(canvas, line, styles, mode) {
|
|
310
|
-
drawWall(canvas, {
|
|
311
|
-
line: line,
|
|
312
|
-
path: (0, geometry_1.addThicknessToLine)(line, styles.wall.thickness),
|
|
313
|
-
}, styles.wall, mode !== null && mode !== void 0 ? mode : types_1.IElementStyleModes.ACTIVE);
|
|
314
|
-
line.forEach(function (point) {
|
|
315
|
-
return drawVertex(canvas, point, styles.vertex, mode !== null && mode !== void 0 ? mode : types_1.IElementStyleModes.HIGHLIGHT);
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
exports.drawNewWall = drawNewWall;
|
|
319
|
-
function drawWalls(canvas, walls, selections, styles) {
|
|
320
|
-
var styled = [
|
|
321
|
-
selections.active,
|
|
322
|
-
selections.highlighted,
|
|
323
|
-
selections.error,
|
|
324
|
-
selections.hidden,
|
|
325
|
-
];
|
|
326
|
-
var defaultOpenings = walls.reduce(function (output, _, i) {
|
|
327
|
-
if (!styled.flat().includes(i))
|
|
328
|
-
output.push(i);
|
|
329
|
-
return output;
|
|
330
|
-
}, []);
|
|
331
|
-
var wallsMap = [
|
|
332
|
-
[types_1.IElementStyleModes.ACTIVE, selections.active],
|
|
333
|
-
[types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
|
|
334
|
-
[types_1.IElementStyleModes.ERROR, selections.error],
|
|
335
|
-
[undefined, defaultOpenings],
|
|
336
|
-
];
|
|
337
|
-
wallsMap.forEach(function (_a) {
|
|
338
|
-
var mode = _a[0], wallIndexes = _a[1];
|
|
339
|
-
return wallIndexes.forEach(function (index) { return drawWall(canvas, walls[index], styles, mode); });
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
exports.drawWalls = drawWalls;
|
|
343
|
-
function drawVertices(canvas, vertices, selections, styles) {
|
|
344
|
-
var styled = [
|
|
345
|
-
selections.active,
|
|
346
|
-
selections.highlighted,
|
|
347
|
-
selections.error,
|
|
348
|
-
selections.hidden,
|
|
349
|
-
];
|
|
350
|
-
var defaultOpenings = vertices.reduce(function (output, _, i) {
|
|
351
|
-
if (!styled.flat().includes(i))
|
|
352
|
-
output.push(i);
|
|
353
|
-
return output;
|
|
354
|
-
}, []);
|
|
355
|
-
var verticesMap = [
|
|
356
|
-
[types_1.IElementStyleModes.ACTIVE, selections.active],
|
|
357
|
-
[types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
|
|
358
|
-
[types_1.IElementStyleModes.ERROR, selections.error],
|
|
359
|
-
[undefined, defaultOpenings],
|
|
360
|
-
];
|
|
361
|
-
verticesMap.forEach(function (_a) {
|
|
362
|
-
var mode = _a[0], vertexIndexes = _a[1];
|
|
363
|
-
return vertexIndexes.forEach(function (index) {
|
|
364
|
-
var point = vertices[index].point;
|
|
365
|
-
drawVertex(canvas, point, styles, mode);
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
exports.drawVertices = drawVertices;
|
|
370
|
-
function drawDimensions(canvas, dimensions, config) {
|
|
371
|
-
dimensions.forEach(function (_a) {
|
|
372
|
-
var line = _a.line, label = _a.label;
|
|
373
|
-
drawDimension(canvas, line, config.styles.dimensions, label);
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
exports.drawDimensions = drawDimensions;
|
|
377
|
-
function drawWindows(canvas, walls, windows, selections, styles) {
|
|
378
|
-
var styled = [
|
|
379
|
-
selections.active,
|
|
380
|
-
selections.highlighted,
|
|
381
|
-
selections.error,
|
|
382
|
-
selections.hidden,
|
|
383
|
-
];
|
|
384
|
-
var defaultOpenings = windows.reduce(function (output, _, i) {
|
|
385
|
-
if (!styled.flat().includes(i))
|
|
386
|
-
output.push(i);
|
|
387
|
-
return output;
|
|
388
|
-
}, []);
|
|
389
|
-
var windowsMap = [
|
|
390
|
-
[types_1.IElementStyleModes.ACTIVE, selections.active],
|
|
391
|
-
[types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
|
|
392
|
-
[types_1.IElementStyleModes.ERROR, selections.error],
|
|
393
|
-
[undefined, defaultOpenings],
|
|
394
|
-
];
|
|
395
|
-
windowsMap.forEach(function (_a) {
|
|
396
|
-
var mode = _a[0], windowIndexes = _a[1];
|
|
397
|
-
return windowIndexes.forEach(function (index) {
|
|
398
|
-
var window = windows[index];
|
|
399
|
-
if (!(window === null || window === void 0 ? void 0 : window.connectedTo.length))
|
|
400
|
-
return;
|
|
401
|
-
var wallIndex = window.connectedTo[1];
|
|
402
|
-
drawWindow(canvas, walls[wallIndex], window.offset, window.length, styles.feature, mode);
|
|
403
|
-
});
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
exports.drawWindows = drawWindows;
|
|
407
|
-
function drawDoors(canvas, walls, doors, selections, styles) {
|
|
408
|
-
var styled = [
|
|
409
|
-
selections.active,
|
|
410
|
-
selections.highlighted,
|
|
411
|
-
selections.error,
|
|
412
|
-
selections.hidden,
|
|
413
|
-
];
|
|
414
|
-
var defaultOpenings = doors.reduce(function (output, _, i) {
|
|
415
|
-
if (!styled.flat().includes(i))
|
|
416
|
-
output.push(i);
|
|
417
|
-
return output;
|
|
418
|
-
}, []);
|
|
419
|
-
var doorsMap = [
|
|
420
|
-
[types_1.IElementStyleModes.ACTIVE, selections.active],
|
|
421
|
-
[types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
|
|
422
|
-
[types_1.IElementStyleModes.ERROR, selections.error],
|
|
423
|
-
[undefined, defaultOpenings],
|
|
424
|
-
];
|
|
425
|
-
doorsMap.forEach(function (_a) {
|
|
426
|
-
var mode = _a[0], doorsIndexes = _a[1];
|
|
427
|
-
return doorsIndexes.forEach(function (index) {
|
|
428
|
-
var door = doors[index];
|
|
429
|
-
if (!(door === null || door === void 0 ? void 0 : door.connectedTo.length))
|
|
430
|
-
return;
|
|
431
|
-
var wallIndex = door.connectedTo[1];
|
|
432
|
-
drawDoor(canvas, walls[wallIndex], door.offset, door.length, styles.feature, mode);
|
|
433
|
-
});
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
exports.drawDoors = drawDoors;
|
|
437
|
-
function drawOpenings(canvas, walls, openings, selections, styles) {
|
|
438
|
-
var styled = [
|
|
439
|
-
selections.active,
|
|
440
|
-
selections.highlighted,
|
|
441
|
-
selections.error,
|
|
442
|
-
selections.hidden,
|
|
443
|
-
];
|
|
444
|
-
var defaultOpenings = openings.reduce(function (output, _, i) {
|
|
445
|
-
if (!styled.flat().includes(i))
|
|
446
|
-
output.push(i);
|
|
447
|
-
return output;
|
|
448
|
-
}, []);
|
|
449
|
-
var openingsMap = [
|
|
450
|
-
[types_1.IElementStyleModes.ACTIVE, selections.active],
|
|
451
|
-
[types_1.IElementStyleModes.HIGHLIGHT, selections.highlighted],
|
|
452
|
-
[types_1.IElementStyleModes.ERROR, selections.error],
|
|
453
|
-
[undefined, defaultOpenings],
|
|
454
|
-
];
|
|
455
|
-
openingsMap.forEach(function (_a) {
|
|
456
|
-
var mode = _a[0], openingsIndexes = _a[1];
|
|
457
|
-
return openingsIndexes.forEach(function (index) {
|
|
458
|
-
var opening = openings[index];
|
|
459
|
-
if (!(opening === null || opening === void 0 ? void 0 : opening.connectedTo.length))
|
|
460
|
-
return;
|
|
461
|
-
var wallIndex = opening.connectedTo[1];
|
|
462
|
-
drawOpening(canvas, walls[wallIndex], opening.offset, opening.length, styles.feature, mode);
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
exports.drawOpenings = drawOpenings;
|
|
467
|
-
function drawElements(canvas, walls, vertices, features, selections, styles) {
|
|
468
|
-
var wallSelections = {
|
|
469
|
-
active: [],
|
|
470
|
-
highlighted: [],
|
|
471
|
-
hidden: [],
|
|
472
|
-
error: [],
|
|
473
|
-
};
|
|
474
|
-
var verticesSelections = {
|
|
475
|
-
active: [],
|
|
476
|
-
highlighted: [],
|
|
477
|
-
hidden: [],
|
|
478
|
-
error: [],
|
|
479
|
-
};
|
|
480
|
-
var windowSelections = {
|
|
481
|
-
active: [],
|
|
482
|
-
highlighted: [],
|
|
483
|
-
hidden: [],
|
|
484
|
-
error: [],
|
|
485
|
-
};
|
|
486
|
-
var doorSelections = {
|
|
487
|
-
active: [],
|
|
488
|
-
highlighted: [],
|
|
489
|
-
hidden: [],
|
|
490
|
-
error: [],
|
|
491
|
-
};
|
|
492
|
-
var openingSelections = {
|
|
493
|
-
active: [],
|
|
494
|
-
highlighted: [],
|
|
495
|
-
hidden: [],
|
|
496
|
-
error: [],
|
|
497
|
-
};
|
|
498
|
-
selections.active.forEach(function (address) {
|
|
499
|
-
if (address.type === types_2.IElements.WALL)
|
|
500
|
-
wallSelections.active.push(address.index);
|
|
501
|
-
else if (address.type === types_2.IElements.VERTEX)
|
|
502
|
-
verticesSelections.active.push(address.index);
|
|
503
|
-
else if (address.type === types_2.IElements.WINDOW)
|
|
504
|
-
windowSelections.active.push(address.index);
|
|
505
|
-
else if (address.type === types_2.IElements.DOOR)
|
|
506
|
-
doorSelections.active.push(address.index);
|
|
507
|
-
else if (address.type === types_2.IElements.OPENING)
|
|
508
|
-
openingSelections.active.push(address.index);
|
|
509
|
-
});
|
|
510
|
-
selections.highlighted.forEach(function (address) {
|
|
511
|
-
if (address.type === types_2.IElements.WALL)
|
|
512
|
-
wallSelections.highlighted.push(address.index);
|
|
513
|
-
else if (address.type === types_2.IElements.VERTEX)
|
|
514
|
-
verticesSelections.highlighted.push(address.index);
|
|
515
|
-
else if (address.type === types_2.IElements.WINDOW)
|
|
516
|
-
windowSelections.highlighted.push(address.index);
|
|
517
|
-
else if (address.type === types_2.IElements.DOOR)
|
|
518
|
-
doorSelections.highlighted.push(address.index);
|
|
519
|
-
else if (address.type === types_2.IElements.OPENING)
|
|
520
|
-
openingSelections.highlighted.push(address.index);
|
|
521
|
-
});
|
|
522
|
-
selections.hidden.forEach(function (address) {
|
|
523
|
-
if (address.type === types_2.IElements.WALL)
|
|
524
|
-
wallSelections.hidden.push(address.index);
|
|
525
|
-
else if (address.type === types_2.IElements.VERTEX)
|
|
526
|
-
verticesSelections.hidden.push(address.index);
|
|
527
|
-
else if (address.type === types_2.IElements.WINDOW)
|
|
528
|
-
windowSelections.hidden.push(address.index);
|
|
529
|
-
else if (address.type === types_2.IElements.DOOR)
|
|
530
|
-
doorSelections.hidden.push(address.index);
|
|
531
|
-
else if (address.type === types_2.IElements.OPENING)
|
|
532
|
-
openingSelections.hidden.push(address.index);
|
|
533
|
-
});
|
|
534
|
-
selections.error.forEach(function (address) {
|
|
535
|
-
if (address.type === types_2.IElements.WALL)
|
|
536
|
-
wallSelections.error.push(address.index);
|
|
537
|
-
else if (address.type === types_2.IElements.VERTEX)
|
|
538
|
-
verticesSelections.error.push(address.index);
|
|
539
|
-
else if (address.type === types_2.IElements.WINDOW)
|
|
540
|
-
windowSelections.error.push(address.index);
|
|
541
|
-
else if (address.type === types_2.IElements.DOOR)
|
|
542
|
-
doorSelections.error.push(address.index);
|
|
543
|
-
else if (address.type === types_2.IElements.OPENING)
|
|
544
|
-
openingSelections.error.push(address.index);
|
|
545
|
-
});
|
|
546
|
-
drawWalls(canvas, walls, wallSelections, styles.wall);
|
|
547
|
-
drawVertices(canvas, vertices, verticesSelections, styles.vertex);
|
|
548
|
-
if (features[types_2.IElements.WINDOW])
|
|
549
|
-
drawWindows(canvas, walls, features[types_2.IElements.WINDOW] || [], windowSelections, styles);
|
|
550
|
-
if (features[types_2.IElements.DOOR])
|
|
551
|
-
drawDoors(canvas, walls, features[types_2.IElements.DOOR] || [], doorSelections, styles);
|
|
552
|
-
if (features[types_2.IElements.OPENING])
|
|
553
|
-
drawOpenings(canvas, walls, features[types_2.IElements.OPENING] || [], openingSelections, styles);
|
|
554
|
-
}
|
|
555
|
-
exports.drawElements = drawElements;
|
|
556
|
-
function drawRoom(canvas, enclosedSpaces, walls, vertices, features, dimensions, selections, config) {
|
|
557
|
-
var preppedSelections = {
|
|
558
|
-
active: [(selections === null || selections === void 0 ? void 0 : selections.active) || []].flat(),
|
|
559
|
-
highlighted: [(selections === null || selections === void 0 ? void 0 : selections.highlighted) || []].flat(),
|
|
560
|
-
error: [(selections === null || selections === void 0 ? void 0 : selections.error) || []].flat(),
|
|
561
|
-
hidden: [(selections === null || selections === void 0 ? void 0 : selections.hidden) || []].flat(),
|
|
562
|
-
};
|
|
563
|
-
clearCanvas(canvas);
|
|
564
|
-
drawBackground(canvas, config.styles.grid.backgroundColor);
|
|
565
|
-
drawGrid(canvas, config.styles.grid);
|
|
566
|
-
drawFloor(canvas, enclosedSpaces, config.styles.floor);
|
|
567
|
-
drawElements(canvas, walls, vertices, features, preppedSelections, config.styles);
|
|
568
|
-
if (dimensions) {
|
|
569
|
-
drawDimensions(canvas, dimensions, config);
|
|
570
|
-
drawFloorArea(canvas, enclosedSpaces, config.styles.floor);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
exports.drawRoom = drawRoom;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ICoordinate2D, ICoordinatesLine, ICoordinatesQuadrilateral } from './types';
|
|
2
|
-
export declare function euclideanMod(n: number, m: number): number;
|
|
3
|
-
export declare function arePointsEqual(point1: ICoordinate2D, point2: ICoordinate2D): boolean;
|
|
4
|
-
export declare function areLinesEqual(line1: ICoordinatesLine, line2: ICoordinatesLine): boolean;
|
|
5
|
-
export declare function getLineOtherPoint(line: ICoordinatesLine, point: ICoordinate2D): ICoordinate2D;
|
|
6
|
-
export declare function getLengthOfLineSegment(line: ICoordinatesLine): number;
|
|
7
|
-
export declare function getMidpointOfLineSegment(line: ICoordinatesLine): ICoordinate2D;
|
|
8
|
-
export declare function getAngleOfLineSegment(line: ICoordinatesLine): number;
|
|
9
|
-
export declare function getPointAtOffsetOnLineSegment(line: ICoordinatesLine, offset: number): ICoordinate2D;
|
|
10
|
-
export declare function getLineAtOffsetOnLineSegment(line: ICoordinatesLine, offset: number, length: number): ICoordinatesLine;
|
|
11
|
-
export declare function getLineMidpoint(line: ICoordinatesLine): ICoordinate2D;
|
|
12
|
-
export declare function getDistanceToLine(pointOnLine: ICoordinate2D, angle: number, point: ICoordinate2D): number;
|
|
13
|
-
export declare function closestPointOnLine(pointOnLine: ICoordinate2D, angle: number, point: ICoordinate2D): ICoordinate2D;
|
|
14
|
-
export declare function getPolygonArea(polygon: Array<ICoordinate2D>): number;
|
|
15
|
-
export declare function getParallelLineSegmentAtDistance(line: ICoordinatesLine, distance: number): ICoordinatesLine;
|
|
16
|
-
export declare function addThicknessToLine(line: ICoordinatesLine, thickness: number): ICoordinatesQuadrilateral;
|
|
17
|
-
export declare function arePointsWithinProximity(point1: ICoordinate2D, point2: ICoordinate2D, proximity: number): boolean;
|
|
18
|
-
export declare function isPointInQuadrilateral(quadrilateral: ICoordinatesQuadrilateral, point: ICoordinate2D): boolean;
|
|
19
|
-
export declare function isPointInPolygon(point: ICoordinate2D, polygon: Array<ICoordinate2D>): boolean;
|
|
20
|
-
export declare function getLineSegmentsIntersection(line1: ICoordinatesLine, line2: ICoordinatesLine): null | ICoordinate2D;
|
|
21
|
-
export declare function splitLineAtPoint(line: ICoordinatesLine, point: ICoordinate2D): [ICoordinatesLine, ICoordinatesLine];
|
|
22
|
-
export declare function splitLineAtPoints(line: ICoordinatesLine, points: Array<ICoordinate2D>): Array<ICoordinatesLine>;
|
|
23
|
-
export declare function splitLineAtOffset(line: ICoordinatesLine, offset: number): [ICoordinatesLine, ICoordinatesLine];
|
|
24
|
-
export declare function orderCoordinatesOnLineSegment(points?: Array<ICoordinate2D>): Array<ICoordinate2D>;
|
|
25
|
-
export declare function getTangetIntersectionAndOffset(line: ICoordinatesLine, point: ICoordinate2D): undefined | {
|
|
26
|
-
point: ICoordinate2D;
|
|
27
|
-
offset: number;
|
|
28
|
-
};
|
|
29
|
-
export declare function getAllLineIntersections(line: ICoordinatesLine, lines: Array<ICoordinatesLine | null>): {
|
|
30
|
-
index: number;
|
|
31
|
-
point: ICoordinate2D;
|
|
32
|
-
}[];
|
|
33
|
-
export declare function doLinesOverlap(line1: [offset: number, length: number], line2: [offset: number, length: number]): boolean;
|