@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,41 +0,0 @@
|
|
|
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;
|
|
@@ -1,48 +0,0 @@
|
|
|
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,18 +0,0 @@
|
|
|
1
|
-
import type { IWalls, IRoomBuilderStateProps, IVerticesState, IFeatures } from './types';
|
|
2
|
-
import { IUnits } from './types';
|
|
3
|
-
import type { IConfiguration, IHydratedAttribute } from '../../types';
|
|
4
|
-
export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: IRoomBuilderStateProps): {
|
|
5
|
-
features: IFeatures;
|
|
6
|
-
walls: IWalls;
|
|
7
|
-
vertex: IVerticesState;
|
|
8
|
-
};
|
|
9
|
-
export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: IRoomBuilderStateProps): {
|
|
10
|
-
[x: string]: import("../../types").IConfigurationAttribute | {
|
|
11
|
-
assetId: string;
|
|
12
|
-
configuration: IConfiguration;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
export declare function convertLengthUnit(value: number, from: IUnits, to: IUnits): number;
|
|
16
|
-
export declare function convertAreaUnit(value: number, from: IUnits, to: IUnits): number;
|
|
17
|
-
export declare function prepLengthForUser(value: number, unit: IUnits): string;
|
|
18
|
-
export declare function prepAreaForUser(value: number, unit: IUnits): string;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.prepAreaForUser = exports.prepLengthForUser = exports.convertAreaUnit = exports.convertLengthUnit = exports.prepAttributesOutgoing = exports.prepAttributesIncoming = void 0;
|
|
15
|
-
var types_1 = require("./types");
|
|
16
|
-
var constants_1 = require("./constants");
|
|
17
|
-
var geometry_1 = require("./geometry");
|
|
18
|
-
function prepConnectionOutgoing(connection) {
|
|
19
|
-
return "".concat(connection[0], ".").concat(connection[1]);
|
|
20
|
-
}
|
|
21
|
-
function prepConnectionIncoming(connection) {
|
|
22
|
-
var _a = connection.split('.'), attributeName = _a[0], indexStr = _a[1];
|
|
23
|
-
return [attributeName, parseInt(indexStr)];
|
|
24
|
-
}
|
|
25
|
-
function prepWallsAndVerticesIncoming(wallsAttribute, config) {
|
|
26
|
-
var _a;
|
|
27
|
-
var walls = [];
|
|
28
|
-
var vertices = {};
|
|
29
|
-
((wallsAttribute === null || wallsAttribute === void 0 ? void 0 : wallsAttribute.value) || []).forEach(function (_a, i) {
|
|
30
|
-
var assetId = _a.assetId, configuration = _a.configuration;
|
|
31
|
-
var point1 = [
|
|
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,
|
|
34
|
-
];
|
|
35
|
-
var point2 = [
|
|
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,
|
|
38
|
-
];
|
|
39
|
-
var point1Str = JSON.stringify(point1);
|
|
40
|
-
var point2Str = JSON.stringify(point2);
|
|
41
|
-
if (vertices[point1Str])
|
|
42
|
-
vertices[point1Str].push([i, 0]);
|
|
43
|
-
else
|
|
44
|
-
vertices[point1Str] = [[i, 0]];
|
|
45
|
-
if (vertices[point2Str])
|
|
46
|
-
vertices[point2Str].push([i, 1]);
|
|
47
|
-
else
|
|
48
|
-
vertices[point2Str] = [[i, 1]];
|
|
49
|
-
var connections = [];
|
|
50
|
-
walls.push({
|
|
51
|
-
assetId: assetId,
|
|
52
|
-
line: [point1, point2],
|
|
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],
|
|
56
|
-
connections: connections,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
return _a = {}, _a[types_1.IElements.WALL] = walls, _a[types_1.IElements.VERTEX] = vertices, _a;
|
|
60
|
-
}
|
|
61
|
-
function prepFeatureIncoming(walls, featureAttribute, config) {
|
|
62
|
-
var _a;
|
|
63
|
-
var feature = [];
|
|
64
|
-
(_a = featureAttribute === null || featureAttribute === void 0 ? void 0 : featureAttribute.value) === null || _a === void 0 ? void 0 : _a.forEach(function (_a) {
|
|
65
|
-
var assetId = _a.assetId, configuration = _a.configuration;
|
|
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]) || '';
|
|
70
|
-
var wallIndex = prepConnectionIncoming(connectedTo)[1];
|
|
71
|
-
var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(walls[wallIndex].line, offset, length);
|
|
72
|
-
var path = (0, geometry_1.addThicknessToLine)(featureLine, config.config.styles.feature.thickness);
|
|
73
|
-
feature.push({
|
|
74
|
-
assetId: assetId,
|
|
75
|
-
offset: offset,
|
|
76
|
-
length: length,
|
|
77
|
-
path: path,
|
|
78
|
-
connectedTo: [types_1.IElements.WALL, wallIndex],
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
return feature;
|
|
82
|
-
}
|
|
83
|
-
function prepAttributesIncoming(attributes, config) {
|
|
84
|
-
var _a;
|
|
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);
|
|
87
|
-
var featuresData = featuresList.reduce(function (output, type) {
|
|
88
|
-
output[type] = prepFeatureIncoming(wallsAndVertices[types_1.IElements.WALL], attributes[config.attributes[type]], config);
|
|
89
|
-
return output;
|
|
90
|
-
}, {});
|
|
91
|
-
return __assign(__assign({}, wallsAndVertices), (_a = {}, _a[types_1.IElements.FEATURE] = featuresData, _a));
|
|
92
|
-
}
|
|
93
|
-
exports.prepAttributesIncoming = prepAttributesIncoming;
|
|
94
|
-
function prepFeaturesOutgoing(features, config) {
|
|
95
|
-
return features.map(function (feature) {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
var assetId = feature.assetId, offset = feature.offset, length = feature.length;
|
|
98
|
-
var connectedTo = prepConnectionOutgoing([
|
|
99
|
-
config.attributes[feature.connectedTo[0]],
|
|
100
|
-
feature.connectedTo[1],
|
|
101
|
-
]);
|
|
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) {
|
|
106
|
-
var _b;
|
|
107
|
-
var key = _a[0], value = _a[1];
|
|
108
|
-
return Object.assign(output, (_b = {},
|
|
109
|
-
_b[key] = value ? value * config.config.scale : value,
|
|
110
|
-
_b));
|
|
111
|
-
}, (_b = {},
|
|
112
|
-
_b[constants_1.IFeatureAttribute.CONNECTED_TO] = connectedTo,
|
|
113
|
-
_b));
|
|
114
|
-
return {
|
|
115
|
-
assetId: assetId,
|
|
116
|
-
configuration: configuration,
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function prepWallsOutgoing(walls, config) {
|
|
121
|
-
return walls.map(function (wall) {
|
|
122
|
-
var _a, _b;
|
|
123
|
-
var line = wall.line, height = wall.height, thickness = wall.thickness;
|
|
124
|
-
var connections = wall.connections.map(function (connection) {
|
|
125
|
-
var attributeName = config.attributes[connection[0]];
|
|
126
|
-
if (!attributeName)
|
|
127
|
-
return;
|
|
128
|
-
return prepConnectionOutgoing([attributeName, connection[1]]);
|
|
129
|
-
});
|
|
130
|
-
var _c = line.flat(), x1 = _c[0], y1 = _c[1], x2 = _c[2], y2 = _c[3];
|
|
131
|
-
var configuration = Object.entries((_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,
|
|
138
|
-
_a)).reduce(function (output, _a) {
|
|
139
|
-
var _b;
|
|
140
|
-
var key = _a[0], value = _a[1];
|
|
141
|
-
return Object.assign(output, (_b = {},
|
|
142
|
-
_b[key] = value ? value * config.config.scale : value,
|
|
143
|
-
_b));
|
|
144
|
-
}, (_b = {},
|
|
145
|
-
_b[constants_1.IWallAttributes.CONNECTIONS] = JSON.stringify(connections),
|
|
146
|
-
_b));
|
|
147
|
-
return {
|
|
148
|
-
assetId: wall.assetId,
|
|
149
|
-
configuration: configuration,
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function prepAttributesOutgoing(walls, features, config) {
|
|
154
|
-
var _a;
|
|
155
|
-
var wallsAttribute = prepWallsOutgoing(walls, config);
|
|
156
|
-
var featuresAttributes = Object.entries(features).reduce(function (output, _a) {
|
|
157
|
-
var type = _a[0], features = _a[1];
|
|
158
|
-
var attributeName = config.attributes[type];
|
|
159
|
-
if (!attributeName)
|
|
160
|
-
return output;
|
|
161
|
-
output[attributeName] = prepFeaturesOutgoing(features, config);
|
|
162
|
-
return output;
|
|
163
|
-
}, {});
|
|
164
|
-
return __assign(__assign({}, featuresAttributes), (_a = {}, _a[config.attributes[types_1.IElements.WALL]] = wallsAttribute, _a));
|
|
165
|
-
}
|
|
166
|
-
exports.prepAttributesOutgoing = prepAttributesOutgoing;
|
|
167
|
-
function convertLengthUnit(value, from, to) {
|
|
168
|
-
return (value / constants_1.UNIT_FACTORS[from]) * constants_1.UNIT_FACTORS[to];
|
|
169
|
-
}
|
|
170
|
-
exports.convertLengthUnit = convertLengthUnit;
|
|
171
|
-
function convertAreaUnit(value, from, to) {
|
|
172
|
-
return (value / constants_1.UNIT_FACTORS[from]) * Math.pow(constants_1.UNIT_FACTORS[to], 2);
|
|
173
|
-
}
|
|
174
|
-
exports.convertAreaUnit = convertAreaUnit;
|
|
175
|
-
function prepLengthForUser(value, unit) {
|
|
176
|
-
if (unit === types_1.IUnits.FEET) {
|
|
177
|
-
var feet = Math.floor(value);
|
|
178
|
-
var inches = 1.2 * (value % 1);
|
|
179
|
-
return "".concat(feet).concat(constants_1.UNIT_LABELS[types_1.IUnits.FEET], " ").concat(inches.toFixed(2)).concat(constants_1.UNIT_LABELS[types_1.IUnits.INCH]);
|
|
180
|
-
}
|
|
181
|
-
return "".concat(value.toFixed(2), " ").concat(constants_1.UNIT_LABELS[unit]);
|
|
182
|
-
}
|
|
183
|
-
exports.prepLengthForUser = prepLengthForUser;
|
|
184
|
-
function prepAreaForUser(value, unit) {
|
|
185
|
-
return "".concat(value.toFixed(2), " sq-").concat(constants_1.UNIT_LABELS[unit]);
|
|
186
|
-
}
|
|
187
|
-
exports.prepAreaForUser = prepAreaForUser;
|
|
@@ -1,55 +0,0 @@
|
|
|
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 {};
|