@threekit-tools/treble 0.0.94 → 0.0.95-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 +3 -3
- package/dist/Treble/index.d.ts +1 -1
- package/dist/Treble/index.js +1 -1
- package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +1 -1
- package/dist/Treble/{snapshots.js → snapshot.js} +1 -1
- package/dist/Treble/wishlist.d.ts +1 -1
- package/dist/Treble/wishlist.js +1 -1
- package/dist/api/assets.js +1 -1
- package/dist/api/catalog.js +1 -1
- package/dist/api/configurations.js +1 -1
- package/dist/api/datatables.js +1 -1
- 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 +1 -1
- 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/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 +1 -1
- package/dist/hooks/useConfigurationLoader/index.js +1 -1
- package/dist/hooks/useConfigurator/index.d.ts +3 -3
- 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 -4
- 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/useShare/index.d.ts +1 -1
- package/dist/hooks/useShare/index.js +1 -1
- package/dist/hooks/useSingleAnimation/index.js +1 -1
- 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 +1816 -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 +411 -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 +625 -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/useSpaces/types.js +54 -0
- 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/hooks/useWishlist/index.d.ts +1 -1
- package/dist/hooks/useZoom/index.d.ts +1 -1
- package/dist/http/assets.d.ts +1 -1
- package/dist/http/orders.d.ts +1 -1
- package/dist/icons/AngleSnapping.d.ts +3 -0
- package/dist/icons/AngleSnapping.js +28 -0
- package/dist/icons/Boundary.d.ts +3 -0
- package/dist/icons/Boundary.js +21 -0
- package/dist/icons/Center.d.ts +3 -0
- package/dist/icons/Center.js +24 -0
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/GridSnapping.d.ts +3 -0
- package/dist/icons/GridSnapping.js +28 -0
- package/dist/icons/LayoutAlt.d.ts +3 -0
- package/dist/icons/LayoutAlt.js +21 -0
- package/dist/icons/Magnet.d.ts +3 -0
- package/dist/icons/Magnet.js +27 -0
- 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/Save.d.ts +3 -0
- package/dist/icons/Save.js +21 -0
- package/dist/icons/Spinner.d.ts +2 -2
- package/dist/icons/UnitCm.d.ts +3 -0
- package/dist/icons/UnitCm.js +22 -0
- package/dist/icons/UnitFeet.d.ts +3 -0
- package/dist/icons/UnitFeet.js +22 -0
- package/dist/icons/UnitInch.d.ts +3 -0
- package/dist/icons/UnitInch.js +22 -0
- package/dist/icons/UnitMeter.d.ts +3 -0
- package/dist/icons/UnitMeter.js +21 -0
- package/dist/icons/Window.js +4 -4
- package/dist/icons/index.js +28 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +35 -5
- package/dist/store/attributes.d.ts +4 -3
- package/dist/store/attributes.js +1 -1
- package/dist/store/index.d.ts +43 -12
- package/dist/store/index.js +3 -1
- 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 +5 -8
- package/dist/store/spaces.d.ts +74 -0
- package/dist/store/spaces.js +354 -0
- package/dist/store/translations.d.ts +1 -1
- package/dist/store/translations.js +1 -1
- package/dist/store/treble.d.ts +2 -2
- package/dist/store/treble.js +15 -22
- package/dist/store/wishlist.d.ts +4 -22
- package/dist/store/wishlist.js +1 -1
- package/dist/types.d.ts +20 -18
- package/dist/types.js +9 -9
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +3 -3
- package/package.json +1 -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/types.js +0 -36
- package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
- package/dist/hooks/useRoomBuilder/validators.js +0 -362
- /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
|
@@ -1,362 +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.runValidators = exports.isVertexLandingOnFeature = exports.areWallsDuplicated = exports.areWallsOrphaningFeatures = exports.areWallsIntersecting = exports.areWallsTooShort = exports.isFeatureCollidingWithExistingFeature = exports.isFeatureOutsideWallBounds = exports.isWallEndingOnFeature = exports.isWallOverlappingExisitingWalls = exports.isWallIntersectingFeature = exports.isWallTooShort = void 0;
|
|
13
|
-
var types_1 = require("./types");
|
|
14
|
-
var geometry_1 = require("./geometry");
|
|
15
|
-
var messaging_1 = require("./messaging");
|
|
16
|
-
var constants_1 = require("./constants");
|
|
17
|
-
function isLineTooShort(wallOrLine) {
|
|
18
|
-
var minLength = constants_1.MIN_WALL_LENGTH;
|
|
19
|
-
var line = Array.isArray(wallOrLine) ? wallOrLine : wallOrLine.line;
|
|
20
|
-
var tooClose = geometry_1.arePointsWithinProximity.apply(void 0, __spreadArray(__spreadArray([], line, false), [minLength], false));
|
|
21
|
-
if (tooClose)
|
|
22
|
-
return {
|
|
23
|
-
message: messaging_1.errorMessages.wallTooShort(),
|
|
24
|
-
type: types_1.IErrorTypes.HARD,
|
|
25
|
-
};
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
function isWallTooShort(input) {
|
|
29
|
-
return isLineTooShort(input.newWall.line);
|
|
30
|
-
}
|
|
31
|
-
exports.isWallTooShort = isWallTooShort;
|
|
32
|
-
function isWallIntersectingFeature(input) {
|
|
33
|
-
var _a;
|
|
34
|
-
var newWall = input.newWall, walls = input.walls, features = input.features;
|
|
35
|
-
if (!walls.length || !Object.values(features).flat().length)
|
|
36
|
-
return false;
|
|
37
|
-
var intersectingFeature;
|
|
38
|
-
for (var i = 0; i < walls.length && !intersectingFeature; i++) {
|
|
39
|
-
if (!walls[i].connections)
|
|
40
|
-
continue;
|
|
41
|
-
var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(newWall.line, walls[i].line);
|
|
42
|
-
if (!intersectionPoint)
|
|
43
|
-
continue;
|
|
44
|
-
var intersectionOffset = (0, geometry_1.getLengthOfLineSegment)([
|
|
45
|
-
walls[i].line[0],
|
|
46
|
-
intersectionPoint,
|
|
47
|
-
]);
|
|
48
|
-
for (var j = 0; j < walls[i].connections.length && !intersectingFeature; j++) {
|
|
49
|
-
var _b = walls[i].connections[j], type = _b[0], index = _b[1];
|
|
50
|
-
var feature = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
|
|
51
|
-
if (!feature)
|
|
52
|
-
continue;
|
|
53
|
-
if (feature.offset < intersectionOffset &&
|
|
54
|
-
intersectionOffset < feature.offset + feature.length)
|
|
55
|
-
intersectingFeature = { type: type, index: index };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (!intersectingFeature)
|
|
59
|
-
return false;
|
|
60
|
-
return ({
|
|
61
|
-
address: intersectingFeature,
|
|
62
|
-
message: messaging_1.errorMessages.addWallCollidingWithFeature(intersectingFeature.type),
|
|
63
|
-
type: types_1.IErrorTypes.SOFT,
|
|
64
|
-
} || false);
|
|
65
|
-
}
|
|
66
|
-
exports.isWallIntersectingFeature = isWallIntersectingFeature;
|
|
67
|
-
function isWallOverlappingExisitingWalls(input) {
|
|
68
|
-
var newWall = input.newWall, walls = input.walls;
|
|
69
|
-
var snapStartTo = newWall.snapStartTo, snapEndTo = newWall.snapEndTo;
|
|
70
|
-
if ((snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.WALL &&
|
|
71
|
-
(snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.WALL &&
|
|
72
|
-
snapStartTo.index === snapEndTo.index) {
|
|
73
|
-
return {
|
|
74
|
-
address: {
|
|
75
|
-
type: types_1.IElements.WALL,
|
|
76
|
-
index: snapStartTo.index,
|
|
77
|
-
},
|
|
78
|
-
type: types_1.IErrorTypes.SOFT,
|
|
79
|
-
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
var overlappingIndex = walls.findIndex(function (wall, i) {
|
|
83
|
-
var line = wall.line;
|
|
84
|
-
if ((0, geometry_1.areLinesEqual)(line, newWall.line))
|
|
85
|
-
return true;
|
|
86
|
-
if ((snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.VERTEX &&
|
|
87
|
-
((0, geometry_1.arePointsEqual)(snapStartTo.point, line[0]) ||
|
|
88
|
-
(0, geometry_1.arePointsEqual)(snapStartTo.point, line[1])) &&
|
|
89
|
-
(snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.WALL &&
|
|
90
|
-
snapEndTo.index === i) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
if ((snapEndTo === null || snapEndTo === void 0 ? void 0 : snapEndTo.type) === types_1.IElements.VERTEX &&
|
|
94
|
-
((0, geometry_1.arePointsEqual)(snapEndTo.point, line[0]) ||
|
|
95
|
-
(0, geometry_1.arePointsEqual)(snapEndTo.point, line[1])) &&
|
|
96
|
-
(snapStartTo === null || snapStartTo === void 0 ? void 0 : snapStartTo.type) === types_1.IElements.WALL &&
|
|
97
|
-
snapStartTo.index === i) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
});
|
|
102
|
-
if (overlappingIndex !== -1) {
|
|
103
|
-
return {
|
|
104
|
-
address: {
|
|
105
|
-
type: types_1.IElements.WALL,
|
|
106
|
-
index: overlappingIndex,
|
|
107
|
-
},
|
|
108
|
-
type: types_1.IErrorTypes.SOFT,
|
|
109
|
-
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
exports.isWallOverlappingExisitingWalls = isWallOverlappingExisitingWalls;
|
|
115
|
-
function isWallEndingOnFeature(input) {
|
|
116
|
-
var snapPoint = input.newWall.snapEndTo;
|
|
117
|
-
if (!snapPoint)
|
|
118
|
-
return false;
|
|
119
|
-
if (snapPoint.type === types_1.IElements.WINDOW ||
|
|
120
|
-
snapPoint.type === types_1.IElements.DOOR ||
|
|
121
|
-
snapPoint.type === types_1.IElements.OPENING)
|
|
122
|
-
return {
|
|
123
|
-
address: snapPoint,
|
|
124
|
-
message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
|
|
125
|
-
type: types_1.IErrorTypes.SOFT,
|
|
126
|
-
};
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
exports.isWallEndingOnFeature = isWallEndingOnFeature;
|
|
130
|
-
function isFeatureOutsideWallBounds(input) {
|
|
131
|
-
var wall = input.wall, updatedFeature = input.updatedFeature;
|
|
132
|
-
var padding = constants_1.WALL_PADDING_FOR_FEATURE;
|
|
133
|
-
var wallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
|
|
134
|
-
if (updatedFeature.offset < padding ||
|
|
135
|
-
updatedFeature.offset + updatedFeature.length > wallLength - padding)
|
|
136
|
-
return {
|
|
137
|
-
address: updatedFeature.address,
|
|
138
|
-
type: types_1.IErrorTypes.HARD,
|
|
139
|
-
message: messaging_1.errorMessages.featureOutsideWallBounds(),
|
|
140
|
-
};
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
exports.isFeatureOutsideWallBounds = isFeatureOutsideWallBounds;
|
|
144
|
-
function isFeatureCollidingWithExistingFeature(input) {
|
|
145
|
-
var _a, _b;
|
|
146
|
-
var features = input.features, wall = input.wall, updatedFeature = input.updatedFeature;
|
|
147
|
-
if (!features || !((_a = wall.connections) === null || _a === void 0 ? void 0 : _a.length))
|
|
148
|
-
return false;
|
|
149
|
-
if (!Object.values(updatedFeature).flat().length)
|
|
150
|
-
return false;
|
|
151
|
-
for (var i = 0; i < wall.connections.length; i++) {
|
|
152
|
-
var _c = wall.connections[i], type = _c[0], index = _c[1];
|
|
153
|
-
if (updatedFeature.address.type === type &&
|
|
154
|
-
updatedFeature.address.index === index)
|
|
155
|
-
continue;
|
|
156
|
-
var existingFeature = (_b = features[type]) === null || _b === void 0 ? void 0 : _b[index];
|
|
157
|
-
if (!existingFeature)
|
|
158
|
-
continue;
|
|
159
|
-
if ((0, geometry_1.doLinesOverlap)([updatedFeature.offset, updatedFeature.length], [existingFeature.offset, existingFeature.length]))
|
|
160
|
-
return {
|
|
161
|
-
address: { type: type, index: index },
|
|
162
|
-
type: types_1.IErrorTypes.SOFT,
|
|
163
|
-
message: messaging_1.errorMessages.featuresColliding(type),
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
exports.isFeatureCollidingWithExistingFeature = isFeatureCollidingWithExistingFeature;
|
|
169
|
-
function areWallsTooShort(input) {
|
|
170
|
-
var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
171
|
-
var _a = vertex.connections.reduce(function (output, connection) {
|
|
172
|
-
var _a;
|
|
173
|
-
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
174
|
-
output.wallIndexes.push(wallIndex);
|
|
175
|
-
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
176
|
-
_a[wallIndex] = vertexIndex,
|
|
177
|
-
_a));
|
|
178
|
-
return output;
|
|
179
|
-
}, {
|
|
180
|
-
wallIndexes: [],
|
|
181
|
-
updatedVerticesMap: {},
|
|
182
|
-
}), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
|
|
183
|
-
for (var _i = 0, wallIndexes_1 = wallIndexes; _i < wallIndexes_1.length; _i++) {
|
|
184
|
-
var index = wallIndexes_1[_i];
|
|
185
|
-
var line = walls[index].line;
|
|
186
|
-
line[updatedVerticesMap[index]] = updatedPosition.point;
|
|
187
|
-
if (isLineTooShort(line))
|
|
188
|
-
return {
|
|
189
|
-
address: { type: types_1.IElements.WALL, index: index },
|
|
190
|
-
message: messaging_1.errorMessages.wallTooShort(),
|
|
191
|
-
type: types_1.IErrorTypes.HARD,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
exports.areWallsTooShort = areWallsTooShort;
|
|
197
|
-
function areWallsIntersecting(input) {
|
|
198
|
-
var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
199
|
-
var _a = vertex.connections.reduce(function (output, connection) {
|
|
200
|
-
var _a;
|
|
201
|
-
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
202
|
-
output.wallIndexes.add(wallIndex);
|
|
203
|
-
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
204
|
-
_a[wallIndex] = vertexIndex,
|
|
205
|
-
_a));
|
|
206
|
-
return output;
|
|
207
|
-
}, {
|
|
208
|
-
wallIndexes: new Set([]),
|
|
209
|
-
updatedVerticesMap: {},
|
|
210
|
-
}), wallIndexes = _a.wallIndexes, updatedVerticesMap = _a.updatedVerticesMap;
|
|
211
|
-
for (var _i = 0, _b = Array.from(wallIndexes); _i < _b.length; _i++) {
|
|
212
|
-
var validateWallIndex = _b[_i];
|
|
213
|
-
var line = walls[validateWallIndex].line;
|
|
214
|
-
line[updatedVerticesMap[validateWallIndex]] = updatedPosition.point;
|
|
215
|
-
for (var i = 0; i < walls.length; i++) {
|
|
216
|
-
if (wallIndexes.has(i))
|
|
217
|
-
continue;
|
|
218
|
-
var wall = walls[i];
|
|
219
|
-
if (!wall)
|
|
220
|
-
continue;
|
|
221
|
-
var intersectionPoint = (0, geometry_1.getLineSegmentsIntersection)(line, wall.line);
|
|
222
|
-
if (intersectionPoint)
|
|
223
|
-
return {
|
|
224
|
-
address: { type: types_1.IElements.WALL, index: i },
|
|
225
|
-
message: messaging_1.errorMessages.addWallCollidingWithWall(),
|
|
226
|
-
type: types_1.IErrorTypes.SOFT,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
exports.areWallsIntersecting = areWallsIntersecting;
|
|
233
|
-
function areWallsOrphaningFeatures(input) {
|
|
234
|
-
var _a;
|
|
235
|
-
var walls = input.walls, vertex = input.vertex, features = input.features, updatedPosition = input.updatedPosition;
|
|
236
|
-
var _b = vertex.connections.reduce(function (output, connection) {
|
|
237
|
-
var _a;
|
|
238
|
-
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
239
|
-
output.wallIndexes.add(wallIndex);
|
|
240
|
-
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
241
|
-
_a[wallIndex] = vertexIndex,
|
|
242
|
-
_a));
|
|
243
|
-
return output;
|
|
244
|
-
}, {
|
|
245
|
-
wallIndexes: new Set([]),
|
|
246
|
-
updatedVerticesMap: {},
|
|
247
|
-
}), wallIndexes = _b.wallIndexes, updatedVerticesMap = _b.updatedVerticesMap;
|
|
248
|
-
for (var _i = 0, _c = Array.from(wallIndexes); _i < _c.length; _i++) {
|
|
249
|
-
var wallIdx = _c[_i];
|
|
250
|
-
var wall = walls[wallIdx];
|
|
251
|
-
if (!wall.connections.length)
|
|
252
|
-
continue;
|
|
253
|
-
var updatedLine = JSON.parse(JSON.stringify(wall.line));
|
|
254
|
-
updatedLine[updatedVerticesMap[wallIdx]] = updatedPosition.point;
|
|
255
|
-
var currentWallLength = (0, geometry_1.getLengthOfLineSegment)(wall.line);
|
|
256
|
-
var updatedWallLength = (0, geometry_1.getLengthOfLineSegment)(updatedLine);
|
|
257
|
-
var wallLengthDelta = updatedWallLength - currentWallLength;
|
|
258
|
-
for (var i = 0; i < wall.connections.length; i++) {
|
|
259
|
-
var _d = wall.connections[i], type = _d[0], index = _d[1];
|
|
260
|
-
var feat = (_a = features[type]) === null || _a === void 0 ? void 0 : _a[index];
|
|
261
|
-
if (!feat)
|
|
262
|
-
continue;
|
|
263
|
-
var error = {
|
|
264
|
-
address: { type: type, index: index },
|
|
265
|
-
message: 'feature collision',
|
|
266
|
-
type: types_1.IErrorTypes.HARD,
|
|
267
|
-
};
|
|
268
|
-
if (updatedVerticesMap[wallIdx] === 0 &&
|
|
269
|
-
feat.offset - wallLengthDelta < constants_1.WALL_PADDING_FOR_FEATURE)
|
|
270
|
-
return error;
|
|
271
|
-
else if (feat.offset + feat.length >
|
|
272
|
-
updatedWallLength - constants_1.WALL_PADDING_FOR_FEATURE) {
|
|
273
|
-
return error;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
exports.areWallsOrphaningFeatures = areWallsOrphaningFeatures;
|
|
280
|
-
function areWallsDuplicated(input) {
|
|
281
|
-
var _a, _b, _c;
|
|
282
|
-
var walls = input.walls, vertex = input.vertex, updatedPosition = input.updatedPosition;
|
|
283
|
-
var point = (_b = (_a = updatedPosition.snapTo) === null || _a === void 0 ? void 0 : _a.point) !== null && _b !== void 0 ? _b : updatedPosition.point;
|
|
284
|
-
var _d = vertex.connections.reduce(function (output, connection) {
|
|
285
|
-
var _a;
|
|
286
|
-
var wallIndex = connection[0], vertexIndex = connection[1];
|
|
287
|
-
output.wallIndexes.add(wallIndex);
|
|
288
|
-
output.updatedVerticesMap = Object.assign(output.updatedVerticesMap, (_a = {},
|
|
289
|
-
_a[wallIndex] = vertexIndex,
|
|
290
|
-
_a));
|
|
291
|
-
return output;
|
|
292
|
-
}, {
|
|
293
|
-
wallIndexes: new Set([]),
|
|
294
|
-
updatedVerticesMap: {},
|
|
295
|
-
}), wallIndexes = _d.wallIndexes, updatedVerticesMap = _d.updatedVerticesMap;
|
|
296
|
-
for (var _i = 0, _e = Array.from(wallIndexes); _i < _e.length; _i++) {
|
|
297
|
-
var wallIdx = _e[_i];
|
|
298
|
-
var wall = walls[wallIdx];
|
|
299
|
-
var updatedLine = JSON.parse(JSON.stringify(wall.line));
|
|
300
|
-
updatedLine[updatedVerticesMap[wallIdx]] = point;
|
|
301
|
-
if (((_c = updatedPosition.snapTo) === null || _c === void 0 ? void 0 : _c.type) === types_1.IElements.WALL &&
|
|
302
|
-
updatedPosition.snapTo.index !== wallIdx) {
|
|
303
|
-
var _f = walls[updatedPosition.snapTo.index].line, xTest = _f[0], yTest = _f[1];
|
|
304
|
-
var unmovedPoint = updatedLine[updatedVerticesMap[wallIdx] === 1 ? 0 : 1];
|
|
305
|
-
if ((0, geometry_1.arePointsEqual)(unmovedPoint, xTest) ||
|
|
306
|
-
(0, geometry_1.arePointsEqual)(unmovedPoint, yTest))
|
|
307
|
-
return {
|
|
308
|
-
address: {
|
|
309
|
-
type: types_1.IElements.WALL,
|
|
310
|
-
index: updatedPosition.snapTo.index,
|
|
311
|
-
},
|
|
312
|
-
type: types_1.IErrorTypes.SOFT,
|
|
313
|
-
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
for (var i = 0; i < walls.length; i++) {
|
|
317
|
-
if (wallIdx === i)
|
|
318
|
-
continue;
|
|
319
|
-
var existingWall = walls[i];
|
|
320
|
-
var error = {
|
|
321
|
-
address: { type: types_1.IElements.WALL, index: i },
|
|
322
|
-
type: types_1.IErrorTypes.SOFT,
|
|
323
|
-
message: messaging_1.errorMessages.wallsNotUnique(),
|
|
324
|
-
};
|
|
325
|
-
if (((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[0]) &&
|
|
326
|
-
(0, geometry_1.arePointsEqual)(existingWall[1], wall.line[1])) ||
|
|
327
|
-
((0, geometry_1.arePointsEqual)(existingWall[0], wall.line[1]) &&
|
|
328
|
-
(0, geometry_1.arePointsEqual)(existingWall[1], wall.line[0]))) {
|
|
329
|
-
return error;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
exports.areWallsDuplicated = areWallsDuplicated;
|
|
336
|
-
function isVertexLandingOnFeature(input) {
|
|
337
|
-
var snapPoint = input.updatedPosition.snapTo;
|
|
338
|
-
if (!snapPoint)
|
|
339
|
-
return false;
|
|
340
|
-
if (snapPoint.type === types_1.IElements.WINDOW ||
|
|
341
|
-
snapPoint.type === types_1.IElements.DOOR ||
|
|
342
|
-
snapPoint.type === types_1.IElements.OPENING)
|
|
343
|
-
return {
|
|
344
|
-
address: snapPoint,
|
|
345
|
-
message: messaging_1.errorMessages.addWallCollidingWithFeature(snapPoint.type),
|
|
346
|
-
type: types_1.IErrorTypes.SOFT,
|
|
347
|
-
};
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
exports.isVertexLandingOnFeature = isVertexLandingOnFeature;
|
|
351
|
-
function runValidators(validators, input) {
|
|
352
|
-
var errors = validators.reduce(function (output, validate) {
|
|
353
|
-
var error = validate(input);
|
|
354
|
-
if (error)
|
|
355
|
-
output.push(error);
|
|
356
|
-
return output;
|
|
357
|
-
}, []);
|
|
358
|
-
if (errors.length)
|
|
359
|
-
return errors;
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
exports.runValidators = runValidators;
|
|
File without changes
|