@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
package/dist/store/treble.js
CHANGED
|
@@ -186,8 +186,9 @@ var initPlayer = function (config) {
|
|
|
186
186
|
orgId = player.enableApi(types_1.PRIVATE_APIS.PLAYER).orgId;
|
|
187
187
|
connection_1.default.connect({ orgId: orgId });
|
|
188
188
|
cacheParameters = player.cacheParameters;
|
|
189
|
-
if (cacheParameters)
|
|
189
|
+
if (cacheParameters) {
|
|
190
190
|
connection_1.default.connect({ cacheParameters: cacheParameters });
|
|
191
|
+
}
|
|
191
192
|
if (window.threekit) {
|
|
192
193
|
window.threekit = Object.assign(window.threekit, {
|
|
193
194
|
player: player,
|
|
@@ -208,11 +209,11 @@ var initPlayer = function (config) {
|
|
|
208
209
|
dispatch((0, exports.setPlayerLoading)(false));
|
|
209
210
|
dispatch((0, exports.updateLoadingProgress)(1));
|
|
210
211
|
dispatch((0, exports.setPlayerInteraction)(true));
|
|
211
|
-
|
|
212
|
+
player.on(types_1.SCENE_PHASES.RENDERED, function () {
|
|
212
213
|
dispatch((0, exports.setIsFirstRenderComplete)(true));
|
|
213
214
|
});
|
|
214
215
|
ruleName = 'use-first-player-interaction';
|
|
215
|
-
|
|
216
|
+
player.tools.addTool({
|
|
216
217
|
key: ruleName,
|
|
217
218
|
label: 'use-first-player-interaction',
|
|
218
219
|
active: true,
|
|
@@ -221,7 +222,7 @@ var initPlayer = function (config) {
|
|
|
221
222
|
mousedown: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
222
223
|
return __generator(this, function (_a) {
|
|
223
224
|
dispatch((0, exports.setPlayerInteraction)(false));
|
|
224
|
-
|
|
225
|
+
player.tools.removeTool(ruleName);
|
|
225
226
|
return [2];
|
|
226
227
|
});
|
|
227
228
|
}); },
|
|
@@ -229,24 +230,20 @@ var initPlayer = function (config) {
|
|
|
229
230
|
});
|
|
230
231
|
if (window.threekit.treble._debugMode)
|
|
231
232
|
(0, utils_1.runDebugger)();
|
|
232
|
-
|
|
233
|
-
var
|
|
233
|
+
player.on('setConfiguration', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
234
|
+
var attributes, previousAttributes, updatedAttributes;
|
|
234
235
|
var _a;
|
|
235
236
|
return __generator(this, function (_b) {
|
|
236
237
|
switch (_b.label) {
|
|
237
|
-
case 0:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
attributes =
|
|
241
|
-
|
|
242
|
-
updatedAttributes =
|
|
243
|
-
return Object.assign({}, attr, configuration[attr.name]
|
|
244
|
-
? { value: configuration[attr.name] }
|
|
245
|
-
: undefined);
|
|
246
|
-
});
|
|
238
|
+
case 0: return [4, window.threekit.treble._player.api.evaluate()];
|
|
239
|
+
case 1:
|
|
240
|
+
_b.sent();
|
|
241
|
+
attributes = getState().attributes;
|
|
242
|
+
previousAttributes = Object.values(attributes);
|
|
243
|
+
updatedAttributes = configurator.getDisplayAttributes();
|
|
247
244
|
dispatch((0, attributes_1.setAttributes)(updatedAttributes));
|
|
248
245
|
return [4, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
|
|
249
|
-
case
|
|
246
|
+
case 2:
|
|
250
247
|
_b.sent();
|
|
251
248
|
return [2];
|
|
252
249
|
}
|
|
@@ -260,7 +257,7 @@ var initPlayer = function (config) {
|
|
|
260
257
|
exports.initPlayer = initPlayer;
|
|
261
258
|
var launch = function (launchConfig) {
|
|
262
259
|
return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
263
|
-
var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, stageId, configurationId, initialConfigurationRaw, assetId, threekitDomainRaw, authToken,
|
|
260
|
+
var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, stageId, configurationId, initialConfigurationRaw, assetId, threekitDomainRaw, authToken, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
|
|
264
261
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
265
262
|
return __generator(this, function (_j) {
|
|
266
263
|
switch (_j.label) {
|
|
@@ -324,7 +321,7 @@ var launch = function (launchConfig) {
|
|
|
324
321
|
_a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
|
|
325
322
|
assetId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
|
|
326
323
|
threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
|
|
327
|
-
authToken = envCredentials.publicToken
|
|
324
|
+
authToken = envCredentials.publicToken;
|
|
328
325
|
if (playerConfig.elementId) {
|
|
329
326
|
el = document.getElementById(playerConfig.elementId);
|
|
330
327
|
if (el)
|
|
@@ -362,8 +359,7 @@ var launch = function (launchConfig) {
|
|
|
362
359
|
return [2, console.error('missing assetId')];
|
|
363
360
|
return [4, new Promise(function (resolve) {
|
|
364
361
|
var script = document.createElement('script');
|
|
365
|
-
script.src =
|
|
366
|
-
playerScriptUrl || "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
|
|
362
|
+
script.src = "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
|
|
367
363
|
script.id = 'threekit-player-bundle';
|
|
368
364
|
script.onload = function () { return resolve(); };
|
|
369
365
|
document.head.appendChild(script);
|
package/dist/types.d.ts
CHANGED
|
@@ -280,10 +280,6 @@ export interface IThreekitConfigurator {
|
|
|
280
280
|
setConfiguration: (configuration: ISetConfiguration | IConfiguration) => Promise<IConfiguration>;
|
|
281
281
|
getPrice: (pricebookId: string, currency: string) => number;
|
|
282
282
|
getDisplayAttributes: (config?: IDisplayAttributeConfig) => Array<IThreekitDisplayAttribute>;
|
|
283
|
-
getNestedConfigurator: (path: string | Array<string | number>) => IThreekitConfigurator | undefined;
|
|
284
|
-
getFullConfiguration: () => IConfiguration;
|
|
285
|
-
setFullConfiguration: (configuration: IConfiguration) => Promise<void>;
|
|
286
|
-
on: (eventName: string, callback: () => void) => void;
|
|
287
283
|
}
|
|
288
284
|
export interface IThreekitScene {
|
|
289
285
|
PHASES: {
|
|
@@ -345,6 +341,9 @@ export interface IThreekitPrivatePlayer {
|
|
|
345
341
|
configurator: IThreekitPrivateConfigurator;
|
|
346
342
|
calculateLogs: () => Promise<Record<string, any>>;
|
|
347
343
|
getAssetInstance: (query: ISceneQueryNode | string) => Promise<string>;
|
|
344
|
+
api: {
|
|
345
|
+
evaluate: () => Promise<void>;
|
|
346
|
+
};
|
|
348
347
|
}
|
|
349
348
|
export interface ThreekitInitConfig {
|
|
350
349
|
authToken: string;
|
|
@@ -386,7 +385,6 @@ export interface ICredential {
|
|
|
386
385
|
publicToken: string;
|
|
387
386
|
publishStage?: string;
|
|
388
387
|
threekitDomain?: string;
|
|
389
|
-
playerScriptUrl?: string;
|
|
390
388
|
}
|
|
391
389
|
export interface ICredentials extends Record<string, ICredential> {
|
|
392
390
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { ICoordinate2D } from './types';
|
|
3
|
-
interface ISpacesLayout {
|
|
4
|
-
loops?: Array<ICoordinate2D[]>;
|
|
5
|
-
size?: number;
|
|
6
|
-
color?: string;
|
|
7
|
-
padding?: number;
|
|
8
|
-
strokeWidth?: number;
|
|
9
|
-
}
|
|
10
|
-
export default function SpacesLayout(props: ISpacesLayout): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,74 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
function SpacesLayout(props) {
|
|
19
|
-
var loops = props.loops;
|
|
20
|
-
var size = props.size || 20;
|
|
21
|
-
var padding = props.padding || 2;
|
|
22
|
-
var strokeWidth = props.strokeWidth || 2;
|
|
23
|
-
if (!(loops === null || loops === void 0 ? void 0 : loops.length))
|
|
24
|
-
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
25
|
-
var _a = loops.reduce(function (output, loop, i) {
|
|
26
|
-
loop.forEach(function (_a, j) {
|
|
27
|
-
var x = _a[0], y = _a[1];
|
|
28
|
-
if (!i && !j) {
|
|
29
|
-
output = {
|
|
30
|
-
xMin: x,
|
|
31
|
-
yMin: y,
|
|
32
|
-
xMax: x,
|
|
33
|
-
yMax: y,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
if (x < output.xMin)
|
|
38
|
-
output.xMin = x;
|
|
39
|
-
else if (x > output.xMax)
|
|
40
|
-
output.xMax = x;
|
|
41
|
-
if (y < output.yMin)
|
|
42
|
-
output.yMin = y;
|
|
43
|
-
else if (y > output.yMax)
|
|
44
|
-
output.yMax = y;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return output;
|
|
48
|
-
}, {
|
|
49
|
-
xMin: 0,
|
|
50
|
-
yMin: 0,
|
|
51
|
-
xMax: 0,
|
|
52
|
-
yMax: 0,
|
|
53
|
-
}), xMin = _a.xMin, yMin = _a.yMin, xMax = _a.xMax, yMax = _a.yMax;
|
|
54
|
-
var xSpan = xMax - xMin;
|
|
55
|
-
var ySpan = yMax - yMin;
|
|
56
|
-
var xCenter = xMin + xSpan / 2;
|
|
57
|
-
var yCenter = yMin + ySpan / 2;
|
|
58
|
-
var scaleFactor = (size - 2 * padding) / Math.max(xSpan, ySpan);
|
|
59
|
-
var translate = [
|
|
60
|
-
xCenter * scaleFactor - size / 2,
|
|
61
|
-
yCenter * scaleFactor - size / 2,
|
|
62
|
-
];
|
|
63
|
-
return (react_1.default.createElement("svg", __assign({ width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), loops.map(function (loop, i) {
|
|
64
|
-
var path = loop
|
|
65
|
-
.map(function (point, i) {
|
|
66
|
-
var x = point[0] * scaleFactor - translate[0];
|
|
67
|
-
var y = point[1] * scaleFactor - translate[1];
|
|
68
|
-
return (!i ? 'M ' : 'L ') + x + ' ' + y;
|
|
69
|
-
})
|
|
70
|
-
.join(' ') + ' Z';
|
|
71
|
-
return (react_1.default.createElement("path", { key: "path-".concat(i), d: path, stroke: props.color, strokeWidth: strokeWidth }));
|
|
72
|
-
})));
|
|
73
|
-
}
|
|
74
|
-
exports.default = SpacesLayout;
|
|
@@ -1,162 +0,0 @@
|
|
|
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';
|
|
2
|
-
import { IUnits } from './types';
|
|
3
|
-
import type { IHydratedAttribute } from '../../types';
|
|
4
|
-
export declare class SpacesState {
|
|
5
|
-
private _config;
|
|
6
|
-
private _attributesState;
|
|
7
|
-
private _attributeDefaults;
|
|
8
|
-
private _newWall;
|
|
9
|
-
private _activeElement;
|
|
10
|
-
private _selectedElement;
|
|
11
|
-
private _highlightedElement;
|
|
12
|
-
private _errorElement;
|
|
13
|
-
private _showDimensions;
|
|
14
|
-
private _angleSnappingEnabled;
|
|
15
|
-
private _guideSnappingEnabled;
|
|
16
|
-
private _guides;
|
|
17
|
-
private _gridSnappingEnabled;
|
|
18
|
-
private _zoom;
|
|
19
|
-
private _zoomLimits;
|
|
20
|
-
private _canvasDimensions;
|
|
21
|
-
private _translate;
|
|
22
|
-
private _translateLimits;
|
|
23
|
-
private _unit;
|
|
24
|
-
private _validationConfig;
|
|
25
|
-
private _state;
|
|
26
|
-
constructor(config: ISpacesStateProps);
|
|
27
|
-
get styles(): import("./types").ISpacesStyles;
|
|
28
|
-
get attributeDefaults(): IAttributeDefaults;
|
|
29
|
-
set attributeDefaults(val: IAttributeDefaults);
|
|
30
|
-
get scale(): number;
|
|
31
|
-
get snapProximity(): number;
|
|
32
|
-
get gridUnitLength(): number;
|
|
33
|
-
get gridUnitLengthToDraw(): number;
|
|
34
|
-
get gridOffset(): ICoordinate2D;
|
|
35
|
-
get gridToDraw(): IGridToDraw;
|
|
36
|
-
get walls(): IWalls;
|
|
37
|
-
get wallsToDraw(): {
|
|
38
|
-
line: ICoordinatesLine;
|
|
39
|
-
path: undefined;
|
|
40
|
-
assetId: string;
|
|
41
|
-
connections: [elementType: IFeatureName, index: number][];
|
|
42
|
-
restConfiguration: string;
|
|
43
|
-
}[];
|
|
44
|
-
set walls(walls: IWalls);
|
|
45
|
-
get wallCount(): number;
|
|
46
|
-
get wallLines(): ICoordinatesLine[];
|
|
47
|
-
get vertices(): IVerticesState;
|
|
48
|
-
get verticesToDraw(): IVerticesState;
|
|
49
|
-
set vertices(vertices: IVerticesState);
|
|
50
|
-
get verticesList(): Array<IVertex>;
|
|
51
|
-
get verticesListToDraw(): Array<IVertex>;
|
|
52
|
-
get features(): IFeatures;
|
|
53
|
-
get featuresToDraw(): Record<string, IFeature[] | IFeatureDoor[]>;
|
|
54
|
-
set features(features: IFeatures);
|
|
55
|
-
get getHydratedFeatures(): undefined | IFeaturesHydrated;
|
|
56
|
-
get featureCount(): number;
|
|
57
|
-
get activeElement(): IActiveElement | null;
|
|
58
|
-
get selectedElement(): null | IElementAddress;
|
|
59
|
-
set selectedElement(element: null | IElementAddress);
|
|
60
|
-
get showDimensions(): boolean;
|
|
61
|
-
set showDimensions(val: boolean);
|
|
62
|
-
get angleSnappingEnabled(): boolean;
|
|
63
|
-
set angleSnappingEnabled(val: boolean);
|
|
64
|
-
get guideSnappingEnabled(): boolean;
|
|
65
|
-
set guideSnappingEnabled(val: boolean);
|
|
66
|
-
get gridSnappingEnabled(): boolean;
|
|
67
|
-
set gridSnappingEnabled(val: boolean);
|
|
68
|
-
get guides(): IGuides | null;
|
|
69
|
-
set guides(val: IGuides | null);
|
|
70
|
-
get enclosedSpacesToDraw(): Array<IEnclosedSpace>;
|
|
71
|
-
get canvasDimensions(): ICoordinate2D;
|
|
72
|
-
get canvasWidth(): number;
|
|
73
|
-
get canvasHeight(): number;
|
|
74
|
-
set canvasDimensions(dimensions: ICoordinate2D);
|
|
75
|
-
get zoom(): number;
|
|
76
|
-
get zoomFactor(): number;
|
|
77
|
-
set zoomFactor(val: number);
|
|
78
|
-
get zoomMin(): number;
|
|
79
|
-
get zoomMax(): number;
|
|
80
|
-
set zoom(delta: number);
|
|
81
|
-
get unit(): IUnits;
|
|
82
|
-
set unit(unit: IUnits);
|
|
83
|
-
get translate(): ICoordinate2D;
|
|
84
|
-
get translateMin(): ICoordinate2D;
|
|
85
|
-
get translateMax(): ICoordinate2D;
|
|
86
|
-
set translate(position: ICoordinate2D);
|
|
87
|
-
get isDrawWallActive(): boolean;
|
|
88
|
-
get validationConfig(): IWallsValidationConfig;
|
|
89
|
-
set validationConfig(config: IWallsValidationConfig);
|
|
90
|
-
private transformLengthFromCanvas;
|
|
91
|
-
private transformLengthToCanvas;
|
|
92
|
-
private transformPointToCanvas;
|
|
93
|
-
private transformPointFromCanvas;
|
|
94
|
-
private transformLineToCanvas;
|
|
95
|
-
private getWall;
|
|
96
|
-
private addWall;
|
|
97
|
-
private addWalls;
|
|
98
|
-
private updateWall;
|
|
99
|
-
private getWallConnectionCount;
|
|
100
|
-
private getWallConnectionsHydrated;
|
|
101
|
-
private getWallDimensions;
|
|
102
|
-
private getWallDimensionsByIndex;
|
|
103
|
-
private getWallDetailedDimensionsByIndex;
|
|
104
|
-
private getAllWallDimensionsToDraw;
|
|
105
|
-
private shiftAllFeaturesOnWall;
|
|
106
|
-
private addFeatureToWall;
|
|
107
|
-
private removeFeatureFromWall;
|
|
108
|
-
splitWallAtOffset(wallIndex: number, offset?: number): void;
|
|
109
|
-
private splitWallAtPoint;
|
|
110
|
-
deleteWall(index: number): void;
|
|
111
|
-
private getFirstVacantLocationOnWallIndex;
|
|
112
|
-
private getFirstVacantLocation;
|
|
113
|
-
getWallUiAnchorPoint(index: number): undefined | ICoordinate2D;
|
|
114
|
-
private getVertex;
|
|
115
|
-
private getWallsConnectedToVertex;
|
|
116
|
-
private repositionVertex;
|
|
117
|
-
private getFeatureType;
|
|
118
|
-
private setFeatureType;
|
|
119
|
-
private getFeature;
|
|
120
|
-
private updateFeature;
|
|
121
|
-
private repositionFeature;
|
|
122
|
-
addFeature(type: IFeatureName, addToWallIndex?: number, feature?: Partial<Pick<IFeature, 'assetId' | 'offset' | 'length' | 'height' | 'altitude'>>): void;
|
|
123
|
-
deleteFeature(type: IFeatureName, index: number): void;
|
|
124
|
-
private getHydratedFeature;
|
|
125
|
-
getFeatureUiAnchorPoint(type: IFeatureName, index: number): undefined | ICoordinate2D;
|
|
126
|
-
deleteElement(type: IElementName, index: number): void;
|
|
127
|
-
private getVertexIndexInProximity;
|
|
128
|
-
private getWallIndexInProximity;
|
|
129
|
-
private getSnapPointToVertexInProximity;
|
|
130
|
-
private getSnapPointToWallInProximity;
|
|
131
|
-
private getSnapPointToAngleInProximity;
|
|
132
|
-
private getSnapVertexToGuideInProximity;
|
|
133
|
-
private getSnapActiveVertexToGuideInProximity;
|
|
134
|
-
private getSnapPointToGridInProximity;
|
|
135
|
-
private getFeatureAtPoint;
|
|
136
|
-
private getElementAddressAtPoint;
|
|
137
|
-
getElementUiAtPoint(cursorPoint: ICoordinate2D): undefined | IElementUi;
|
|
138
|
-
private getSnapPointToElementInProximity;
|
|
139
|
-
private runValidators;
|
|
140
|
-
private reevaluateFeatureConnections;
|
|
141
|
-
private pushStateToConfigurator;
|
|
142
|
-
setAttributesToState(attributes?: Record<string, IHydratedAttribute>): void;
|
|
143
|
-
deleteAll(): void;
|
|
144
|
-
private resetInternalState;
|
|
145
|
-
highlightElementIfInProximity(canvas: HTMLCanvasElement, cursorPoint: ICoordinate2D): void;
|
|
146
|
-
centerSpace(canvas: HTMLCanvasElement | null, zoomToFit?: boolean): void;
|
|
147
|
-
showGuideAtPoint(canvas: HTMLCanvasElement, cursorPoint: ICoordinate2D): void;
|
|
148
|
-
startDrawNewWall(startPoint: ICoordinate2D): void;
|
|
149
|
-
drawNewWall(canvas: HTMLCanvasElement, endPoint: ICoordinate2D): void;
|
|
150
|
-
cancelDrawNewWall(canvas: HTMLCanvasElement): void;
|
|
151
|
-
finishDrawNewWall(canvas: HTMLCanvasElement, assetId?: string): Promise<void>;
|
|
152
|
-
private moveActiveVertex;
|
|
153
|
-
private finishMoveActiveVertex;
|
|
154
|
-
private moveActiveFeature;
|
|
155
|
-
private finishMoveActiveFeature;
|
|
156
|
-
selectElementIfInProximity(canvas: HTMLCanvasElement, cursorPoint: ICoordinate2D): void;
|
|
157
|
-
moveActiveElement(canvas: HTMLCanvasElement, moveToPoint: ICoordinate2D): void;
|
|
158
|
-
finishMoveActiveElement(canvas: HTMLCanvasElement): void;
|
|
159
|
-
cancelMoveActiveElement(canvas: HTMLCanvasElement): void;
|
|
160
|
-
drawSpaces(canvas: HTMLCanvasElement | null): void;
|
|
161
|
-
}
|
|
162
|
-
export default SpacesState;
|