@threekit-tools/treble 0.0.92 → 0.0.94-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/Treble/snapshot.d.ts +2 -2
- package/dist/Treble/snapshot.js +1 -1
- package/dist/hooks/useNestedConfigurator/index.js +1 -2
- package/dist/hooks/useSnapshot/index.d.ts +1 -1
- package/dist/hooks/useSpaces/SpacesState.d.ts +15 -2
- package/dist/hooks/useSpaces/SpacesState.js +85 -22
- package/dist/hooks/useSpaces/constants.d.ts +17 -2
- package/dist/hooks/useSpaces/constants.js +58 -37
- package/dist/hooks/useSpaces/dataHandlers.d.ts +22 -4
- package/dist/hooks/useSpaces/dataHandlers.js +197 -40
- package/dist/hooks/useSpaces/draw/drawDoors.js +1 -1
- package/dist/hooks/useSpaces/draw/drawGrid.d.ts +1 -1
- package/dist/hooks/useSpaces/draw/drawGrid.js +4 -1
- package/dist/hooks/useSpaces/draw/drawWalls.d.ts +3 -2
- package/dist/hooks/useSpaces/draw/drawWalls.js +6 -4
- package/dist/hooks/useSpaces/index.d.ts +13 -0
- package/dist/hooks/useSpaces/index.js +269 -126
- package/dist/hooks/useSpaces/types.d.ts +52 -13
- package/dist/icons/Boundary.d.ts +3 -0
- package/dist/icons/{Ruler copy.js → Boundary.js} +7 -8
- package/dist/icons/Draw.js +3 -3
- package/dist/icons/RulerBlank.js +2 -2
- package/dist/icons/RulerDetailed.js +2 -2
- 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 +2 -1
- package/dist/store/index.d.ts +41 -10
- package/dist/store/index.js +3 -1
- package/dist/store/product.js +4 -7
- package/dist/store/spaces.d.ts +32 -5
- package/dist/store/spaces.js +164 -7
- package/dist/store/treble.d.ts +1 -1
- package/dist/store/treble.js +14 -21
- package/dist/store/wishlist.d.ts +2 -20
- package/dist/types.d.ts +3 -1
- package/package.json +1 -2
- package/dist/Treble/snapshots.d.ts +0 -22
- package/dist/Treble/snapshots.js +0 -247
- 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/findLoops.js +0 -99
- 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/messaging.d.ts +0 -8
- package/dist/hooks/useRoomBuilder/messaging.js +0 -18
- package/dist/hooks/useRoomBuilder/themes.d.ts +0 -12
- 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/icons/Ruler copy.d.ts +0 -3
- package/dist/icons/RulerDetailed copy.d.ts +0 -3
- package/dist/icons/RulerDetailed copy.js +0 -27
package/dist/Treble/Treble.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import threekitAPI from '../api';
|
|
2
2
|
import { IThreekitPlayer, IThreekitPrivatePlayer, IThreekitPrivateConfigurator } from '../types';
|
|
3
3
|
import { IWishlist } from './wishlist';
|
|
4
|
-
import
|
|
4
|
+
import snapshot from './snapshot';
|
|
5
5
|
import { ISaveConfiguration } from '../api/configurations';
|
|
6
6
|
import { ICreateOrder } from '../api/orders';
|
|
7
7
|
import { ICartItem } from '../http/orders';
|
|
@@ -22,7 +22,7 @@ declare class Treble {
|
|
|
22
22
|
_player: IThreekitPrivatePlayer;
|
|
23
23
|
wishlist: IWishlist;
|
|
24
24
|
private _snapshots;
|
|
25
|
-
takeSnapshots:
|
|
25
|
+
takeSnapshots: typeof snapshot['takeSnapshots'];
|
|
26
26
|
_debugMode: boolean;
|
|
27
27
|
constructor({ player, orgId }: ITreble);
|
|
28
28
|
createOrder: (order?: IOrder) => Promise<import("../http/orders").IOrderResponse>;
|
package/dist/Treble/Treble.js
CHANGED
|
@@ -45,7 +45,7 @@ var types_1 = require("../types");
|
|
|
45
45
|
var constants_1 = require("../constants");
|
|
46
46
|
var utils_1 = require("../utils");
|
|
47
47
|
var wishlist_1 = __importDefault(require("./wishlist"));
|
|
48
|
-
var
|
|
48
|
+
var snapshot_1 = __importDefault(require("./snapshot"));
|
|
49
49
|
var Treble = (function () {
|
|
50
50
|
function Treble(_a) {
|
|
51
51
|
var player = _a.player, orgId = _a.orgId;
|
|
@@ -147,7 +147,7 @@ var Treble = (function () {
|
|
|
147
147
|
};
|
|
148
148
|
this._api = api_1.default;
|
|
149
149
|
this.wishlist = (0, wishlist_1.default)(orgId);
|
|
150
|
-
this._snapshots =
|
|
150
|
+
this._snapshots = snapshot_1.default;
|
|
151
151
|
this.takeSnapshots = this._snapshots.takeSnapshots;
|
|
152
152
|
this._player = player.enableApi(types_1.PRIVATE_APIS.PLAYER);
|
|
153
153
|
this._debugMode = constants_1.TREBLE_DEBUG;
|
package/dist/Treble/index.d.ts
CHANGED
package/dist/Treble/index.js
CHANGED
|
@@ -19,6 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
var Treble_1 = __importDefault(require("./Treble"));
|
|
21
21
|
__exportStar(require("./Treble"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
22
|
+
__exportStar(require("./snapshot"), exports);
|
|
23
23
|
__exportStar(require("./wishlist"), exports);
|
|
24
24
|
exports.default = Treble_1.default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ISnapshotsCameras = undefined | string | Array<string | undefined>;
|
|
1
|
+
export declare type ISnapshotsCameras = undefined | string | Array<string | undefined>;
|
|
2
2
|
interface SnapshotSize {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
@@ -17,6 +17,6 @@ interface IGetSnapshot {
|
|
|
17
17
|
}
|
|
18
18
|
declare const _default: {
|
|
19
19
|
getSnapshot: ({ size, format }: IGetSnapshot) => Promise<string>;
|
|
20
|
-
takeSnapshots: (camerasList: ISnapshotsCameras, snapshotsConfig: ITakeSnapshotsConfig) => Promise<void | string[] |
|
|
20
|
+
takeSnapshots: (camerasList: ISnapshotsCameras, snapshotsConfig: ITakeSnapshotsConfig) => Promise<void | string[] | File[] | Blob[] | null>;
|
|
21
21
|
};
|
|
22
22
|
export default _default;
|
package/dist/Treble/snapshot.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (
|
|
17
|
+
while (_) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -57,8 +57,7 @@ var useNestedConfigurator = function (address) {
|
|
|
57
57
|
return;
|
|
58
58
|
if (playerLoading)
|
|
59
59
|
return;
|
|
60
|
-
configurator.current =
|
|
61
|
-
window.threekit.treble.getNestedConfigurator(address);
|
|
60
|
+
configurator.current = window.threekit.configurator.getNestedConfigurator([address].flat());
|
|
62
61
|
if (!configurator.current)
|
|
63
62
|
return;
|
|
64
63
|
var updatedAttrs = configurator.current.getDisplayAttributes();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ISnapshotsCameras, ITakeSnapshotsConfig } from '../../Treble';
|
|
2
|
-
declare const useSnapshot: (cameras: ISnapshotsCameras, config: ITakeSnapshotsConfig) => (() => Promise<void | string[] |
|
|
2
|
+
declare const useSnapshot: (cameras: ISnapshotsCameras, config: ITakeSnapshotsConfig) => (() => Promise<void | string[] | File[] | Blob[] | null>) | undefined;
|
|
3
3
|
export default useSnapshot;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type { IWalls, IVerticesState, ICoordinate2D, IFeature, IFeatures, ICoordinatesLine, ISpacesStateProps, IElementAddress, IFeatureName, IVertex, IFeaturesHydrated, IElementUi, IElementName, IActiveElement, IEnclosedSpace, IFeatureDoor, IWallsValidationConfig, IGuides, IAttributeDefaults, IGridToDraw } from './types';
|
|
1
|
+
import type { IWalls, IVerticesState, ICoordinate2D, IFeature, IFeatures, ICoordinatesLine, ISpacesStateProps, IElementAddress, IFeatureName, IVertex, IFeaturesHydrated, IElementUi, IElementName, IActiveElement, IEnclosedSpace, IFeatureDoor, IWallsValidationConfig, IGuides, IAttributeDefaults, IGridToDraw, ISpacesSync } from './types';
|
|
2
2
|
import { IUnits, IDimensionOptions } from './types';
|
|
3
3
|
import type { IHydratedAttribute } from '../../types';
|
|
4
|
+
import { WallModes } from './constants';
|
|
4
5
|
export declare class SpacesState {
|
|
5
6
|
private _config;
|
|
6
7
|
private _attributesState;
|
|
7
8
|
private _attributeDefaults;
|
|
9
|
+
private _activeWallMode;
|
|
10
|
+
private _activeWallModeAssetId;
|
|
8
11
|
private _newWall;
|
|
9
12
|
private _activeElement;
|
|
10
13
|
private _selectedElement;
|
|
@@ -23,6 +26,7 @@ export declare class SpacesState {
|
|
|
23
26
|
private _unit;
|
|
24
27
|
private _validationConfig;
|
|
25
28
|
private _state;
|
|
29
|
+
private _setPendingStatus;
|
|
26
30
|
constructor(config: ISpacesStateProps);
|
|
27
31
|
get styles(): import("./types").ISpacesStyles;
|
|
28
32
|
get attributeDefaults(): IAttributeDefaults;
|
|
@@ -40,7 +44,7 @@ export declare class SpacesState {
|
|
|
40
44
|
assetId: string;
|
|
41
45
|
connections: [elementType: IFeatureName, index: number][];
|
|
42
46
|
restConfiguration: string;
|
|
43
|
-
|
|
47
|
+
mode: WallModes;
|
|
44
48
|
}[];
|
|
45
49
|
set walls(walls: IWalls);
|
|
46
50
|
get wallCount(): number;
|
|
@@ -88,6 +92,15 @@ export declare class SpacesState {
|
|
|
88
92
|
get isDrawWallActive(): boolean;
|
|
89
93
|
get validationConfig(): IWallsValidationConfig;
|
|
90
94
|
set validationConfig(config: IWallsValidationConfig);
|
|
95
|
+
set wallMode(mode: {
|
|
96
|
+
value: WallModes;
|
|
97
|
+
assetId: string;
|
|
98
|
+
});
|
|
99
|
+
get wallMode(): {
|
|
100
|
+
value: WallModes;
|
|
101
|
+
assetId: string;
|
|
102
|
+
};
|
|
103
|
+
sync(state: Partial<ISpacesSync>): void;
|
|
91
104
|
private transformLengthFromCanvas;
|
|
92
105
|
private transformLengthToCanvas;
|
|
93
106
|
private transformPointToCanvas;
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (
|
|
28
|
+
while (_) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -68,6 +68,7 @@ var SpacesState = (function () {
|
|
|
68
68
|
function SpacesState(config) {
|
|
69
69
|
var _a;
|
|
70
70
|
var _this = this;
|
|
71
|
+
var _b;
|
|
71
72
|
this.moveActiveVertex = function (canvas, point) {
|
|
72
73
|
var _a, _b, _c, _d;
|
|
73
74
|
if (!canvas)
|
|
@@ -188,22 +189,29 @@ var SpacesState = (function () {
|
|
|
188
189
|
this._selectedElement = null;
|
|
189
190
|
this._highlightedElement = null;
|
|
190
191
|
this._errorElement = null;
|
|
191
|
-
this._attributeDefaults =
|
|
192
|
+
this._attributeDefaults = config.attributeDefaults;
|
|
192
193
|
this._state = (_a = {},
|
|
193
194
|
_a[types_1.IElements.WALL] = [],
|
|
194
195
|
_a[types_1.IElements.VERTEX] = {},
|
|
195
196
|
_a[types_1.IElements.FEATURE] = {},
|
|
196
197
|
_a);
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
198
|
+
this._unit = config.config.unit;
|
|
199
|
+
this._showDimensions = config.config.showDimensions;
|
|
200
|
+
this._angleSnappingEnabled = config.config.enableAngleSnapping;
|
|
201
|
+
this._guideSnappingEnabled = config.config.enableGuideSnapping;
|
|
202
|
+
this._gridSnappingEnabled = config.config.enableGridSnapping;
|
|
200
203
|
this._guides = null;
|
|
201
204
|
this._attributesState = null;
|
|
202
|
-
this._canvasDimensions = [0, 0];
|
|
205
|
+
this._canvasDimensions = (_b = config.canvasDimensions) !== null && _b !== void 0 ? _b : [0, 0];
|
|
203
206
|
this._zoom = config.config.zoomDefault;
|
|
204
207
|
this._zoomLimits = [constants_1.ZOOM_MIN, constants_1.ZOOM_MAX];
|
|
205
208
|
this._translate = config.config.translateDefault;
|
|
206
209
|
this._translateLimits = [constants_1.TRANSLATE_MIN, constants_1.TRANSLATE_MAX];
|
|
210
|
+
this._activeWallMode = config.wallMode.value;
|
|
211
|
+
this._activeWallModeAssetId = config.wallMode.assetId;
|
|
212
|
+
this._setPendingStatus = config.setPendingStatus;
|
|
213
|
+
if (config.attributesState)
|
|
214
|
+
this.setAttributesToState(config.attributesState);
|
|
207
215
|
}
|
|
208
216
|
Object.defineProperty(SpacesState.prototype, "styles", {
|
|
209
217
|
get: function () {
|
|
@@ -627,6 +635,39 @@ var SpacesState = (function () {
|
|
|
627
635
|
enumerable: false,
|
|
628
636
|
configurable: true
|
|
629
637
|
});
|
|
638
|
+
Object.defineProperty(SpacesState.prototype, "wallMode", {
|
|
639
|
+
get: function () {
|
|
640
|
+
return {
|
|
641
|
+
value: this._activeWallMode,
|
|
642
|
+
assetId: this._activeWallModeAssetId,
|
|
643
|
+
};
|
|
644
|
+
},
|
|
645
|
+
set: function (mode) {
|
|
646
|
+
this._activeWallMode = mode.value;
|
|
647
|
+
this._activeWallModeAssetId = mode.assetId;
|
|
648
|
+
},
|
|
649
|
+
enumerable: false,
|
|
650
|
+
configurable: true
|
|
651
|
+
});
|
|
652
|
+
SpacesState.prototype.sync = function (state) {
|
|
653
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
654
|
+
this._canvasDimensions = (_a = state.canvasDimensions) !== null && _a !== void 0 ? _a : this._canvasDimensions;
|
|
655
|
+
this.angleSnappingEnabled =
|
|
656
|
+
(_b = state.angleSnappingEnabled) !== null && _b !== void 0 ? _b : this.angleSnappingEnabled;
|
|
657
|
+
this.guideSnappingEnabled =
|
|
658
|
+
(_c = state.guideSnappingEnabled) !== null && _c !== void 0 ? _c : this.guideSnappingEnabled;
|
|
659
|
+
this.gridSnappingEnabled =
|
|
660
|
+
(_d = state.gridSnappingEnabled) !== null && _d !== void 0 ? _d : this.gridSnappingEnabled;
|
|
661
|
+
this.showDimensions = (_e = state.showDimensions) !== null && _e !== void 0 ? _e : this.showDimensions;
|
|
662
|
+
this._zoom = (_f = state.zoom) !== null && _f !== void 0 ? _f : this._zoom;
|
|
663
|
+
this.translate = (_g = state.translate) !== null && _g !== void 0 ? _g : this.translate;
|
|
664
|
+
this.unit = (_h = state.unit) !== null && _h !== void 0 ? _h : this.unit;
|
|
665
|
+
this.wallMode = (_j = state.wallMode) !== null && _j !== void 0 ? _j : this.wallMode;
|
|
666
|
+
if (state.selectedElement !== undefined)
|
|
667
|
+
this.selectedElement = state.selectedElement;
|
|
668
|
+
if (state.attributesState)
|
|
669
|
+
this.setAttributesToState(state.attributesState);
|
|
670
|
+
};
|
|
630
671
|
SpacesState.prototype.transformLengthFromCanvas = function (length) {
|
|
631
672
|
return length / this.zoomFactor;
|
|
632
673
|
};
|
|
@@ -837,7 +878,7 @@ var SpacesState = (function () {
|
|
|
837
878
|
var splitWallsShared = {
|
|
838
879
|
assetId: originalWall.assetId,
|
|
839
880
|
restConfiguration: originalWall.restConfiguration,
|
|
840
|
-
|
|
881
|
+
mode: originalWall.mode,
|
|
841
882
|
};
|
|
842
883
|
var wall1 = __assign(__assign({}, splitWallsShared), { line: line1, connections: originalWall.connections });
|
|
843
884
|
var wall2 = __assign(__assign({}, splitWallsShared), { line: line2, connections: [] });
|
|
@@ -1047,8 +1088,12 @@ var SpacesState = (function () {
|
|
|
1047
1088
|
return;
|
|
1048
1089
|
var newFeature = __assign(__assign({}, feature), { assetId: assetId, offset: offset, length: length, height: (feature === null || feature === void 0 ? void 0 : feature.height) ? feature.height / this.scale : 0, altitude: (feature === null || feature === void 0 ? void 0 : feature.altitude) ? feature.altitude / this.scale : 0, connectedTo: [types_1.IElements.WALL, index], restConfiguration: '{}' });
|
|
1049
1090
|
if (type === types_1.IElements.DOOR) {
|
|
1050
|
-
newFeature.orientation =
|
|
1051
|
-
|
|
1091
|
+
newFeature.orientation =
|
|
1092
|
+
this.attributeDefaults.doorOrientation;
|
|
1093
|
+
newFeature.openingDirection =
|
|
1094
|
+
this.attributeDefaults.doorOpeningDirection;
|
|
1095
|
+
newFeature.showSwing =
|
|
1096
|
+
this.attributeDefaults.doorShowSwing;
|
|
1052
1097
|
}
|
|
1053
1098
|
var newFeatureIndex;
|
|
1054
1099
|
if ((_a = this._state[types_1.IElements.FEATURE][type]) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1379,16 +1424,27 @@ var SpacesState = (function () {
|
|
|
1379
1424
|
});
|
|
1380
1425
|
};
|
|
1381
1426
|
SpacesState.prototype.pushStateToConfigurator = function () {
|
|
1382
|
-
|
|
1383
|
-
|
|
1427
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1428
|
+
var configuration;
|
|
1429
|
+
return __generator(this, function (_a) {
|
|
1430
|
+
switch (_a.label) {
|
|
1431
|
+
case 0:
|
|
1432
|
+
configuration = (0, dataHandlers_1.prepAttributesOutgoing)(this.walls, this.features, this._config);
|
|
1433
|
+
this._setPendingStatus(true);
|
|
1434
|
+
return [4, window.threekit.configurator.setConfiguration(configuration)];
|
|
1435
|
+
case 1:
|
|
1436
|
+
_a.sent();
|
|
1437
|
+
this._setPendingStatus(false);
|
|
1438
|
+
return [2];
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
});
|
|
1384
1442
|
};
|
|
1385
1443
|
SpacesState.prototype.setAttributesToState = function (attributes) {
|
|
1386
1444
|
if (!attributes)
|
|
1387
1445
|
return;
|
|
1388
1446
|
this._attributesState = attributes;
|
|
1389
|
-
var data = (0, dataHandlers_1.prepAttributesIncoming)(attributes, this._config);
|
|
1390
|
-
if (!Object.keys(this.attributeDefaults).length)
|
|
1391
|
-
this.attributeDefaults = (0, dataHandlers_1.getAttributeDefaults)(attributes, this._config);
|
|
1447
|
+
var data = (0, dataHandlers_1.prepAttributesIncoming)(attributes, this._config, __assign(__assign({}, this.attributeDefaults), { wallMode: this.wallMode.value }));
|
|
1392
1448
|
this.validationConfig = data.validationConfig;
|
|
1393
1449
|
this.walls = data[types_1.IElements.WALL];
|
|
1394
1450
|
this.vertices = data[types_1.IElements.VERTEX];
|
|
@@ -1614,13 +1670,20 @@ var SpacesState = (function () {
|
|
|
1614
1670
|
var point = _a.point;
|
|
1615
1671
|
return point;
|
|
1616
1672
|
}));
|
|
1617
|
-
this.addWalls(newWallLines.map(function (line) {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1673
|
+
this.addWalls(newWallLines.map(function (line) {
|
|
1674
|
+
var _a;
|
|
1675
|
+
return ({
|
|
1676
|
+
assetId: newWallAssetId,
|
|
1677
|
+
line: line,
|
|
1678
|
+
connections: [],
|
|
1679
|
+
restConfiguration: JSON.stringify((_a = {},
|
|
1680
|
+
_a[_this._config.attributes.wallMode] = {
|
|
1681
|
+
assetId: _this.wallMode.assetId,
|
|
1682
|
+
},
|
|
1683
|
+
_a)),
|
|
1684
|
+
mode: _this.wallMode.value,
|
|
1685
|
+
});
|
|
1686
|
+
}));
|
|
1624
1687
|
this._newWall = null;
|
|
1625
1688
|
this._errorElement = null;
|
|
1626
1689
|
this._highlightedElement = null;
|
|
@@ -1734,7 +1797,7 @@ var SpacesState = (function () {
|
|
|
1734
1797
|
this._newWall.start.point,
|
|
1735
1798
|
this._newWall.end.point,
|
|
1736
1799
|
];
|
|
1737
|
-
(0, draw_1.drawNewWall)(canvas, this.transformLineToCanvas(newWallLine), this.styles, this._errorElement ? types_1.IElementStyleModes.ERROR : undefined);
|
|
1800
|
+
(0, draw_1.drawNewWall)(canvas, this.transformLineToCanvas(newWallLine), this.wallMode.value, this.styles, this._errorElement ? types_1.IElementStyleModes.ERROR : undefined);
|
|
1738
1801
|
if (this._showDimensions) {
|
|
1739
1802
|
(0, draw_1.drawDimensions)(canvas, [
|
|
1740
1803
|
{
|
|
@@ -12,8 +12,16 @@ export declare enum WallAttributes {
|
|
|
12
12
|
CONNECTIONS = "_tkSpace_connections",
|
|
13
13
|
WALL_HEIGHT = "_tkSpace_wallHeight",
|
|
14
14
|
WALL_THICKNESS = "_tkSpace_wallThickness",
|
|
15
|
-
|
|
15
|
+
WALL_MODE = "_tkSpace_visibility"
|
|
16
16
|
}
|
|
17
|
+
export declare enum WallModes {
|
|
18
|
+
WALL = "true",
|
|
19
|
+
BOUNDARY = "false"
|
|
20
|
+
}
|
|
21
|
+
export declare const wallModeLabels: {
|
|
22
|
+
true: string;
|
|
23
|
+
false: string;
|
|
24
|
+
};
|
|
17
25
|
export declare enum WallMetadata {
|
|
18
26
|
MIN_LENGTH = "_tkSpace_minLength",
|
|
19
27
|
PADDING = "_tkSpace_padding"
|
|
@@ -31,6 +39,10 @@ export declare enum DoorOpeningDirections {
|
|
|
31
39
|
INSIDE = "inside",
|
|
32
40
|
OUTSIDE = "outside"
|
|
33
41
|
}
|
|
42
|
+
export declare enum DoorShowSwing {
|
|
43
|
+
SHOW = "true",
|
|
44
|
+
HIDE = "false"
|
|
45
|
+
}
|
|
34
46
|
export declare const ATTRIBUTE_NAME_DEFAULTS: ISpacesAttributes;
|
|
35
47
|
export declare const SCALE = 0.02;
|
|
36
48
|
export declare const SNAP_PROXIMITY = 16;
|
|
@@ -41,6 +53,9 @@ export declare const ZOOM_SENSITIVITY = 0.8;
|
|
|
41
53
|
export declare const TRANSLATE_MAX: ICoordinate2D;
|
|
42
54
|
export declare const TRANSLATE_MIN: ICoordinate2D;
|
|
43
55
|
export declare const TRANSLATE_DEFAULT: ICoordinate2D;
|
|
56
|
+
export declare const GRID_SNAPPING_ENABLED = true;
|
|
57
|
+
export declare const ANGLE_SNAPPING_ENABLED = false;
|
|
58
|
+
export declare const GUIDE_SNAPPING_ENABLED = true;
|
|
44
59
|
export declare const UNIT_LABELS: {
|
|
45
60
|
feet: string;
|
|
46
61
|
meter: string;
|
|
@@ -59,6 +74,6 @@ export declare const FEATURE_LABELS: {
|
|
|
59
74
|
openings: string;
|
|
60
75
|
};
|
|
61
76
|
export declare const VALIDATION_CONFIG_DEFAULT: IWallsValidationConfig;
|
|
62
|
-
export declare const FEATURE_LENGTH =
|
|
77
|
+
export declare const FEATURE_LENGTH = 1;
|
|
63
78
|
export declare const UI_ANCHOR_DISTANCE = -60;
|
|
64
79
|
export declare const WALL_SNAP_DISTANCE = 12;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d;
|
|
2
|
+
var _a, _b, _c, _d, _e;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.WALL_SNAP_DISTANCE = exports.UI_ANCHOR_DISTANCE = exports.FEATURE_LENGTH = exports.VALIDATION_CONFIG_DEFAULT = exports.FEATURE_LABELS = exports.UNIT_FACTORS = exports.UNIT_LABELS = exports.TRANSLATE_DEFAULT = exports.TRANSLATE_MIN = exports.TRANSLATE_MAX = exports.ZOOM_SENSITIVITY = exports.ZOOM_DEFAULT = exports.ZOOM_MIN = exports.ZOOM_MAX = exports.SNAP_PROXIMITY = exports.SCALE = exports.ATTRIBUTE_NAME_DEFAULTS = exports.DoorOpeningDirections = exports.DoorOrientations = exports.DoorAttributes = exports.WallMetadata = exports.WallAttributes = exports.SpacesMetadata = void 0;
|
|
4
|
+
exports.WALL_SNAP_DISTANCE = exports.UI_ANCHOR_DISTANCE = exports.FEATURE_LENGTH = exports.VALIDATION_CONFIG_DEFAULT = exports.FEATURE_LABELS = exports.UNIT_FACTORS = exports.UNIT_LABELS = exports.GUIDE_SNAPPING_ENABLED = exports.ANGLE_SNAPPING_ENABLED = exports.GRID_SNAPPING_ENABLED = exports.TRANSLATE_DEFAULT = exports.TRANSLATE_MIN = exports.TRANSLATE_MAX = exports.ZOOM_SENSITIVITY = exports.ZOOM_DEFAULT = exports.ZOOM_MIN = exports.ZOOM_MAX = exports.SNAP_PROXIMITY = exports.SCALE = exports.ATTRIBUTE_NAME_DEFAULTS = exports.DoorShowSwing = exports.DoorOpeningDirections = exports.DoorOrientations = exports.DoorAttributes = exports.WallMetadata = exports.wallModeLabels = exports.WallModes = exports.WallAttributes = exports.SpacesMetadata = void 0;
|
|
5
5
|
var types_1 = require("./types");
|
|
6
6
|
var SpacesAttributes;
|
|
7
7
|
(function (SpacesAttributes) {
|
|
@@ -25,8 +25,17 @@ var WallAttributes;
|
|
|
25
25
|
WallAttributes["CONNECTIONS"] = "_tkSpace_connections";
|
|
26
26
|
WallAttributes["WALL_HEIGHT"] = "_tkSpace_wallHeight";
|
|
27
27
|
WallAttributes["WALL_THICKNESS"] = "_tkSpace_wallThickness";
|
|
28
|
-
WallAttributes["
|
|
28
|
+
WallAttributes["WALL_MODE"] = "_tkSpace_visibility";
|
|
29
29
|
})(WallAttributes = exports.WallAttributes || (exports.WallAttributes = {}));
|
|
30
|
+
var WallModes;
|
|
31
|
+
(function (WallModes) {
|
|
32
|
+
WallModes["WALL"] = "true";
|
|
33
|
+
WallModes["BOUNDARY"] = "false";
|
|
34
|
+
})(WallModes = exports.WallModes || (exports.WallModes = {}));
|
|
35
|
+
exports.wallModeLabels = (_a = {},
|
|
36
|
+
_a[WallModes.WALL] = 'Wall',
|
|
37
|
+
_a[WallModes.BOUNDARY] = 'Boundary',
|
|
38
|
+
_a);
|
|
30
39
|
var WallMetadata;
|
|
31
40
|
(function (WallMetadata) {
|
|
32
41
|
WallMetadata["MIN_LENGTH"] = "_tkSpace_minLength";
|
|
@@ -56,24 +65,33 @@ var DoorOpeningDirections;
|
|
|
56
65
|
DoorOpeningDirections["INSIDE"] = "inside";
|
|
57
66
|
DoorOpeningDirections["OUTSIDE"] = "outside";
|
|
58
67
|
})(DoorOpeningDirections = exports.DoorOpeningDirections || (exports.DoorOpeningDirections = {}));
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
var DoorShowSwing;
|
|
69
|
+
(function (DoorShowSwing) {
|
|
70
|
+
DoorShowSwing["SHOW"] = "true";
|
|
71
|
+
DoorShowSwing["HIDE"] = "false";
|
|
72
|
+
})(DoorShowSwing = exports.DoorShowSwing || (exports.DoorShowSwing = {}));
|
|
73
|
+
exports.ATTRIBUTE_NAME_DEFAULTS = (_b = {},
|
|
74
|
+
_b[types_1.IElements.WALL] = SpacesAttributes.WALLS,
|
|
75
|
+
_b[types_1.IElements.WINDOW] = SpacesAttributes.WINDOWS,
|
|
76
|
+
_b[types_1.IElements.OPENING] = SpacesAttributes.OPENINGS,
|
|
77
|
+
_b[types_1.IElements.DOOR] = SpacesAttributes.DOORS,
|
|
78
|
+
_b.featurePositionX = FeatureAttributes.POSITION_X,
|
|
79
|
+
_b.featurePositionY = FeatureAttributes.POSITION_Y,
|
|
80
|
+
_b.featureConnectedTo = FeatureAttributes.CONNECTED_TO,
|
|
81
|
+
_b.featureHeight = FeatureAttributes.FEATURE_HEIGHT,
|
|
82
|
+
_b.featureLength = FeatureAttributes.FEATURE_LENGTH,
|
|
83
|
+
_b.wallStartX = WallAttributes.START_X,
|
|
84
|
+
_b.wallStartY = WallAttributes.START_Y,
|
|
85
|
+
_b.wallStartZ = WallAttributes.START_Z,
|
|
86
|
+
_b.wallEndX = WallAttributes.END_X,
|
|
87
|
+
_b.wallEndY = WallAttributes.END_Y,
|
|
88
|
+
_b.wallEndZ = WallAttributes.END_Z,
|
|
89
|
+
_b.wallConnections = WallAttributes.CONNECTIONS,
|
|
90
|
+
_b.wallMode = WallAttributes.WALL_MODE,
|
|
91
|
+
_b.doorOrientation = DoorAttributes.ORIENTATION,
|
|
92
|
+
_b.doorOpeningDirection = DoorAttributes.OPENING_DIRECTION,
|
|
93
|
+
_b.doorShowSwing = DoorAttributes.SHOW_SWING,
|
|
94
|
+
_b);
|
|
77
95
|
exports.SCALE = 0.02;
|
|
78
96
|
exports.SNAP_PROXIMITY = 16;
|
|
79
97
|
exports.ZOOM_MAX = 100;
|
|
@@ -83,27 +101,30 @@ exports.ZOOM_SENSITIVITY = 0.8;
|
|
|
83
101
|
exports.TRANSLATE_MAX = [-400, -400];
|
|
84
102
|
exports.TRANSLATE_MIN = [400, 400];
|
|
85
103
|
exports.TRANSLATE_DEFAULT = [-200, -200];
|
|
86
|
-
exports.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
_c[types_1.IUnits.CM] =
|
|
94
|
-
_c[types_1.IUnits.METER] = 1,
|
|
95
|
-
_c[types_1.IUnits.FEET] = 3.28084,
|
|
96
|
-
_c[types_1.IUnits.INCH] = 39.37,
|
|
104
|
+
exports.GRID_SNAPPING_ENABLED = true;
|
|
105
|
+
exports.ANGLE_SNAPPING_ENABLED = false;
|
|
106
|
+
exports.GUIDE_SNAPPING_ENABLED = true;
|
|
107
|
+
exports.UNIT_LABELS = (_c = {},
|
|
108
|
+
_c[types_1.IUnits.FEET] = 'ft',
|
|
109
|
+
_c[types_1.IUnits.METER] = 'm',
|
|
110
|
+
_c[types_1.IUnits.INCH] = 'in',
|
|
111
|
+
_c[types_1.IUnits.CM] = 'cm',
|
|
97
112
|
_c);
|
|
98
|
-
exports.
|
|
99
|
-
_d[types_1.
|
|
100
|
-
_d[types_1.
|
|
101
|
-
_d[types_1.
|
|
113
|
+
exports.UNIT_FACTORS = (_d = {},
|
|
114
|
+
_d[types_1.IUnits.CM] = 100,
|
|
115
|
+
_d[types_1.IUnits.METER] = 1,
|
|
116
|
+
_d[types_1.IUnits.FEET] = 3.28084,
|
|
117
|
+
_d[types_1.IUnits.INCH] = 39.37,
|
|
102
118
|
_d);
|
|
119
|
+
exports.FEATURE_LABELS = (_e = {},
|
|
120
|
+
_e[types_1.IElements.WINDOW] = 'Window',
|
|
121
|
+
_e[types_1.IElements.DOOR] = 'Door',
|
|
122
|
+
_e[types_1.IElements.OPENING] = 'Opening',
|
|
123
|
+
_e);
|
|
103
124
|
exports.VALIDATION_CONFIG_DEFAULT = {
|
|
104
125
|
padding: 0.2,
|
|
105
126
|
minLength: 0.5,
|
|
106
127
|
};
|
|
107
|
-
exports.FEATURE_LENGTH =
|
|
128
|
+
exports.FEATURE_LENGTH = 1;
|
|
108
129
|
exports.UI_ANCHOR_DISTANCE = -60;
|
|
109
130
|
exports.WALL_SNAP_DISTANCE = 12;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { IWalls, ISpacesStateProps, IVerticesState, IFeatures, IWallsValidationConfig, IAttributeDefaults } from './types';
|
|
1
|
+
import type { IWalls, ISpacesStateProps, IVerticesState, IFeatures, ISpacesAttributes, IWallsValidationConfig, IAttributeDefaults } from './types';
|
|
2
2
|
import { IUnits } from './types';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { WallModes } from './constants';
|
|
4
|
+
import type { IConfiguration, IHydratedAttribute, IThreekitConfigurator } from '../../types';
|
|
5
|
+
export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps, attributeDefaults: IAttributeDefaults & {
|
|
6
|
+
wallMode: WallModes;
|
|
7
|
+
}): {
|
|
5
8
|
validationConfig: IWallsValidationConfig;
|
|
6
9
|
features: {};
|
|
7
10
|
walls: IWalls;
|
|
8
11
|
vertex: IVerticesState;
|
|
9
12
|
};
|
|
10
|
-
export declare function getAttributeDefaults(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps): IAttributeDefaults;
|
|
11
13
|
export declare function prepAttributesOutgoing(walls: IWalls, features: IFeatures, config: ISpacesStateProps): {
|
|
12
14
|
[x: string]: import("../../types").IConfigurationAttribute | {
|
|
13
15
|
assetId: string;
|
|
@@ -18,3 +20,19 @@ export declare function convertLengthUnit(value: number, from: IUnits, to: IUnit
|
|
|
18
20
|
export declare function convertAreaUnit(value: number, from: IUnits, to: IUnits): number;
|
|
19
21
|
export declare function prepLengthForUser(value: number, unit: IUnits): string;
|
|
20
22
|
export declare function prepAreaForUser(value: number, unit: IUnits): string;
|
|
23
|
+
export declare function getAttributeData(configurator: IThreekitConfigurator, attributeNames: ISpacesAttributes): Promise<{
|
|
24
|
+
defaults: {
|
|
25
|
+
walls: string;
|
|
26
|
+
doors: string;
|
|
27
|
+
windows: string;
|
|
28
|
+
openings: string;
|
|
29
|
+
doorShowSwing: string;
|
|
30
|
+
doorOrientation: string;
|
|
31
|
+
doorOpeningDirection: string;
|
|
32
|
+
};
|
|
33
|
+
wallModes: {
|
|
34
|
+
options: WallModes[];
|
|
35
|
+
assetIds: Record<WallModes, string>;
|
|
36
|
+
value: WallModes;
|
|
37
|
+
};
|
|
38
|
+
}>;
|