@threekit-tools/treble 0.0.90-next-09 → 0.0.91
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/{useSpaces → useRoomBuilder}/dataHandlers.d.ts +4 -6
- package/dist/hooks/{useSpaces → useRoomBuilder}/dataHandlers.js +40 -102
- 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 +9 -14
- 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/{useSpaces → useRoomBuilder}/types.d.ts +35 -130
- package/dist/hooks/{useSpaces → useRoomBuilder}/types.js +1 -13
- package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
- package/dist/hooks/useRoomBuilder/validators.js +362 -0
- package/dist/hooks/useSpaces/Canvas.d.ts +37 -0
- package/dist/hooks/useSpaces/Canvas.js +199 -0
- package/dist/icons/AngleSnapping.d.ts +3 -0
- package/dist/icons/AngleSnapping.js +28 -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/Save.d.ts +3 -0
- package/dist/icons/Save.js +21 -0
- 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 +0 -2
- package/dist/icons/types.d.ts +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +5 -9
- 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/treble.js +17 -21
- package/dist/types.d.ts +3 -5
- 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 -162
- package/dist/hooks/useSpaces/SpacesState.js +0 -1759
- package/dist/hooks/useSpaces/constants.d.ts +0 -44
- package/dist/hooks/useSpaces/constants.js +0 -105
- 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 -93
- package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawGrid.js +0 -33
- package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
- package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
- package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
- package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
- package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
- package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -10
- package/dist/hooks/useSpaces/draw/drawWalls.js +0 -64
- 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 -76
- package/dist/hooks/useSpaces/index.js +0 -474
- 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/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/Player3D.d.ts +0 -3
- package/dist/icons/Player3D.js +0 -21
- package/dist/store/spaces.d.ts +0 -47
- package/dist/store/spaces.js +0 -197
- /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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare enum IWallAttributes {
|
|
2
|
+
START_X = "Start X",
|
|
3
|
+
START_Z = "Start Z",
|
|
4
|
+
END_X = "End X",
|
|
5
|
+
END_Z = "End Z",
|
|
6
|
+
HEIGHT = "Height",
|
|
7
|
+
THICKNESS = "Thickness",
|
|
8
|
+
CONNECTIONS = "Connections"
|
|
9
|
+
}
|
|
10
|
+
export declare enum IFeatureAttribute {
|
|
11
|
+
POSITION_X = "Start X",
|
|
12
|
+
POSITION_Y = "Start Y",
|
|
13
|
+
POSITION_Z = "Start Z",
|
|
14
|
+
HEIGHT = "Height",
|
|
15
|
+
LENGTH = "Length",
|
|
16
|
+
CONNECTED_TO = "Connected To"
|
|
17
|
+
}
|
|
18
|
+
export declare const SCALE = 0.02;
|
|
19
|
+
export declare const SNAP_PROXIMITY = 10;
|
|
20
|
+
export declare const MIN_WALL_LENGTH = 50;
|
|
21
|
+
export declare const WALL_PADDING_FOR_FEATURE = 20;
|
|
22
|
+
export declare const UNIT_LABELS: {
|
|
23
|
+
feet: string;
|
|
24
|
+
meter: string;
|
|
25
|
+
inch: string;
|
|
26
|
+
cm: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const UNIT_FACTORS: {
|
|
29
|
+
cm: number;
|
|
30
|
+
meter: number;
|
|
31
|
+
feet: number;
|
|
32
|
+
inch: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const FEATURE_LABELS: {
|
|
35
|
+
windows: string;
|
|
36
|
+
doors: string;
|
|
37
|
+
openings: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const FEATURE_LENGTH = 120;
|
|
40
|
+
export declare const UI_ANCHOR_DISTANCE = -60;
|
|
41
|
+
export declare const WALL_SNAP_DISTANCE = 12;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b, _c;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.WALL_SNAP_DISTANCE = exports.UI_ANCHOR_DISTANCE = exports.FEATURE_LENGTH = exports.FEATURE_LABELS = exports.UNIT_FACTORS = exports.UNIT_LABELS = exports.WALL_PADDING_FOR_FEATURE = exports.MIN_WALL_LENGTH = exports.SNAP_PROXIMITY = exports.SCALE = exports.IFeatureAttribute = exports.IWallAttributes = void 0;
|
|
5
|
+
var types_1 = require("./types");
|
|
6
|
+
var IWallAttributes;
|
|
7
|
+
(function (IWallAttributes) {
|
|
8
|
+
IWallAttributes["START_X"] = "Start X";
|
|
9
|
+
IWallAttributes["START_Z"] = "Start Z";
|
|
10
|
+
IWallAttributes["END_X"] = "End X";
|
|
11
|
+
IWallAttributes["END_Z"] = "End Z";
|
|
12
|
+
IWallAttributes["HEIGHT"] = "Height";
|
|
13
|
+
IWallAttributes["THICKNESS"] = "Thickness";
|
|
14
|
+
IWallAttributes["CONNECTIONS"] = "Connections";
|
|
15
|
+
})(IWallAttributes = exports.IWallAttributes || (exports.IWallAttributes = {}));
|
|
16
|
+
var IFeatureAttribute;
|
|
17
|
+
(function (IFeatureAttribute) {
|
|
18
|
+
IFeatureAttribute["POSITION_X"] = "Start X";
|
|
19
|
+
IFeatureAttribute["POSITION_Y"] = "Start Y";
|
|
20
|
+
IFeatureAttribute["POSITION_Z"] = "Start Z";
|
|
21
|
+
IFeatureAttribute["HEIGHT"] = "Height";
|
|
22
|
+
IFeatureAttribute["LENGTH"] = "Length";
|
|
23
|
+
IFeatureAttribute["CONNECTED_TO"] = "Connected To";
|
|
24
|
+
})(IFeatureAttribute = exports.IFeatureAttribute || (exports.IFeatureAttribute = {}));
|
|
25
|
+
exports.SCALE = 0.02;
|
|
26
|
+
exports.SNAP_PROXIMITY = 10;
|
|
27
|
+
exports.MIN_WALL_LENGTH = 50;
|
|
28
|
+
exports.WALL_PADDING_FOR_FEATURE = 20;
|
|
29
|
+
exports.UNIT_LABELS = (_a = {},
|
|
30
|
+
_a[types_1.IUnits.FEET] = 'ft',
|
|
31
|
+
_a[types_1.IUnits.METER] = 'm',
|
|
32
|
+
_a[types_1.IUnits.INCH] = 'in',
|
|
33
|
+
_a[types_1.IUnits.CM] = 'cm',
|
|
34
|
+
_a);
|
|
35
|
+
exports.UNIT_FACTORS = (_b = {},
|
|
36
|
+
_b[types_1.IUnits.CM] = 100,
|
|
37
|
+
_b[types_1.IUnits.METER] = 1,
|
|
38
|
+
_b[types_1.IUnits.FEET] = 3.28084,
|
|
39
|
+
_b[types_1.IUnits.INCH] = 39.37,
|
|
40
|
+
_b);
|
|
41
|
+
exports.FEATURE_LABELS = (_c = {},
|
|
42
|
+
_c[types_1.IElements.WINDOW] = 'Window',
|
|
43
|
+
_c[types_1.IElements.DOOR] = 'Door',
|
|
44
|
+
_c[types_1.IElements.OPENING] = 'Opening',
|
|
45
|
+
_c);
|
|
46
|
+
exports.FEATURE_LENGTH = 120;
|
|
47
|
+
exports.UI_ANCHOR_DISTANCE = -60;
|
|
48
|
+
exports.WALL_SNAP_DISTANCE = 12;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { IWalls,
|
|
1
|
+
import type { IWalls, IRoomBuilderStateProps, IVerticesState, IFeatures } from './types';
|
|
2
2
|
import { IUnits } from './types';
|
|
3
3
|
import type { IConfiguration, IHydratedAttribute } from '../../types';
|
|
4
|
-
export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config:
|
|
5
|
-
|
|
6
|
-
features: {};
|
|
4
|
+
export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: IRoomBuilderStateProps): {
|
|
5
|
+
features: IFeatures;
|
|
7
6
|
walls: IWalls;
|
|
8
7
|
vertex: IVerticesState;
|
|
9
8
|
};
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: ISpacesStateProps): {
|
|
9
|
+
export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: IRoomBuilderStateProps): {
|
|
12
10
|
[x: string]: import("../../types").IConfigurationAttribute | {
|
|
13
11
|
assetId: string;
|
|
14
12
|
configuration: IConfiguration;
|
|
@@ -11,21 +11,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.prepAreaForUser = exports.prepLengthForUser = exports.convertAreaUnit = exports.convertLengthUnit = exports.prepAttributesOutgoing = exports.
|
|
14
|
+
exports.prepAreaForUser = exports.prepLengthForUser = exports.convertAreaUnit = exports.convertLengthUnit = exports.prepAttributesOutgoing = exports.prepAttributesIncoming = void 0;
|
|
15
15
|
var types_1 = require("./types");
|
|
16
16
|
var constants_1 = require("./constants");
|
|
17
17
|
var geometry_1 = require("./geometry");
|
|
18
|
-
function filterRestConfiguration(configuration, attributeNames) {
|
|
19
|
-
var keysToFilter = new Set(Object.values(attributeNames));
|
|
20
|
-
var filteredConfiguration = Object.entries(configuration).reduce(function (output, _a) {
|
|
21
|
-
var _b;
|
|
22
|
-
var key = _a[0], value = _a[1];
|
|
23
|
-
if (keysToFilter.has(key))
|
|
24
|
-
return output;
|
|
25
|
-
return Object.assign(output, (_b = {}, _b[key] = value, _b));
|
|
26
|
-
}, {});
|
|
27
|
-
return filteredConfiguration;
|
|
28
|
-
}
|
|
29
18
|
function prepConnectionOutgoing(connection) {
|
|
30
19
|
return "".concat(connection[0], ".").concat(connection[1]);
|
|
31
20
|
}
|
|
@@ -37,16 +26,15 @@ function prepWallsAndVerticesIncoming(wallsAttribute, config) {
|
|
|
37
26
|
var _a;
|
|
38
27
|
var walls = [];
|
|
39
28
|
var vertices = {};
|
|
40
|
-
var attributeName = config.attributes;
|
|
41
29
|
((wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.value) || []).forEach(function (_a, i) {
|
|
42
30
|
var assetId = _a.assetId, configuration = _a.configuration;
|
|
43
31
|
var point1 = [
|
|
44
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
45
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
32
|
+
(configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.START_X]) / config.config.scale,
|
|
33
|
+
(configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.START_Z]) / config.config.scale,
|
|
46
34
|
];
|
|
47
35
|
var point2 = [
|
|
48
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
49
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
36
|
+
(configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.END_X]) / config.config.scale,
|
|
37
|
+
(configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.END_Z]) / config.config.scale,
|
|
50
38
|
];
|
|
51
39
|
var point1Str = JSON.stringify(point1);
|
|
52
40
|
var point2Str = JSON.stringify(point2);
|
|
@@ -63,119 +51,66 @@ function prepWallsAndVerticesIncoming(wallsAttribute, config) {
|
|
|
63
51
|
assetId: assetId,
|
|
64
52
|
line: [point1, point2],
|
|
65
53
|
path: (0, geometry_1.addThicknessToLine)([point1, point2], config.config.styles.wall.thickness),
|
|
54
|
+
height: configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.HEIGHT],
|
|
55
|
+
thickness: configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IWallAttributes.THICKNESS],
|
|
66
56
|
connections: connections,
|
|
67
|
-
restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
|
|
68
57
|
});
|
|
69
58
|
});
|
|
70
59
|
return _a = {}, _a[types_1.IElements.WALL] = walls, _a[types_1.IElements.VERTEX] = vertices, _a;
|
|
71
60
|
}
|
|
72
|
-
function
|
|
73
|
-
var _a, _b;
|
|
74
|
-
var metadata = (wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.values[0].metadata) || {};
|
|
75
|
-
var validation = {
|
|
76
|
-
minLength: ((_a = metadata[constants_1.WallMetadata.MIN_LENGTH]) !== null && _a !== void 0 ? _a : constants_1.VALIDATION_CONFIG_DEFAULT.minLength) / config.config.scale,
|
|
77
|
-
padding: ((_b = metadata[constants_1.WallMetadata.PADDING]) !== null && _b !== void 0 ? _b : constants_1.VALIDATION_CONFIG_DEFAULT.padding) / config.config.scale,
|
|
78
|
-
};
|
|
79
|
-
return validation;
|
|
80
|
-
}
|
|
81
|
-
function prepFeatureIncoming(type, walls, featureAttribute, config) {
|
|
61
|
+
function prepFeatureIncoming(walls, featureAttribute, config) {
|
|
82
62
|
var _a;
|
|
83
|
-
var attributeName = config.attributes;
|
|
84
63
|
var feature = [];
|
|
85
64
|
(_a = featureAttribute === null || featureAttribute === void 0 ? void 0 : featureAttribute.value) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
|
|
86
65
|
var assetId = _a.assetId, configuration = _a.configuration;
|
|
87
|
-
var offset = (configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
88
|
-
var length = (configuration === null || configuration === void 0 ? void 0 : configuration[
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
var connectedTo = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureConnectedTo]) || '';
|
|
66
|
+
var offset = (configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IFeatureAttribute.POSITION_X]) / config.config.scale;
|
|
67
|
+
var length = (configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IFeatureAttribute.LENGTH]) / config.config.scale ||
|
|
68
|
+
constants_1.FEATURE_LENGTH;
|
|
69
|
+
var connectedTo = (configuration === null || configuration === void 0 ? void 0 : configuration[constants_1.IFeatureAttribute.CONNECTED_TO]) || '';
|
|
92
70
|
var wallIndex = prepConnectionIncoming(connectedTo)[1];
|
|
93
71
|
var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(walls[wallIndex].line, offset, length);
|
|
94
|
-
var
|
|
72
|
+
var path = (0, geometry_1.addThicknessToLine)(featureLine, config.config.styles.feature.thickness);
|
|
73
|
+
feature.push({
|
|
95
74
|
assetId: assetId,
|
|
96
75
|
offset: offset,
|
|
97
76
|
length: length,
|
|
98
|
-
|
|
99
|
-
altitude: altitude,
|
|
77
|
+
path: path,
|
|
100
78
|
connectedTo: [types_1.IElements.WALL, wallIndex],
|
|
101
|
-
|
|
102
|
-
restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
|
|
103
|
-
};
|
|
104
|
-
if (type === types_1.IElements.DOOR) {
|
|
105
|
-
element.orientation =
|
|
106
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.doorOrientation]) || constants_1.DoorOrientations.LEFT;
|
|
107
|
-
element.openingDirection =
|
|
108
|
-
(configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.doorOpeningDirection]) ||
|
|
109
|
-
constants_1.DoorOpeningDirections.INSIDE;
|
|
110
|
-
}
|
|
111
|
-
feature.push(element);
|
|
79
|
+
});
|
|
112
80
|
});
|
|
113
81
|
return feature;
|
|
114
82
|
}
|
|
115
83
|
function prepAttributesIncoming(attributes, config) {
|
|
116
84
|
var _a;
|
|
117
|
-
var
|
|
118
|
-
var wallsAndVertices = prepWallsAndVerticesIncoming(
|
|
119
|
-
var wallsValidation = getWallsVaidationConfig(wallsAttribute, config);
|
|
120
|
-
var featuresList = [
|
|
121
|
-
types_1.IElements.WINDOW,
|
|
122
|
-
types_1.IElements.DOOR,
|
|
123
|
-
types_1.IElements.OPENING,
|
|
124
|
-
];
|
|
85
|
+
var featuresList = [types_1.IElements.WINDOW, types_1.IElements.DOOR, types_1.IElements.OPENING];
|
|
86
|
+
var wallsAndVertices = prepWallsAndVerticesIncoming(attributes[config.attributes[types_1.IElements.WALL]], config);
|
|
125
87
|
var featuresData = featuresList.reduce(function (output, type) {
|
|
126
|
-
output[type] = prepFeatureIncoming(
|
|
88
|
+
output[type] = prepFeatureIncoming(wallsAndVertices[types_1.IElements.WALL], attributes[config.attributes[type]], config);
|
|
127
89
|
return output;
|
|
128
90
|
}, {});
|
|
129
|
-
return __assign(__assign({}, wallsAndVertices), (_a = {
|
|
91
|
+
return __assign(__assign({}, wallsAndVertices), (_a = {}, _a[types_1.IElements.FEATURE] = featuresData, _a));
|
|
130
92
|
}
|
|
131
93
|
exports.prepAttributesIncoming = prepAttributesIncoming;
|
|
132
|
-
function
|
|
133
|
-
return [
|
|
134
|
-
types_1.IElements.WALL,
|
|
135
|
-
types_1.IElements.WINDOW,
|
|
136
|
-
types_1.IElements.DOOR,
|
|
137
|
-
types_1.IElements.OPENING,
|
|
138
|
-
].reduce(function (output, elementName) {
|
|
139
|
-
var _a;
|
|
140
|
-
if (!config.attributes[elementName])
|
|
141
|
-
return output;
|
|
142
|
-
var attribute = attributes[config.attributes[elementName]];
|
|
143
|
-
if (!attribute)
|
|
144
|
-
return output;
|
|
145
|
-
return Object.assign(output, (_a = {},
|
|
146
|
-
_a[elementName] = attribute.values[0].assetId,
|
|
147
|
-
_a));
|
|
148
|
-
}, {});
|
|
149
|
-
}
|
|
150
|
-
exports.getAttributeDefaults = getAttributeDefaults;
|
|
151
|
-
function prepFeaturesOutgoing(type, features, config) {
|
|
152
|
-
var attributeName = config.attributes;
|
|
94
|
+
function prepFeaturesOutgoing(features, config) {
|
|
153
95
|
return features.map(function (feature) {
|
|
154
96
|
var _a, _b;
|
|
155
|
-
var assetId = feature.assetId, offset = feature.offset, length = feature.length
|
|
97
|
+
var assetId = feature.assetId, offset = feature.offset, length = feature.length;
|
|
156
98
|
var connectedTo = prepConnectionOutgoing([
|
|
157
99
|
config.attributes[feature.connectedTo[0]],
|
|
158
100
|
feature.connectedTo[1],
|
|
159
101
|
]);
|
|
160
|
-
var
|
|
161
|
-
_a[
|
|
162
|
-
_a[
|
|
163
|
-
_a)
|
|
164
|
-
if (altitude)
|
|
165
|
-
configurationToScale[attributeName.featurePositionY] = altitude;
|
|
166
|
-
if (height)
|
|
167
|
-
configurationToScale[attributeName.featureHeight] = height;
|
|
168
|
-
var configuration = Object.entries(configurationToScale).reduce(function (output, _a) {
|
|
102
|
+
var configuration = Object.entries((_a = {},
|
|
103
|
+
_a[constants_1.IFeatureAttribute.LENGTH] = length,
|
|
104
|
+
_a[constants_1.IFeatureAttribute.POSITION_X] = offset,
|
|
105
|
+
_a)).reduce(function (output, _a) {
|
|
169
106
|
var _b;
|
|
170
107
|
var key = _a[0], value = _a[1];
|
|
171
108
|
return Object.assign(output, (_b = {},
|
|
172
109
|
_b[key] = value ? value * config.config.scale : value,
|
|
173
110
|
_b));
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
configuration[attributeName.doorOpeningDirection] = feature.openingDirection;
|
|
178
|
-
}
|
|
111
|
+
}, (_b = {},
|
|
112
|
+
_b[constants_1.IFeatureAttribute.CONNECTED_TO] = connectedTo,
|
|
113
|
+
_b));
|
|
179
114
|
return {
|
|
180
115
|
assetId: assetId,
|
|
181
116
|
configuration: configuration,
|
|
@@ -183,10 +118,9 @@ function prepFeaturesOutgoing(type, features, config) {
|
|
|
183
118
|
});
|
|
184
119
|
}
|
|
185
120
|
function prepWallsOutgoing(walls, config) {
|
|
186
|
-
var attributeName = config.attributes;
|
|
187
121
|
return walls.map(function (wall) {
|
|
188
122
|
var _a, _b;
|
|
189
|
-
var line = wall.line,
|
|
123
|
+
var line = wall.line, height = wall.height, thickness = wall.thickness;
|
|
190
124
|
var connections = wall.connections.map(function (connection) {
|
|
191
125
|
var attributeName = config.attributes[connection[0]];
|
|
192
126
|
if (!attributeName)
|
|
@@ -195,17 +129,21 @@ function prepWallsOutgoing(walls, config) {
|
|
|
195
129
|
});
|
|
196
130
|
var _c = line.flat(), x1 = _c[0], y1 = _c[1], x2 = _c[2], y2 = _c[3];
|
|
197
131
|
var configuration = Object.entries((_a = {},
|
|
198
|
-
_a[
|
|
199
|
-
_a[
|
|
200
|
-
_a[
|
|
201
|
-
_a[
|
|
132
|
+
_a[constants_1.IWallAttributes.START_X] = x1,
|
|
133
|
+
_a[constants_1.IWallAttributes.START_Z] = y1,
|
|
134
|
+
_a[constants_1.IWallAttributes.END_X] = x2,
|
|
135
|
+
_a[constants_1.IWallAttributes.END_Z] = y2,
|
|
136
|
+
_a[constants_1.IWallAttributes.HEIGHT] = height,
|
|
137
|
+
_a[constants_1.IWallAttributes.THICKNESS] = thickness,
|
|
202
138
|
_a)).reduce(function (output, _a) {
|
|
203
139
|
var _b;
|
|
204
140
|
var key = _a[0], value = _a[1];
|
|
205
141
|
return Object.assign(output, (_b = {},
|
|
206
142
|
_b[key] = value ? value * config.config.scale : value,
|
|
207
143
|
_b));
|
|
208
|
-
},
|
|
144
|
+
}, (_b = {},
|
|
145
|
+
_b[constants_1.IWallAttributes.CONNECTIONS] = JSON.stringify(connections),
|
|
146
|
+
_b));
|
|
209
147
|
return {
|
|
210
148
|
assetId: wall.assetId,
|
|
211
149
|
configuration: configuration,
|
|
@@ -220,7 +158,7 @@ function prepAttributesOutgoing(walls, features, config) {
|
|
|
220
158
|
var attributeName = config.attributes[type];
|
|
221
159
|
if (!attributeName)
|
|
222
160
|
return output;
|
|
223
|
-
output[attributeName] = prepFeaturesOutgoing(
|
|
161
|
+
output[attributeName] = prepFeaturesOutgoing(features, config);
|
|
224
162
|
return output;
|
|
225
163
|
}, {});
|
|
226
164
|
return __assign(__assign({}, featuresAttributes), (_a = {}, _a[config.attributes[types_1.IElements.WALL]] = wallsAttribute, _a));
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IWall, ICoordinate2D, ICoordinatesLine, IFeatures, IFeature, IElementAddress, IRoomBuilderStyles, IRoomBuilderConfigInternal, IStylesGrid, IStylesWall, IStylesVertex, ILineDimensions, IVertex, IElementStyleModes, IStylesFloor, IEnclosedSpace } from './types';
|
|
2
|
+
interface IWallToDraw extends Omit<IWall, 'assetId' | 'connections'> {
|
|
3
|
+
}
|
|
4
|
+
interface IWallsToDraw extends Array<IWallToDraw> {
|
|
5
|
+
}
|
|
6
|
+
export declare function clearCanvas(canvas: HTMLCanvasElement): void;
|
|
7
|
+
export declare function drawBackground(canvas: HTMLCanvasElement, color?: string): void;
|
|
8
|
+
export declare function drawGrid(canvas: HTMLCanvasElement, styles: IStylesGrid): void;
|
|
9
|
+
export declare function drawFloor(canvas: HTMLCanvasElement, enclosedSpaces: Array<IEnclosedSpace>, styles: IStylesFloor): void;
|
|
10
|
+
export declare function drawVertex(canvas: HTMLCanvasElement, point: ICoordinate2D, style: IStylesVertex, mode?: IElementStyleModes): void;
|
|
11
|
+
export declare function drawNewWall(canvas: HTMLCanvasElement, line: ICoordinatesLine, styles: IRoomBuilderStyles, mode?: IElementStyleModes.ERROR): void;
|
|
12
|
+
export declare function drawWalls(canvas: HTMLCanvasElement, walls: IWallsToDraw, selections: {
|
|
13
|
+
active: Array<number>;
|
|
14
|
+
highlighted: Array<number>;
|
|
15
|
+
error: Array<number>;
|
|
16
|
+
hidden: Array<number>;
|
|
17
|
+
}, styles: IStylesWall): void;
|
|
18
|
+
export declare function drawVertices(canvas: HTMLCanvasElement, vertices: Array<IVertex>, selections: {
|
|
19
|
+
active: Array<number>;
|
|
20
|
+
highlighted: Array<number>;
|
|
21
|
+
error: Array<number>;
|
|
22
|
+
hidden: Array<number>;
|
|
23
|
+
}, styles: IStylesVertex): void;
|
|
24
|
+
export declare function drawDimensions(canvas: HTMLCanvasElement, dimensions: Array<ILineDimensions>, config: IRoomBuilderConfigInternal): void;
|
|
25
|
+
export declare function drawWindows(canvas: HTMLCanvasElement, walls: IWallsToDraw, windows: Array<IFeature>, selections: {
|
|
26
|
+
active: Array<number>;
|
|
27
|
+
highlighted: Array<number>;
|
|
28
|
+
error: Array<number>;
|
|
29
|
+
hidden: Array<number>;
|
|
30
|
+
}, styles: IRoomBuilderStyles): void;
|
|
31
|
+
export declare function drawDoors(canvas: HTMLCanvasElement, walls: IWallsToDraw, doors: Array<IFeature>, selections: {
|
|
32
|
+
active: Array<number>;
|
|
33
|
+
highlighted: Array<number>;
|
|
34
|
+
error: Array<number>;
|
|
35
|
+
hidden: Array<number>;
|
|
36
|
+
}, styles: IRoomBuilderStyles): void;
|
|
37
|
+
export declare function drawOpenings(canvas: HTMLCanvasElement, walls: IWallsToDraw, openings: Array<IFeature>, selections: {
|
|
38
|
+
active: Array<number>;
|
|
39
|
+
highlighted: Array<number>;
|
|
40
|
+
error: Array<number>;
|
|
41
|
+
hidden: Array<number>;
|
|
42
|
+
}, styles: IRoomBuilderStyles): void;
|
|
43
|
+
export declare function drawElements(canvas: HTMLCanvasElement, walls: IWallsToDraw, vertices: Array<IVertex>, features: IFeatures, selections: {
|
|
44
|
+
active: Array<IElementAddress>;
|
|
45
|
+
highlighted: Array<IElementAddress>;
|
|
46
|
+
hidden: Array<IElementAddress>;
|
|
47
|
+
error: Array<IElementAddress>;
|
|
48
|
+
}, styles: IRoomBuilderStyles): void;
|
|
49
|
+
export declare function drawRoom(canvas: HTMLCanvasElement, enclosedSpaces: Array<IEnclosedSpace>, walls: IWallsToDraw, vertices: Array<IVertex>, features: IFeatures, dimensions: Array<ILineDimensions> | undefined, selections: {
|
|
50
|
+
active?: Array<IElementAddress> | IElementAddress;
|
|
51
|
+
highlighted?: Array<IElementAddress> | IElementAddress;
|
|
52
|
+
hidden?: Array<IElementAddress> | IElementAddress;
|
|
53
|
+
error?: Array<IElementAddress> | IElementAddress;
|
|
54
|
+
}, config: IRoomBuilderConfigInternal): void;
|
|
55
|
+
export {};
|