kitchen-simulator 1.1.1-test.48 → 1.1.1-test.49
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/lib/KitchenConfiguratorApp.js +3 -0
- package/package.json +1 -1
- package/es/@history.js +0 -2
- package/es/AppContext.js +0 -3
- package/es/KitchenConfigurator.js +0 -645
- package/es/KitchenConfiguratorApp.js +0 -478
- package/es/actions/area-actions.js +0 -14
- package/es/actions/export.js +0 -23
- package/es/actions/groups-actions.js +0 -89
- package/es/actions/holes-actions.js +0 -119
- package/es/actions/items-actions.js +0 -313
- package/es/actions/lines-actions.js +0 -81
- package/es/actions/project-actions.js +0 -281
- package/es/actions/scene-actions.js +0 -33
- package/es/actions/vertices-actions.js +0 -27
- package/es/actions/viewer2d-actions.js +0 -58
- package/es/actions/viewer3d-actions.js +0 -23
- package/es/catalog/areas/area/planner-element.js +0 -40
- package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
- package/es/catalog/areas/area/textures/grass.jpg +0 -0
- package/es/catalog/areas/area/textures/parquet.jpg +0 -0
- package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
- package/es/catalog/areas/area/textures/tile1.jpg +0 -0
- package/es/catalog/catalog.js +0 -277
- package/es/catalog/envMap/nx.hdr +0 -0
- package/es/catalog/envMap/ny.hdr +0 -0
- package/es/catalog/envMap/nz.hdr +0 -0
- package/es/catalog/envMap/px.hdr +0 -0
- package/es/catalog/envMap/py.hdr +0 -0
- package/es/catalog/envMap/pz.hdr +0 -0
- package/es/catalog/factories/area-factory-3d.js +0 -181
- package/es/catalog/factories/area-factory.js +0 -81
- package/es/catalog/factories/export.js +0 -7
- package/es/catalog/factories/wall-factory-3d.js +0 -202
- package/es/catalog/factories/wall-factory.js +0 -268
- package/es/catalog/holes/door-closet/planner-element.js +0 -222
- package/es/catalog/holes/door-double/door_double.png +0 -0
- package/es/catalog/holes/door-double/planner-element.js +0 -315
- package/es/catalog/holes/door-exterior/planner-element.js +0 -215
- package/es/catalog/holes/door-interior/planner-element.js +0 -227
- package/es/catalog/holes/door-panic/panicDoor.png +0 -0
- package/es/catalog/holes/door-panic/planner-element.js +0 -503
- package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
- package/es/catalog/holes/door-panic-double/planner-element.js +0 -463
- package/es/catalog/holes/door-sliding/planner-element.js +0 -225
- package/es/catalog/holes/doorway-framed/planner-element.js +0 -145
- package/es/catalog/holes/doorway-frameless/planner-element.js +0 -104
- package/es/catalog/holes/export.js +0 -13
- package/es/catalog/holes/gate/gate.jpg +0 -0
- package/es/catalog/holes/window-clear/planner-element.js +0 -166
- package/es/catalog/holes/window-clear/texture.png +0 -0
- package/es/catalog/holes/window-cross/planner-element.js +0 -165
- package/es/catalog/holes/window-cross/texture.png +0 -0
- package/es/catalog/holes/window-double-hung/planner-element.js +0 -303
- package/es/catalog/holes/window-double-hung/texture.png +0 -0
- package/es/catalog/holes/window-vertical/planner-element.js +0 -276
- package/es/catalog/holes/window-vertical/texture.png +0 -0
- package/es/catalog/lines/wall/planner-element.js +0 -70
- package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
- package/es/catalog/lines/wall/wall.png +0 -0
- package/es/catalog/molding/molding-dcm/planner-element.js +0 -28
- package/es/catalog/molding/molding-dcm/texture.png +0 -0
- package/es/catalog/molding/molding-fbm/planner-element.js +0 -28
- package/es/catalog/molding/molding-fbm/texture.png +0 -0
- package/es/catalog/molding/molding-lrm/planner-element.js +0 -28
- package/es/catalog/molding/molding-lrm/texture.png +0 -0
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -116
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -97
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -101
- package/es/catalog/properties/property-length-measure.js +0 -134
- package/es/catalog/properties/property-length-measure_hole.js +0 -101
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/catalog/utils/FuseUtils.js +0 -82
- package/es/catalog/utils/exporter.js +0 -148
- package/es/catalog/utils/geom-utils.js +0 -189
- package/es/catalog/utils/item-loader.js +0 -1521
- package/es/catalog/utils/load-obj.js +0 -91
- package/es/catalog/utils/mtl-loader.js +0 -358
- package/es/catalog/utils/obj-loader.js +0 -477
- package/es/class/FuseUtils.js +0 -82
- package/es/class/area.js +0 -145
- package/es/class/export.js +0 -24
- package/es/class/group.js +0 -440
- package/es/class/guide.js +0 -62
- package/es/class/hole.js +0 -929
- package/es/class/item.js +0 -1883
- package/es/class/layer.js +0 -667
- package/es/class/line.js +0 -1180
- package/es/class/project.js +0 -793
- package/es/class/vertex.js +0 -202
- package/es/components/content.js +0 -107
- package/es/components/disclaimer/disclaimer.js +0 -97
- package/es/components/export.js +0 -9
- package/es/components/style/button.js +0 -113
- package/es/components/style/cancel-button.js +0 -22
- package/es/components/style/content-container.js +0 -33
- package/es/components/style/content-title.js +0 -29
- package/es/components/style/delete-button.js +0 -25
- package/es/components/style/export.js +0 -31
- package/es/components/style/form-block.js +0 -24
- package/es/components/style/form-color-input.js +0 -27
- package/es/components/style/form-label.js +0 -26
- package/es/components/style/form-number-input.js +0 -213
- package/es/components/style/form-number-input_2.js +0 -206
- package/es/components/style/form-select.js +0 -68
- package/es/components/style/form-slider.js +0 -61
- package/es/components/style/form-submit-button.js +0 -26
- package/es/components/style/form-text-input.js +0 -95
- package/es/components/viewer2d/area.js +0 -81
- package/es/components/viewer2d/export.js +0 -31
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-streak.js +0 -37
- package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -37
- package/es/components/viewer2d/grids/grids.js +0 -35
- package/es/components/viewer2d/group.js +0 -53
- package/es/components/viewer2d/item.js +0 -513
- package/es/components/viewer2d/layer.js +0 -164
- package/es/components/viewer2d/line.js +0 -882
- package/es/components/viewer2d/ruler.js +0 -100
- package/es/components/viewer2d/rulerDist.js +0 -146
- package/es/components/viewer2d/rulerX.js +0 -151
- package/es/components/viewer2d/rulerY.js +0 -153
- package/es/components/viewer2d/scene.js +0 -140
- package/es/components/viewer2d/snap.js +0 -74
- package/es/components/viewer2d/state.js +0 -78
- package/es/components/viewer2d/utils.js +0 -198
- package/es/components/viewer2d/vertex.js +0 -65
- package/es/components/viewer2d/viewer2d.js +0 -1398
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2592
- package/es/components/viewer3d/dcm.js +0 -401
- package/es/components/viewer3d/fbm.js +0 -414
- package/es/components/viewer3d/front3D.js +0 -66
- package/es/components/viewer3d/grid-creator.js +0 -25
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +0 -36
- package/es/components/viewer3d/grids/grid-streak.js +0 -27
- package/es/components/viewer3d/grids/grid-vertical-streak.js +0 -36
- package/es/components/viewer3d/libs/first-person-controls.js +0 -67
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1281
- package/es/components/viewer3d/libs/mtl-loader.js +0 -357
- package/es/components/viewer3d/libs/obj-loader.js +0 -462
- package/es/components/viewer3d/libs/orbit-controls.js +0 -699
- package/es/components/viewer3d/libs/pointer-lock-controls.js +0 -46
- package/es/components/viewer3d/lrm.js +0 -305
- package/es/components/viewer3d/model.js +0 -708
- package/es/components/viewer3d/pointer-lock-navigation.js +0 -115
- package/es/components/viewer3d/ruler-utils/itemRect.js +0 -61
- package/es/components/viewer3d/ruler-utils/layer3D.js +0 -495
- package/es/components/viewer3d/ruler-utils/ruler3D.js +0 -227
- package/es/components/viewer3d/ruler-utils/scene3D.js +0 -60
- package/es/components/viewer3d/ruler-utils/state3D.js +0 -18
- package/es/components/viewer3d/scene-creator.js +0 -3608
- package/es/components/viewer3d/three-memory-cleaner.js +0 -51
- package/es/components/viewer3d/viewer3d-first-person.js +0 -315
- package/es/components/viewer3d/viewer3d.js +0 -2527
- package/es/constants.js +0 -636
- package/es/index.js +0 -16
- package/es/models.js +0 -510
- package/es/plugins/SVGLoader.js +0 -1412
- package/es/plugins/autosave.js +0 -33
- package/es/plugins/console-debugger.js +0 -37
- package/es/plugins/export.js +0 -9
- package/es/plugins/keyboard.js +0 -101
- package/es/reducers/areas-reducer.js +0 -12
- package/es/reducers/export.js +0 -25
- package/es/reducers/groups-reducer.js +0 -38
- package/es/reducers/holes-reducer.js +0 -62
- package/es/reducers/items-reducer.js +0 -140
- package/es/reducers/lines-reducer.js +0 -45
- package/es/reducers/project-reducer.js +0 -129
- package/es/reducers/reducer.js +0 -19
- package/es/reducers/scene-reducer.js +0 -28
- package/es/reducers/user-reducer.js +0 -40
- package/es/reducers/vertices-reducer.js +0 -19
- package/es/reducers/viewer2d-reducer.js +0 -75
- package/es/reducers/viewer3d-reducer.js +0 -56
- package/es/shared-style.js +0 -66
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/es/translator/en.js +0 -104
- package/es/translator/it.js +0 -79
- package/es/translator/ru.js +0 -79
- package/es/translator/translator.js +0 -84
- package/es/utils/browser.js +0 -33
- package/es/utils/email-validator.js +0 -4
- package/es/utils/export.js +0 -25
- package/es/utils/geometry.js +0 -2420
- package/es/utils/get-edges-of-subgraphs.js +0 -27
- package/es/utils/graph-cycles.js +0 -237
- package/es/utils/graph-inner-cycles.js +0 -46
- package/es/utils/graph.js +0 -150
- package/es/utils/helper.js +0 -268
- package/es/utils/history.js +0 -29
- package/es/utils/id-broker.js +0 -19
- package/es/utils/logger.js +0 -8
- package/es/utils/math.js +0 -50
- package/es/utils/molding.js +0 -871
- package/es/utils/name-generator.js +0 -18
- package/es/utils/objects-utils.js +0 -50
- package/es/utils/phone-validator.js +0 -4
- package/es/utils/process-black-list.js +0 -18
- package/es/utils/react-if.js +0 -18
- package/es/utils/snap-scene.js +0 -99
- package/es/utils/snap.js +0 -237
- package/es/utils/summarizeCart.js +0 -24
- package/es/utils/threeCSG.es6.js +0 -498
- package/es/version.js +0 -2
- package/lib/catalog/properties/property-string.js +0 -55
- package/lib/catalog/properties/property-toggle.js +0 -46
- package/lib/catalog/properties/shared-property-style.js +0 -20
- package/lib/catalog/utils/FuseUtils.js +0 -88
- package/lib/catalog/utils/exporter.js +0 -155
- package/lib/catalog/utils/geom-utils.js +0 -205
- package/lib/catalog/utils/item-loader.js +0 -1533
- package/lib/catalog/utils/load-obj.js +0 -99
- package/lib/catalog/utils/mtl-loader.js +0 -363
- package/lib/catalog/utils/obj-loader.js +0 -482
- package/lib/class/FuseUtils.js +0 -88
- package/lib/class/area.js +0 -150
- package/lib/class/export.js +0 -96
- package/lib/class/group.js +0 -445
- package/lib/class/guide.js +0 -67
- package/lib/class/hole.js +0 -934
- package/lib/class/item.js +0 -1889
- package/lib/class/layer.js +0 -672
- package/lib/class/line.js +0 -1186
- package/lib/class/project.js +0 -799
- package/lib/class/vertex.js +0 -207
- package/lib/components/content.js +0 -116
- package/lib/components/disclaimer/disclaimer.js +0 -105
- package/lib/components/export.js +0 -33
- package/lib/components/style/button.js +0 -120
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -40
- package/lib/components/style/content-title.js +0 -37
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/export.js +0 -121
- package/lib/components/style/form-block.js +0 -31
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -33
- package/lib/components/style/form-number-input.js +0 -220
- package/lib/components/style/form-number-input_2.js +0 -213
- package/lib/components/style/form-select.js +0 -75
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-submit-button.js +0 -35
- package/lib/components/style/form-text-input.js +0 -101
- package/lib/components/viewer2d/area.js +0 -88
- package/lib/components/viewer2d/export.js +0 -121
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-streak.js +0 -44
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer2d/grids/grids.js +0 -44
- package/lib/components/viewer2d/group.js +0 -62
- package/lib/components/viewer2d/item.js +0 -521
- package/lib/components/viewer2d/layer.js +0 -171
- package/lib/components/viewer2d/line.js +0 -892
- package/lib/components/viewer2d/ruler.js +0 -107
- package/lib/components/viewer2d/rulerDist.js +0 -153
- package/lib/components/viewer2d/rulerX.js +0 -158
- package/lib/components/viewer2d/rulerY.js +0 -160
- package/lib/components/viewer2d/scene.js +0 -147
- package/lib/components/viewer2d/snap.js +0 -83
- package/lib/components/viewer2d/state.js +0 -87
- package/lib/components/viewer2d/utils.js +0 -210
- package/lib/components/viewer2d/vertex.js +0 -74
- package/lib/components/viewer2d/viewer2d.js +0 -1405
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2597
- package/lib/components/viewer3d/dcm.js +0 -407
- package/lib/components/viewer3d/fbm.js +0 -420
- package/lib/components/viewer3d/front3D.js +0 -75
- package/lib/components/viewer3d/grid-creator.js +0 -34
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +0 -44
- package/lib/components/viewer3d/grids/grid-streak.js +0 -35
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +0 -44
- package/lib/components/viewer3d/libs/first-person-controls.js +0 -74
- package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1287
- package/lib/components/viewer3d/libs/mtl-loader.js +0 -363
- package/lib/components/viewer3d/libs/obj-loader.js +0 -468
- package/lib/components/viewer3d/libs/orbit-controls.js +0 -705
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +0 -52
- package/lib/components/viewer3d/lrm.js +0 -311
- package/lib/components/viewer3d/model.js +0 -714
- package/lib/components/viewer3d/pointer-lock-navigation.js +0 -122
- package/lib/components/viewer3d/ruler-utils/itemRect.js +0 -68
- package/lib/components/viewer3d/ruler-utils/layer3D.js +0 -502
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +0 -234
- package/lib/components/viewer3d/ruler-utils/scene3D.js +0 -68
- package/lib/components/viewer3d/ruler-utils/state3D.js +0 -25
- package/lib/components/viewer3d/scene-creator.js +0 -3642
- package/lib/components/viewer3d/three-memory-cleaner.js +0 -60
- package/lib/components/viewer3d/viewer3d-first-person.js +0 -320
- package/lib/components/viewer3d/viewer3d.js +0 -2532
- package/lib/constants.js +0 -645
- package/lib/index.js +0 -96
- package/lib/models.js +0 -517
- package/lib/plugins/SVGLoader.js +0 -1417
- package/lib/plugins/autosave.js +0 -39
- package/lib/plugins/console-debugger.js +0 -44
- package/lib/plugins/export.js +0 -33
- package/lib/plugins/keyboard.js +0 -107
- package/lib/reducers/areas-reducer.js +0 -18
- package/lib/reducers/export.js +0 -97
- package/lib/reducers/groups-reducer.js +0 -44
- package/lib/reducers/holes-reducer.js +0 -68
- package/lib/reducers/items-reducer.js +0 -146
- package/lib/reducers/lines-reducer.js +0 -51
- package/lib/reducers/project-reducer.js +0 -135
- package/lib/reducers/reducer.js +0 -26
- package/lib/reducers/scene-reducer.js +0 -34
- package/lib/reducers/user-reducer.js +0 -46
- package/lib/reducers/vertices-reducer.js +0 -25
- package/lib/reducers/viewer2d-reducer.js +0 -82
- package/lib/reducers/viewer3d-reducer.js +0 -63
- package/lib/shared-style.js +0 -72
- package/lib/styles/export.js +0 -13
- package/lib/translator/en.js +0 -110
- package/lib/translator/it.js +0 -85
- package/lib/translator/ru.js +0 -85
- package/lib/translator/translator.js +0 -90
- package/lib/utils/browser.js +0 -40
- package/lib/utils/email-validator.js +0 -10
- package/lib/utils/export.js +0 -56
- package/lib/utils/geometry.js +0 -2516
- package/lib/utils/get-edges-of-subgraphs.js +0 -34
- package/lib/utils/graph-cycles.js +0 -240
- package/lib/utils/graph-inner-cycles.js +0 -54
- package/lib/utils/graph.js +0 -157
- package/lib/utils/helper.js +0 -291
- package/lib/utils/history.js +0 -36
- package/lib/utils/id-broker.js +0 -25
- package/lib/utils/logger.js +0 -14
- package/lib/utils/math.js +0 -57
- package/lib/utils/molding.js +0 -895
- package/lib/utils/name-generator.js +0 -23
- package/lib/utils/objects-utils.js +0 -60
- package/lib/utils/phone-validator.js +0 -10
- package/lib/utils/process-black-list.js +0 -24
- package/lib/utils/react-if.js +0 -24
- package/lib/utils/snap-scene.js +0 -105
- package/lib/utils/snap.js +0 -249
- package/lib/utils/summarizeCart.js +0 -30
- package/lib/utils/threeCSG.es6.js +0 -503
- package/lib/version.js +0 -8
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import PointerLockControls from "./libs/pointer-lock-controls";
|
|
2
|
-
export function initPointerLock(camera, rendererElement) {
|
|
3
|
-
var havePointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document;
|
|
4
|
-
var pointerlockchange = function pointerlockchange(event) {
|
|
5
|
-
controls.enabled = !controls.enabled;
|
|
6
|
-
};
|
|
7
|
-
var requestPointerLockEvent = function requestPointerLockEvent(event) {
|
|
8
|
-
document.body.requestPointerLock = document.body.requestPointerLock || document.body.mozRequestPointerLock || document.body.webkitRequestPointerLock;
|
|
9
|
-
document.body.requestPointerLock();
|
|
10
|
-
};
|
|
11
|
-
if (havePointerLock) {
|
|
12
|
-
document.addEventListener('pointerlockchange', pointerlockchange, false);
|
|
13
|
-
document.addEventListener('mozpointerlockchange', pointerlockchange, false);
|
|
14
|
-
document.addEventListener('webkitpointerlockchange', pointerlockchange, false);
|
|
15
|
-
rendererElement.addEventListener('click', requestPointerLockEvent);
|
|
16
|
-
} else {
|
|
17
|
-
console.log("Your browser doesn't seem to support Pointer Lock API");
|
|
18
|
-
}
|
|
19
|
-
var controls = new PointerLockControls(camera);
|
|
20
|
-
return {
|
|
21
|
-
controls: controls,
|
|
22
|
-
pointerlockChangeEvent: pointerlockchange,
|
|
23
|
-
requestPointerLockEvent: requestPointerLockEvent
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Funzione per il calcolo delle collisioni con gli oggetti contenuti all'interno di un array.
|
|
28
|
-
* L'idea è quella di utilizzare il ray casting. Per tenere conto del fatto che ci possiamo
|
|
29
|
-
* muovere nelle quattro direzioni, applico una matrice di rotazione alla direzione verso la
|
|
30
|
-
* quale l'oggetto del pointer lock è orientato. */
|
|
31
|
-
|
|
32
|
-
function collision(controls, collisionArray) {
|
|
33
|
-
var rotationMatrix;
|
|
34
|
-
var cameraDirection = controls.getDirection(new THREE.Vector3(0, 0, 0)).clone();
|
|
35
|
-
if (controls.moveForward()) {
|
|
36
|
-
// Nothing to do!
|
|
37
|
-
} else if (controls.moveBackward()) {
|
|
38
|
-
rotationMatrix = new THREE.Matrix4();
|
|
39
|
-
rotationMatrix.makeRotationY(180 * Math.PI / 180);
|
|
40
|
-
} else if (controls.moveLeft()) {
|
|
41
|
-
rotationMatrix = new THREE.Matrix4();
|
|
42
|
-
rotationMatrix.makeRotationY(90 * Math.PI / 180);
|
|
43
|
-
} else if (controls.moveRight()) {
|
|
44
|
-
rotationMatrix = new THREE.Matrix4();
|
|
45
|
-
rotationMatrix.makeRotationY((360 - 90) * Math.PI / 180);
|
|
46
|
-
} else return;
|
|
47
|
-
if (rotationMatrix !== undefined) {
|
|
48
|
-
cameraDirection.applyMatrix4(rotationMatrix);
|
|
49
|
-
}
|
|
50
|
-
var rayCaster = new THREE.Raycaster(controls.getObject().position, cameraDirection.normalize());
|
|
51
|
-
var intersects = rayCaster.intersectObjects(collisionArray, true);
|
|
52
|
-
if (intersects.length > 0 && intersects[0].distance < 10) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/* Funzione meno raffinata per il calcolo delle collisioni.
|
|
59
|
-
* In pratica viene definita una bounding geometry (in questo caso la skymap) e poi vengono fatti
|
|
60
|
-
* partire una serie di raggi dall'object del controller fino ai vertici di questa geometria. Se uno di questi interseca
|
|
61
|
-
* uno degli oggetti dei quali vogliamo controllare la collisione, allora la funzione restituirà il valore true */
|
|
62
|
-
/*
|
|
63
|
-
function collision(object, boundingGeometry, collisionArray ) {
|
|
64
|
-
|
|
65
|
-
for (let vertexIndex = 0; vertexIndex < boundingGeometry.geometry.vertices.length; vertexIndex++) {
|
|
66
|
-
let localVertex = boundingGeometry.geometry.vertices[vertexIndex].clone();
|
|
67
|
-
let globalVertex = localVertex.applyMatrix4( object.matrix );
|
|
68
|
-
let directionVector = globalVertex.sub( object.position );
|
|
69
|
-
|
|
70
|
-
let ray = new THREE.Raycaster(object.position, directionVector.clone().normalize());
|
|
71
|
-
let collisionResults = ray.intersectObjects(collisionArray, true);
|
|
72
|
-
if (collisionResults.length > 0 && collisionResults[0].distance < directionVector.length() - 1293) {
|
|
73
|
-
console.log("collisione: ",collisionResults[0].distance," ",directionVector.length()-1293);
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/* Questa funzione si occupa di determinare se il controllo si trova su un oggetto, in caso negativo cade verso il basso
|
|
82
|
-
* (vedi esempio pointer lock) */
|
|
83
|
-
|
|
84
|
-
function translateY(controls, ray, objects) {
|
|
85
|
-
controls.isOnObject(false);
|
|
86
|
-
ray.ray.origin.copy(controls.getObject().position);
|
|
87
|
-
ray.ray.origin.y -= 10;
|
|
88
|
-
var intersections = ray.intersectObjects(objects, true);
|
|
89
|
-
if (intersections.length > 0) {
|
|
90
|
-
var distance = intersections[0].distance;
|
|
91
|
-
if (distance > 0 && distance < 10) {
|
|
92
|
-
controls.isOnObject(true);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Queste funzioni bloccano o sbloccano il movimento del controller (utili in caso di collisione) */
|
|
98
|
-
|
|
99
|
-
function lockDirection(controls) {
|
|
100
|
-
if (controls.moveForward()) {
|
|
101
|
-
controls.lockMoveForward(true);
|
|
102
|
-
} else if (controls.moveBackward()) {
|
|
103
|
-
controls.lockMoveBackward(true);
|
|
104
|
-
} else if (controls.moveLeft()) {
|
|
105
|
-
controls.lockMoveLeft(true);
|
|
106
|
-
} else if (controls.moveRight()) {
|
|
107
|
-
controls.lockMoveRight(true);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function unlockAllDirection(controls) {
|
|
111
|
-
controls.lockMoveForward(false);
|
|
112
|
-
controls.lockMoveBackward(false);
|
|
113
|
-
controls.lockMoveLeft(false);
|
|
114
|
-
controls.lockMoveRight(false);
|
|
115
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MODE_BACK_ELEVATION_VIEW, MODE_FRONT_ELEVATION_VIEW, MODE_LEFT_ELEVATION_VIEW, MODE_RIGHT_ELEVATION_VIEW } from "../../../constants";
|
|
3
|
-
import convert from 'convert-units';
|
|
4
|
-
export default function ItemRect(_ref) {
|
|
5
|
-
var scene = _ref.scene,
|
|
6
|
-
layer = _ref.layer,
|
|
7
|
-
calcrect = _ref.calcrect,
|
|
8
|
-
v0 = _ref.v0,
|
|
9
|
-
v1 = _ref.v1,
|
|
10
|
-
mode = _ref.mode,
|
|
11
|
-
frontRect = _ref.frontRect,
|
|
12
|
-
scale = _ref.scale,
|
|
13
|
-
sideFlag = _ref.sideFlag;
|
|
14
|
-
var rect = calcrect.rect;
|
|
15
|
-
var x0 = v0.x,
|
|
16
|
-
y0 = v0.y;
|
|
17
|
-
var x1 = v1.x,
|
|
18
|
-
y1 = v1.y;
|
|
19
|
-
var translateY = frontRect.height / 2 - convert(Math.abs(calcrect.itemInfo.properties.altitude._length)).from(calcrect.itemInfo.properties.altitude._unit).to(layer.unit) * scale;
|
|
20
|
-
var translateX = -frontRect.width / 2;
|
|
21
|
-
var itemWidth = convert(calcrect.size.width).from(scene.unit).to(layer.unit) * scale;
|
|
22
|
-
var itemDepth = convert(calcrect.size.depth).from(scene.unit).to(layer.unit) * scale;
|
|
23
|
-
var itemHeight = convert(calcrect.size.height).from(scene.unit).to(layer.unit) * scale;
|
|
24
|
-
switch (mode) {
|
|
25
|
-
case MODE_FRONT_ELEVATION_VIEW:
|
|
26
|
-
case MODE_BACK_ELEVATION_VIEW:
|
|
27
|
-
translateX += convert(Math.abs(rect[3].x - x0)).from(scene.unit).to(layer.unit) * scale;
|
|
28
|
-
break;
|
|
29
|
-
case MODE_RIGHT_ELEVATION_VIEW:
|
|
30
|
-
case MODE_LEFT_ELEVATION_VIEW:
|
|
31
|
-
translateX += convert(Math.abs(rect[3].y - y1)).from(scene.unit).to(layer.unit) * scale;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
var dimension;
|
|
35
|
-
switch (sideFlag) {
|
|
36
|
-
case 0:
|
|
37
|
-
dimension = /*#__PURE__*/React.createElement("polygon", {
|
|
38
|
-
points: "0,0 0,-".concat(itemHeight, " ").concat(itemWidth, ",-").concat(itemHeight, " ").concat(itemWidth, ",0"),
|
|
39
|
-
fill: "none",
|
|
40
|
-
stroke: "black"
|
|
41
|
-
});
|
|
42
|
-
break;
|
|
43
|
-
case 1:
|
|
44
|
-
dimension = /*#__PURE__*/React.createElement("polygon", {
|
|
45
|
-
points: "0,0 0,-".concat(itemHeight, " ").concat(itemDepth, ",-").concat(itemHeight, " ").concat(itemDepth, ",0"),
|
|
46
|
-
fill: "none",
|
|
47
|
-
stroke: "black"
|
|
48
|
-
});
|
|
49
|
-
break;
|
|
50
|
-
case 2:
|
|
51
|
-
dimension = /*#__PURE__*/React.createElement("polygon", {
|
|
52
|
-
points: "0,0 0,-".concat(itemHeight, " -").concat(itemDepth, ",-").concat(itemHeight, " -").concat(itemDepth, ",0"),
|
|
53
|
-
fill: "none",
|
|
54
|
-
stroke: "black"
|
|
55
|
-
});
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
return /*#__PURE__*/React.createElement("g", {
|
|
59
|
-
transform: "translate(".concat(translateX, ", ").concat(translateY, ")")
|
|
60
|
-
}, dimension);
|
|
61
|
-
}
|
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Ruler3D from "./ruler3D";
|
|
3
|
-
import convert from 'convert-units';
|
|
4
|
-
import { GeometryUtils } from "../../../utils/export";
|
|
5
|
-
import { returnReplaceableDeepSearchType } from "../../../components/viewer2d/utils";
|
|
6
|
-
import { DELTA, DISTANCE_EPSILON, DECIMAL_PLACES_2 } from "../../../constants";
|
|
7
|
-
import { formatNumber, isNonZeroText } from "../../../utils/math";
|
|
8
|
-
export default function Layer3D(_ref) {
|
|
9
|
-
var layer = _ref.layer,
|
|
10
|
-
frontRect = _ref.frontRect,
|
|
11
|
-
lineLength = _ref.lineLength,
|
|
12
|
-
ceilHeight = _ref.ceilHeight,
|
|
13
|
-
catalog = _ref.catalog,
|
|
14
|
-
scene = _ref.scene,
|
|
15
|
-
scale = _ref.scale,
|
|
16
|
-
mode = _ref.mode,
|
|
17
|
-
line = _ref.line,
|
|
18
|
-
viewScale = _ref.viewScale,
|
|
19
|
-
downloadFlag = _ref.downloadFlag;
|
|
20
|
-
var width = frontRect.width,
|
|
21
|
-
height = frontRect.height;
|
|
22
|
-
var v0 = layer.vertices.get(line.vertices.get(0));
|
|
23
|
-
var v1 = layer.vertices.get(line.vertices.get(1));
|
|
24
|
-
var l0 = {
|
|
25
|
-
x: v0.x,
|
|
26
|
-
y: v0.y
|
|
27
|
-
};
|
|
28
|
-
var l1 = {
|
|
29
|
-
x: v1.x,
|
|
30
|
-
y: v1.y
|
|
31
|
-
};
|
|
32
|
-
var rulerSpace = 50 * viewScale;
|
|
33
|
-
var lineSpace = 25 * viewScale;
|
|
34
|
-
var rulerLines = [],
|
|
35
|
-
rulerData = [],
|
|
36
|
-
baseItems = [],
|
|
37
|
-
wallItems = [],
|
|
38
|
-
basePosArray = [{
|
|
39
|
-
x: width / 2,
|
|
40
|
-
y: height / 2
|
|
41
|
-
}, {
|
|
42
|
-
x: -width / 2,
|
|
43
|
-
y: height / 2
|
|
44
|
-
}],
|
|
45
|
-
wallPosArray = [{
|
|
46
|
-
x: -width / 2,
|
|
47
|
-
y: -height / 2
|
|
48
|
-
}, {
|
|
49
|
-
x: width / 2,
|
|
50
|
-
y: -height / 2
|
|
51
|
-
}],
|
|
52
|
-
left_count = 0,
|
|
53
|
-
right_count = 0,
|
|
54
|
-
leftBaseItems = [],
|
|
55
|
-
rightBaseItems = [],
|
|
56
|
-
leftWallItems = [],
|
|
57
|
-
rightWallItems = [],
|
|
58
|
-
toler_unit = 'mm';
|
|
59
|
-
|
|
60
|
-
// get length between 2 points
|
|
61
|
-
var getLength = function getLength(vertex0, vertex1) {
|
|
62
|
-
return Math.sqrt(Math.pow(vertex0.x - vertex1.x, 2) + Math.pow(vertex0.y - vertex1.y, 2));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// determin if this line(vertex0, vertex1) is snapped into wall
|
|
66
|
-
var isSnapped = function isSnapped(vertex0, vertex1) {
|
|
67
|
-
var itemSnapped = false;
|
|
68
|
-
var delta = GeometryUtils.distancePointFromLineSegment(l0, l1, (vertex0.x + vertex1.x) / 2, (vertex0.y + vertex1.y) / 2);
|
|
69
|
-
if (delta < DISTANCE_EPSILON) {
|
|
70
|
-
itemSnapped = true;
|
|
71
|
-
}
|
|
72
|
-
return itemSnapped;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// get array of wallItem and baseITem in layer
|
|
76
|
-
layer.items.forEach(function (item) {
|
|
77
|
-
var val = {
|
|
78
|
-
pos: {
|
|
79
|
-
x: item.x,
|
|
80
|
-
y: item.y
|
|
81
|
-
},
|
|
82
|
-
rotRad: item.rotation / 180 * Math.PI
|
|
83
|
-
};
|
|
84
|
-
var catid = item.type;
|
|
85
|
-
var cat = catalog.elements[catid];
|
|
86
|
-
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
87
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from(item.properties.getIn(['width', '_unit'])).to(scene.unit);
|
|
88
|
-
var height = convert(item.properties.getIn(['height', '_length'])).from(item.properties.getIn(['height', '_unit'])).to(scene.unit);
|
|
89
|
-
var depth = convert(item.properties.getIn(['depth', '_length'])).from(item.properties.getIn(['depth', '_unit'])).to(scene.unit);
|
|
90
|
-
var altitude = convert(item.properties.getIn(['altitude', '_length'])).from(item.properties.getIn(['altitude', '_unit'])).to(scene.unit);
|
|
91
|
-
val.size = {
|
|
92
|
-
width: width,
|
|
93
|
-
height: height,
|
|
94
|
-
depth: depth,
|
|
95
|
-
altitude: altitude
|
|
96
|
-
};
|
|
97
|
-
val.layoutpos = cat && cat.info.layoutpos;
|
|
98
|
-
val.is_corner = cat && cat.info.is_corner;
|
|
99
|
-
val.item = item.toJS();
|
|
100
|
-
var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
|
|
101
|
-
if (isSnapped(calcrect.rect[3], calcrect.rect[2]) || isSnapped(calcrect.rect[2], calcrect.rect[1]) || isSnapped(calcrect.rect[0], calcrect.rect[3])) {
|
|
102
|
-
if (calcrect.itemInfo.properties.altitude.length) {
|
|
103
|
-
wallItems.push(calcrect);
|
|
104
|
-
} else {
|
|
105
|
-
baseItems.push(calcrect);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// sort function
|
|
111
|
-
var sortFunc = function sortFunc(a, b) {
|
|
112
|
-
return a.pos.x - b.pos.x;
|
|
113
|
-
};
|
|
114
|
-
var negSortFunc = function negSortFunc(a, b) {
|
|
115
|
-
return -sortFunc(a, b);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// get item's pos array about baseItem, then sort - baseItems' order is right: (width/2) -> left: (-width/2)
|
|
119
|
-
if (baseItems.length) {
|
|
120
|
-
baseItems.forEach(function (item) {
|
|
121
|
-
var vertex0, vertex1;
|
|
122
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
123
|
-
vertex0 = {
|
|
124
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
125
|
-
y: height / 2
|
|
126
|
-
};
|
|
127
|
-
vertex1 = {
|
|
128
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
129
|
-
y: height / 2
|
|
130
|
-
};
|
|
131
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
132
|
-
vertex0 = {
|
|
133
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
134
|
-
y: height / 2
|
|
135
|
-
};
|
|
136
|
-
vertex1 = {
|
|
137
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[1], v0)).from('cm').to(layer.unit) * scale,
|
|
138
|
-
y: height / 2
|
|
139
|
-
};
|
|
140
|
-
} else if (isSnapped(item.rect[0], item.rect[3])) {
|
|
141
|
-
vertex0 = {
|
|
142
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[0], v0)).from('cm').to(layer.unit) * scale,
|
|
143
|
-
y: height / 2
|
|
144
|
-
};
|
|
145
|
-
vertex1 = {
|
|
146
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
147
|
-
y: height / 2
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
basePosArray.push(vertex0);
|
|
151
|
-
basePosArray.push(vertex1);
|
|
152
|
-
|
|
153
|
-
// determin which side(left or right) item is closer to. If item is closer to left side, it will be included in leftBaseITems
|
|
154
|
-
var distLeft = getLength(item.pos, v0);
|
|
155
|
-
var distRight = getLength(item.pos, v1);
|
|
156
|
-
if (distLeft < distRight) {
|
|
157
|
-
leftBaseItems.push(item);
|
|
158
|
-
} else {
|
|
159
|
-
rightBaseItems.push(item);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
basePosArray.sort(function (a, b) {
|
|
164
|
-
return b.x - a.x;
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// get item's pos array about wallItem, then sort - wallItems' order is left: (-width/2) -> right: (width/2)
|
|
168
|
-
if (wallItems.length) {
|
|
169
|
-
wallItems.forEach(function (item) {
|
|
170
|
-
var vertex0, vertex1;
|
|
171
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
172
|
-
vertex0 = {
|
|
173
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
174
|
-
y: -height / 2
|
|
175
|
-
};
|
|
176
|
-
vertex1 = {
|
|
177
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
178
|
-
y: -height / 2
|
|
179
|
-
};
|
|
180
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
181
|
-
vertex0 = {
|
|
182
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[2], v0)).from('cm').to(layer.unit) * scale,
|
|
183
|
-
y: -height / 2
|
|
184
|
-
};
|
|
185
|
-
vertex1 = {
|
|
186
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[1], v0)).from('cm').to(layer.unit) * scale,
|
|
187
|
-
y: -height / 2
|
|
188
|
-
};
|
|
189
|
-
} else if (isSnapped(item.rect[0], item.rect[3])) {
|
|
190
|
-
vertex0 = {
|
|
191
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[0], v0)).from('cm').to(layer.unit) * scale,
|
|
192
|
-
y: -height / 2
|
|
193
|
-
};
|
|
194
|
-
vertex1 = {
|
|
195
|
-
x: -frontRect.width / 2 + convert(getLength(item.rect[3], v0)).from('cm').to(layer.unit) * scale,
|
|
196
|
-
y: -height / 2
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
wallPosArray.push(vertex0);
|
|
200
|
-
wallPosArray.push(vertex1);
|
|
201
|
-
|
|
202
|
-
// determin which side(left or right) item is closer to. If item is closer to left side, it will be included in leftBaseITems
|
|
203
|
-
var distLeft = getLength(item.pos, v0);
|
|
204
|
-
var distRight = getLength(item.pos, v1);
|
|
205
|
-
if (distLeft < distRight) {
|
|
206
|
-
rightWallItems.push(item);
|
|
207
|
-
} else {
|
|
208
|
-
leftWallItems.push(item);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
wallPosArray.sort(function (a, b) {
|
|
213
|
-
return a.x - b.x;
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// leftItems = leftBaseItems + inverted leftWallItems : Here, it's different between BaseItem's order and WallItem's order
|
|
217
|
-
leftBaseItems.sort(sortFunc);
|
|
218
|
-
leftWallItems.sort(negSortFunc);
|
|
219
|
-
rightBaseItems.sort(negSortFunc);
|
|
220
|
-
rightWallItems.sort(sortFunc);
|
|
221
|
-
var leftItems = leftBaseItems.concat(leftWallItems);
|
|
222
|
-
var rightItems = rightBaseItems.concat(rightWallItems);
|
|
223
|
-
|
|
224
|
-
// To display side dimensions, set rulerLines about leftItems
|
|
225
|
-
leftItems.forEach(function (item, idx) {
|
|
226
|
-
var forwardItems = [];
|
|
227
|
-
var distLine = 0;
|
|
228
|
-
var itemHeight = convert(item.size.height).from(scene.unit).to(layer.unit);
|
|
229
|
-
for (var i = 0; i < idx; i++) {
|
|
230
|
-
forwardItems.push(leftItems[i]);
|
|
231
|
-
}
|
|
232
|
-
if (!forwardItems.filter(function (it) {
|
|
233
|
-
return it.itemInfo.properties.altitude._length === item.itemInfo.properties.altitude._length && it.itemInfo.properties.height._length === item.itemInfo.properties.height._length;
|
|
234
|
-
}).length) {
|
|
235
|
-
if (item.itemInfo.properties.altitude._length) {
|
|
236
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
237
|
-
distLine = convert(getLength(item.rect[2], v1)).from(scene.unit).to(layer.unit);
|
|
238
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
239
|
-
distLine = convert(getLength(item.rect[1], v1)).from(scene.unit).to(layer.unit);
|
|
240
|
-
}
|
|
241
|
-
var itemAltitude = convert(item.size.altitude).from(scene.unit).to(layer.unit);
|
|
242
|
-
if (ceilHeight - (itemAltitude + itemHeight) > convert(DELTA).from(toler_unit).to(layer.unit)) {
|
|
243
|
-
rulerLines.push({
|
|
244
|
-
v0: {
|
|
245
|
-
x: width / 2,
|
|
246
|
-
y: -height / 2
|
|
247
|
-
},
|
|
248
|
-
v1: {
|
|
249
|
-
x: width / 2,
|
|
250
|
-
y: height / 2 - (itemHeight + itemAltitude) * scale
|
|
251
|
-
},
|
|
252
|
-
text: formatNumber(ceilHeight - (itemAltitude + itemHeight), DECIMAL_PLACES_2),
|
|
253
|
-
space: rulerSpace + right_count * lineSpace
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
rulerLines.push({
|
|
257
|
-
v0: {
|
|
258
|
-
x: width / 2 - distLine * scale,
|
|
259
|
-
y: height / 2 - (itemHeight + itemAltitude) * scale
|
|
260
|
-
},
|
|
261
|
-
v1: {
|
|
262
|
-
x: width / 2 - distLine * scale,
|
|
263
|
-
y: height / 2 - itemAltitude * scale
|
|
264
|
-
},
|
|
265
|
-
text: formatNumber(itemHeight, DECIMAL_PLACES_2),
|
|
266
|
-
space: rulerSpace + distLine * scale + right_count * lineSpace
|
|
267
|
-
});
|
|
268
|
-
rulerLines.push({
|
|
269
|
-
v0: {
|
|
270
|
-
x: width / 2,
|
|
271
|
-
y: height / 2 - itemAltitude * scale
|
|
272
|
-
},
|
|
273
|
-
v1: {
|
|
274
|
-
x: width / 2,
|
|
275
|
-
y: height / 2
|
|
276
|
-
},
|
|
277
|
-
text: formatNumber(itemAltitude, DECIMAL_PLACES_2),
|
|
278
|
-
space: rulerSpace + right_count * lineSpace
|
|
279
|
-
});
|
|
280
|
-
right_count++;
|
|
281
|
-
} else {
|
|
282
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
283
|
-
distLine = convert(getLength(item.rect[3], v0)).from(scene.unit).to(layer.unit);
|
|
284
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
285
|
-
distLine = convert(getLength(item.rect[2], v0)).from(scene.unit).to(layer.unit);
|
|
286
|
-
}
|
|
287
|
-
rulerLines.push({
|
|
288
|
-
v0: {
|
|
289
|
-
x: -width / 2 + distLine * scale,
|
|
290
|
-
y: height / 2
|
|
291
|
-
},
|
|
292
|
-
v1: {
|
|
293
|
-
x: -width / 2 + distLine * scale,
|
|
294
|
-
y: height / 2 - itemHeight * scale
|
|
295
|
-
},
|
|
296
|
-
text: formatNumber(itemHeight, DECIMAL_PLACES_2),
|
|
297
|
-
space: rulerSpace + distLine * scale + left_count * lineSpace
|
|
298
|
-
});
|
|
299
|
-
rulerLines.push({
|
|
300
|
-
v0: {
|
|
301
|
-
x: -width / 2,
|
|
302
|
-
y: height / 2 - itemHeight * scale
|
|
303
|
-
},
|
|
304
|
-
v1: {
|
|
305
|
-
x: -width / 2,
|
|
306
|
-
y: -height / 2
|
|
307
|
-
},
|
|
308
|
-
text: formatNumber(ceilHeight - itemHeight, DECIMAL_PLACES_2),
|
|
309
|
-
space: rulerSpace + left_count * lineSpace
|
|
310
|
-
});
|
|
311
|
-
left_count++;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// To display side dimensions, set rulerLines about rightItems
|
|
317
|
-
rightItems.forEach(function (item, idx) {
|
|
318
|
-
var forwardItems = [];
|
|
319
|
-
var distLine = 0;
|
|
320
|
-
var itemHeight = convert(item.size.height).from(scene.unit).to(layer.unit);
|
|
321
|
-
for (var i = 0; i < idx; i++) {
|
|
322
|
-
forwardItems.push(rightItems[i]);
|
|
323
|
-
}
|
|
324
|
-
if (!forwardItems.filter(function (it) {
|
|
325
|
-
return it.itemInfo.properties.altitude._length === item.itemInfo.properties.altitude._length && it.itemInfo.properties.height._length === item.itemInfo.properties.height._length;
|
|
326
|
-
}).length) {
|
|
327
|
-
if (item.itemInfo.properties.altitude._length) {
|
|
328
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
329
|
-
distLine = convert(getLength(item.rect[3], v0)).from(scene.unit).to(layer.unit);
|
|
330
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
331
|
-
distLine = convert(getLength(item.rect[2], v0)).from(scene.unit).to(layer.unit);
|
|
332
|
-
}
|
|
333
|
-
var _itemHeight = convert(item.size.height).from(scene.unit).to(layer.unit);
|
|
334
|
-
var itemAltitude = convert(item.size.altitude).from(scene.unit).to(layer.unit);
|
|
335
|
-
rulerLines.push({
|
|
336
|
-
v0: {
|
|
337
|
-
x: -width / 2,
|
|
338
|
-
y: height / 2
|
|
339
|
-
},
|
|
340
|
-
v1: {
|
|
341
|
-
x: -width / 2,
|
|
342
|
-
y: height / 2 - itemAltitude * scale
|
|
343
|
-
},
|
|
344
|
-
text: formatNumber(itemAltitude, DECIMAL_PLACES_2),
|
|
345
|
-
space: rulerSpace + left_count * lineSpace
|
|
346
|
-
});
|
|
347
|
-
rulerLines.push({
|
|
348
|
-
v0: {
|
|
349
|
-
x: -width / 2 + distLine * scale,
|
|
350
|
-
y: height / 2 - itemAltitude * scale
|
|
351
|
-
},
|
|
352
|
-
v1: {
|
|
353
|
-
x: -width / 2 + distLine * scale,
|
|
354
|
-
y: height / 2 - (itemAltitude + _itemHeight) * scale
|
|
355
|
-
},
|
|
356
|
-
text: formatNumber(_itemHeight, DECIMAL_PLACES_2),
|
|
357
|
-
space: rulerSpace + +distLine * scale + left_count * lineSpace
|
|
358
|
-
});
|
|
359
|
-
if (ceilHeight - (itemAltitude + _itemHeight) > convert(DELTA).from(toler_unit).to(layer.unit)) {
|
|
360
|
-
rulerLines.push({
|
|
361
|
-
v0: {
|
|
362
|
-
x: -width / 2,
|
|
363
|
-
y: height / 2 - (itemAltitude + _itemHeight) * scale
|
|
364
|
-
},
|
|
365
|
-
v1: {
|
|
366
|
-
x: -width / 2,
|
|
367
|
-
y: -height / 2
|
|
368
|
-
},
|
|
369
|
-
text: formatNumber(ceilHeight - (itemAltitude + _itemHeight), DECIMAL_PLACES_2),
|
|
370
|
-
space: rulerSpace + left_count * lineSpace
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
left_count++;
|
|
374
|
-
} else {
|
|
375
|
-
if (isSnapped(item.rect[3], item.rect[2])) {
|
|
376
|
-
distLine = convert(getLength(item.rect[2], v1)).from(scene.unit).to(layer.unit);
|
|
377
|
-
} else if (isSnapped(item.rect[2], item.rect[1])) {
|
|
378
|
-
distLine = convert(getLength(item.rect[1], v1)).from(scene.unit).to(layer.unit);
|
|
379
|
-
}
|
|
380
|
-
rulerLines.push({
|
|
381
|
-
v0: {
|
|
382
|
-
x: width / 2,
|
|
383
|
-
y: -height / 2
|
|
384
|
-
},
|
|
385
|
-
v1: {
|
|
386
|
-
x: width / 2,
|
|
387
|
-
y: height / 2 - itemHeight * scale
|
|
388
|
-
},
|
|
389
|
-
text: formatNumber(ceilHeight - itemHeight, DECIMAL_PLACES_2),
|
|
390
|
-
space: rulerSpace + right_count * lineSpace
|
|
391
|
-
});
|
|
392
|
-
rulerLines.push({
|
|
393
|
-
v0: {
|
|
394
|
-
x: width / 2 - distLine * scale,
|
|
395
|
-
y: height / 2 - itemHeight * scale
|
|
396
|
-
},
|
|
397
|
-
v1: {
|
|
398
|
-
x: width / 2 - distLine * scale,
|
|
399
|
-
y: height / 2
|
|
400
|
-
},
|
|
401
|
-
text: formatNumber(itemHeight, DECIMAL_PLACES_2),
|
|
402
|
-
space: rulerSpace + distLine * scale + right_count * lineSpace
|
|
403
|
-
});
|
|
404
|
-
right_count++;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// To display wall line dimensions, set rulerLines
|
|
410
|
-
rulerLines.push({
|
|
411
|
-
v0: {
|
|
412
|
-
x: width / 2,
|
|
413
|
-
y: -height / 2
|
|
414
|
-
},
|
|
415
|
-
v1: {
|
|
416
|
-
x: width / 2,
|
|
417
|
-
y: height / 2
|
|
418
|
-
},
|
|
419
|
-
text: ceilHeight,
|
|
420
|
-
space: rulerSpace + lineSpace * right_count
|
|
421
|
-
});
|
|
422
|
-
rulerLines.push({
|
|
423
|
-
v0: {
|
|
424
|
-
x: -width / 2,
|
|
425
|
-
y: height / 2
|
|
426
|
-
},
|
|
427
|
-
v1: {
|
|
428
|
-
x: -width / 2,
|
|
429
|
-
y: -height / 2
|
|
430
|
-
},
|
|
431
|
-
text: ceilHeight,
|
|
432
|
-
space: rulerSpace + lineSpace * left_count
|
|
433
|
-
});
|
|
434
|
-
rulerLines.push({
|
|
435
|
-
v0: {
|
|
436
|
-
x: width / 2,
|
|
437
|
-
y: height / 2
|
|
438
|
-
},
|
|
439
|
-
v1: {
|
|
440
|
-
x: -width / 2,
|
|
441
|
-
y: height / 2
|
|
442
|
-
},
|
|
443
|
-
text: formatNumber(lineLength, DECIMAL_PLACES_2),
|
|
444
|
-
space: rulerSpace + (baseItems.length ? lineSpace : 0)
|
|
445
|
-
});
|
|
446
|
-
rulerLines.push({
|
|
447
|
-
v0: {
|
|
448
|
-
x: -width / 2,
|
|
449
|
-
y: -height / 2
|
|
450
|
-
},
|
|
451
|
-
v1: {
|
|
452
|
-
x: width / 2,
|
|
453
|
-
y: -height / 2
|
|
454
|
-
},
|
|
455
|
-
text: formatNumber(lineLength, DECIMAL_PLACES_2),
|
|
456
|
-
space: rulerSpace + (wallItems.length ? lineSpace : 0)
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
// To display wallItems dimensions, set rulerLines with wallPosArray
|
|
460
|
-
if (wallItems.length) {
|
|
461
|
-
for (var i = 0; i < wallPosArray.length - 1; i++) {
|
|
462
|
-
var dist = getLength(wallPosArray[i], wallPosArray[i + 1]) / scale;
|
|
463
|
-
rulerLines.push({
|
|
464
|
-
v0: wallPosArray[i],
|
|
465
|
-
v1: wallPosArray[i + 1],
|
|
466
|
-
space: rulerSpace,
|
|
467
|
-
text: formatNumber(dist, DECIMAL_PLACES_2)
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// To display baseItems dimensions, set rulerLines with basePosArray
|
|
473
|
-
if (baseItems.length) {
|
|
474
|
-
for (var j = 0; j < basePosArray.length - 1; j++) {
|
|
475
|
-
var _dist = getLength(basePosArray[j], basePosArray[j + 1]) / scale;
|
|
476
|
-
rulerLines.push({
|
|
477
|
-
v0: basePosArray[j],
|
|
478
|
-
v1: basePosArray[j + 1],
|
|
479
|
-
space: rulerSpace,
|
|
480
|
-
text: formatNumber(_dist, DECIMAL_PLACES_2)
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
rulerLines.forEach(function (line) {
|
|
485
|
-
if (isNonZeroText(line.text)) rulerData.push(/*#__PURE__*/React.createElement(Ruler3D, {
|
|
486
|
-
line: line,
|
|
487
|
-
layer: layer,
|
|
488
|
-
viewScale: viewScale,
|
|
489
|
-
downloadFlag: downloadFlag
|
|
490
|
-
}));
|
|
491
|
-
});
|
|
492
|
-
return /*#__PURE__*/React.createElement("g", {
|
|
493
|
-
opacity: layer.opacity
|
|
494
|
-
}, rulerData);
|
|
495
|
-
}
|