@sapui5/sap.ui.vk 1.138.0 → 1.140.0
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/package.json +1 -1
- package/src/sap/ui/vk/.library +9 -1
- package/src/sap/ui/vk/AnimationPlayback.js +1 -1
- package/src/sap/ui/vk/AnimationPlayer.js +1 -1
- package/src/sap/ui/vk/AnimationSequence.js +1 -1
- package/src/sap/ui/vk/AnimationTimeSlider.js +1 -1
- package/src/sap/ui/vk/AnimationTrack.js +1 -1
- package/src/sap/ui/vk/Annotation.js +3 -3
- package/src/sap/ui/vk/BaseNodeProxy.js +1 -1
- package/src/sap/ui/vk/Camera.js +1 -1
- package/src/sap/ui/vk/ContentConnector.js +149 -95
- package/src/sap/ui/vk/ContentManager.js +1 -1
- package/src/sap/ui/vk/ContentResource.js +26 -7
- package/src/sap/ui/vk/ContentType.js +41 -0
- package/src/sap/ui/vk/Core.js +1 -1
- package/src/sap/ui/vk/DownloadManager.js +1 -1
- package/src/sap/ui/vk/DrawerToolbar.js +46 -19
- package/src/sap/ui/vk/DvlException.js +1 -1
- package/src/sap/ui/vk/FlexibleControl.js +1 -1
- package/src/sap/ui/vk/FlexibleControlLayoutData.js +1 -1
- package/src/sap/ui/vk/Highlight.js +1 -1
- package/src/sap/ui/vk/ImageContentManager.js +1 -1
- package/src/sap/ui/vk/JointUtils.js +1 -1
- package/src/sap/ui/vk/LayerProxy.js +1 -1
- package/src/sap/ui/vk/Loco.js +1 -1
- package/src/sap/ui/vk/Material.js +1 -1
- package/src/sap/ui/vk/NativeViewport.js +1 -1
- package/src/sap/ui/vk/NodeHierarchy.js +1 -1
- package/src/sap/ui/vk/NodeProxy.js +1 -1
- package/src/sap/ui/vk/NodeUtils.js +1 -1
- package/src/sap/ui/vk/Notifications.js +1 -1
- package/src/sap/ui/vk/OrthographicCamera.js +1 -1
- package/src/sap/ui/vk/PerspectiveCamera.js +1 -1
- package/src/sap/ui/vk/ProgressIndicator.js +1 -1
- package/src/sap/ui/vk/RedlineCollaboration.js +1 -1
- package/src/sap/ui/vk/RedlineConversation.js +1 -1
- package/src/sap/ui/vk/RedlineDesign.js +1 -1
- package/src/sap/ui/vk/RedlineElement.js +1 -1
- package/src/sap/ui/vk/RedlineElementComment.js +1 -1
- package/src/sap/ui/vk/RedlineElementEllipse.js +1 -1
- package/src/sap/ui/vk/RedlineElementFreehand.js +1 -1
- package/src/sap/ui/vk/RedlineElementLine.js +1 -1
- package/src/sap/ui/vk/RedlineElementRectangle.js +1 -1
- package/src/sap/ui/vk/RedlineElementText.js +1 -1
- package/src/sap/ui/vk/RedlineSurface.js +1 -1
- package/src/sap/ui/vk/SafeArea.js +1 -1
- package/src/sap/ui/vk/Scene.js +5 -1
- package/src/sap/ui/vk/SceneTree.js +20 -3
- package/src/sap/ui/vk/StepNavigation.js +1 -1
- package/src/sap/ui/vk/Texture.js +1 -1
- package/src/sap/ui/vk/ToggleMenuButton.js +1 -1
- package/src/sap/ui/vk/ToggleMenuItem.js +1 -1
- package/src/sap/ui/vk/Toolbar.js +1 -1
- package/src/sap/ui/vk/View.js +1 -1
- package/src/sap/ui/vk/ViewGallery.js +1 -1
- package/src/sap/ui/vk/ViewGalleryThumbnail.js +1 -1
- package/src/sap/ui/vk/ViewGroup.js +1 -1
- package/src/sap/ui/vk/ViewManager.js +1 -1
- package/src/sap/ui/vk/ViewStateManager.js +3 -10
- package/src/sap/ui/vk/ViewStateManagerBase.js +2 -2
- package/src/sap/ui/vk/Viewer.js +13 -3
- package/src/sap/ui/vk/Viewport.js +1 -1
- package/src/sap/ui/vk/ViewportBase.js +24 -70
- package/src/sap/ui/vk/dvl/BaseNodeProxy.js +1 -1
- package/src/sap/ui/vk/dvl/ContentManager.js +1 -1
- package/src/sap/ui/vk/dvl/GraphicsCore.js +1 -1
- package/src/sap/ui/vk/dvl/LayerProxy.js +1 -1
- package/src/sap/ui/vk/dvl/NodeHierarchy.js +1 -1
- package/src/sap/ui/vk/dvl/NodeProxy.js +1 -1
- package/src/sap/ui/vk/dvl/Scene.js +1 -1
- package/src/sap/ui/vk/dvl/ViewStateManager.js +1 -1
- package/src/sap/ui/vk/dvl/Viewport.js +1 -1
- package/src/sap/ui/vk/ecad/ElementsPanel.js +408 -385
- package/src/sap/ui/vk/ecad/LayersPanel.js +95 -99
- package/src/sap/ui/vk/i18n/messagebundle.properties +44 -46
- package/src/sap/ui/vk/i18n/messagebundle_ar.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_bg.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_ca.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_cnr.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_cs.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_cy.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_da.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_de.properties +28 -14
- package/src/sap/ui/vk/i18n/messagebundle_el.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_en.properties +27 -327
- package/src/sap/ui/vk/i18n/messagebundle_en_GB.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_en_US_saprigi.properties +24 -12
- package/src/sap/ui/vk/i18n/messagebundle_es.properties +29 -15
- package/src/sap/ui/vk/i18n/messagebundle_es_MX.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_et.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_fi.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_fr.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_fr_CA.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_hi.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_hr.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_hu.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_id.properties +29 -15
- package/src/sap/ui/vk/i18n/messagebundle_it.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_iw.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_ja.properties +29 -15
- package/src/sap/ui/vk/i18n/messagebundle_kk.properties +39 -25
- package/src/sap/ui/vk/i18n/messagebundle_ko.properties +24 -10
- package/src/sap/ui/vk/i18n/messagebundle_lt.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_lv.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_mk.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_ms.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_nl.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_no.properties +28 -14
- package/src/sap/ui/vk/i18n/messagebundle_pl.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_pt.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_pt_PT.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_ro.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_ru.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_sh.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_sk.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_sl.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_sr.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_sv.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_th.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_tr.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_uk.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_vi.properties +28 -14
- package/src/sap/ui/vk/i18n/messagebundle_zh_CN.properties +27 -13
- package/src/sap/ui/vk/i18n/messagebundle_zh_TW.properties +27 -13
- package/src/sap/ui/vk/library.js +5 -5
- package/src/sap/ui/vk/measurements/Angle.js +1 -1
- package/src/sap/ui/vk/measurements/Area.js +1 -1
- package/src/sap/ui/vk/measurements/Distance.js +1 -1
- package/src/sap/ui/vk/measurements/Edge.js +1 -1
- package/src/sap/ui/vk/measurements/Face.js +1 -1
- package/src/sap/ui/vk/measurements/Feature.js +1 -1
- package/src/sap/ui/vk/measurements/Vertex.js +1 -1
- package/src/sap/ui/vk/pdf/ContentManager.js +1 -1
- package/src/sap/ui/vk/pdf/Page.js +9 -10
- package/src/sap/ui/vk/pdf/Utils.js +4 -2
- package/src/sap/ui/vk/pdf/Viewport.js +1 -1
- package/src/sap/ui/vk/svg/BaseNodeProxy.js +1 -1
- package/src/sap/ui/vk/svg/ContentDeliveryService.js +1 -1
- package/src/sap/ui/vk/svg/ContentManager.js +4 -5
- package/src/sap/ui/vk/svg/NodeHierarchy.js +1 -1
- package/src/sap/ui/vk/svg/NodeProxy.js +1 -1
- package/src/sap/ui/vk/svg/OrthographicCamera.js +1 -1
- package/src/sap/ui/vk/svg/Scene.js +1 -1
- package/src/sap/ui/vk/svg/SceneBuilder.js +1 -1
- package/src/sap/ui/vk/svg/ViewStateManager.js +1 -1
- package/src/sap/ui/vk/svg/Viewport.js +11 -18
- package/src/sap/ui/vk/thirdparty/BufferGeometryUtils.js +86 -27
- package/src/sap/ui/vk/thirdparty/pdf.worker.js +1 -1
- package/src/sap/ui/vk/thirdparty/three.js +54501 -32246
- package/src/sap/ui/vk/threejs/AnimationHelper.js +1 -1
- package/src/sap/ui/vk/threejs/BaseNodeProxy.js +1 -1
- package/src/sap/ui/vk/threejs/Billboard.js +23 -11
- package/src/sap/ui/vk/threejs/Callout.js +1 -1
- package/src/sap/ui/vk/threejs/ContentDeliveryService.js +1 -1
- package/src/sap/ui/vk/threejs/ContentManager.js +2 -2
- package/src/sap/ui/vk/threejs/DetailView.js +1 -1
- package/src/sap/ui/vk/threejs/HighlightPlayer.js +14 -22
- package/src/sap/ui/vk/threejs/Material.js +1 -1
- package/src/sap/ui/vk/threejs/NodeHierarchy.js +1 -1
- package/src/sap/ui/vk/threejs/NodeProxy.js +9 -11
- package/src/sap/ui/vk/threejs/OrthographicCamera.js +1 -1
- package/src/sap/ui/vk/threejs/OutlineRenderer.js +4 -10
- package/src/sap/ui/vk/threejs/PerspectiveCamera.js +1 -1
- package/src/sap/ui/vk/threejs/PointCloudGroup.js +1 -1
- package/src/sap/ui/vk/threejs/Scene.js +1 -15
- package/src/sap/ui/vk/threejs/SceneBuilder.js +1 -4
- package/src/sap/ui/vk/threejs/Texture.js +1 -1
- package/src/sap/ui/vk/threejs/ThreeExtensions.js +10 -174
- package/src/sap/ui/vk/threejs/ThreeUtils.js +7 -18
- package/src/sap/ui/vk/threejs/Thrustline.js +1 -1
- package/src/sap/ui/vk/threejs/ViewStateManager.js +755 -451
- package/src/sap/ui/vk/threejs/Viewport.js +47 -35
- package/src/sap/ui/vk/tools/AnchorPointTool.js +1 -1
- package/src/sap/ui/vk/tools/AnchorPointToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/AxisAngleRotationTool.js +1 -1
- package/src/sap/ui/vk/tools/AxisAngleRotationToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CreateEllipseTool.js +1 -1
- package/src/sap/ui/vk/tools/CreateEllipseToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CreateParametricGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CreatePathTool.js +1 -1
- package/src/sap/ui/vk/tools/CreatePathToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CreateRectangleTool.js +1 -1
- package/src/sap/ui/vk/tools/CreateRectangleToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CreateTextTool.js +1 -1
- package/src/sap/ui/vk/tools/CreateTextToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/CrossSectionTool.js +1 -1
- package/src/sap/ui/vk/tools/CrossSectionToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/DuplicateSvgElementTool.js +1 -1
- package/src/sap/ui/vk/tools/DuplicateSvgElementToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/ExplodeTool.js +1 -1
- package/src/sap/ui/vk/tools/ExplodeToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/Gizmo.js +4 -3
- package/src/sap/ui/vk/tools/HitTestTool.js +1 -1
- package/src/sap/ui/vk/tools/MoveTool.js +1 -1
- package/src/sap/ui/vk/tools/MoveToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/PointCloudSelectionTool.js +1 -1
- package/src/sap/ui/vk/tools/PointCloudSelectionToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/RectSelectTool.js +1 -1
- package/src/sap/ui/vk/tools/RedlineTool.js +1 -1
- package/src/sap/ui/vk/tools/RedlineToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/RotateOrbitTool.js +1 -1
- package/src/sap/ui/vk/tools/RotateTool.js +1 -1
- package/src/sap/ui/vk/tools/RotateToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/RotateTurntableTool.js +1 -1
- package/src/sap/ui/vk/tools/ScaleTool.js +1 -1
- package/src/sap/ui/vk/tools/ScaleToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/SceneOrientationTool.js +1 -1
- package/src/sap/ui/vk/tools/SceneOrientationToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/Tool.js +1 -1
- package/src/sap/ui/vk/tools/TooltipTool.js +1 -1
- package/src/sap/ui/vk/tools/TooltipToolGizmo.js +1 -1
- package/src/sap/ui/vk/tools/TooltipToolHandler.js +5 -0
- package/src/sap/ui/vk/tools/TransformSvgElementTool.js +1 -1
- package/src/sap/ui/vk/tools/TransformSvgElementToolGizmo.js +1 -1
- package/src/sap/ui/vk/totara/SceneContext.js +3 -1
- package/src/sap/ui/vk/totara/TotaraLoader.js +2 -2
- package/src/sap/ui/vk/totara/TotaraLoaderWorker.js +18 -21
- package/src/sap/ui/vk/ve/dvl.wasm +0 -0
- package/ui5.yaml +5 -3
- package/src/sap/ui/vk/threejs/v2/ViewStateManager.js +0 -1445
|
@@ -1,1445 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
-
|
|
4
|
-
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Provides the ViewStateManager class.
|
|
9
|
-
sap.ui.define([
|
|
10
|
-
"../ViewStateManager",
|
|
11
|
-
"../../thirdparty/three",
|
|
12
|
-
"../../cssColorToColor",
|
|
13
|
-
"../../colorToCSSColor",
|
|
14
|
-
"../../abgrToColor",
|
|
15
|
-
"../../colorToABGR",
|
|
16
|
-
"../ThreeUtils",
|
|
17
|
-
"sap/ui/base/DataType"
|
|
18
|
-
], function(
|
|
19
|
-
ViewStateManagerV1,
|
|
20
|
-
THREE,
|
|
21
|
-
cssColorToColor,
|
|
22
|
-
colorToCSSColor,
|
|
23
|
-
abgrToColor,
|
|
24
|
-
colorToABGR,
|
|
25
|
-
ThreeUtils,
|
|
26
|
-
DataType
|
|
27
|
-
) {
|
|
28
|
-
"use strict";
|
|
29
|
-
|
|
30
|
-
var boundingBoxColor = new THREE.Color(0xC0C000);
|
|
31
|
-
|
|
32
|
-
var MaterialCache;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Constructor for a new ViewStateManager.
|
|
36
|
-
*
|
|
37
|
-
* @class
|
|
38
|
-
* Manages the visibility, selection, opacity and tint color states of nodes in the scene.
|
|
39
|
-
*
|
|
40
|
-
* This implementation supports multiple viewports but does not support animation.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} [sId] ID for the new ViewStateManager object. Generated automatically if no ID is given.
|
|
43
|
-
* @param {object} [mSettings] Initial settings for the new ViewStateManager object.
|
|
44
|
-
* @private
|
|
45
|
-
* @author SAP SE
|
|
46
|
-
* @version 1.138.0
|
|
47
|
-
* @extends sap.ui.vk.threejs.ViewStateManager
|
|
48
|
-
* @alias sap.ui.vk.threejs.v2.ViewStateManager
|
|
49
|
-
* @since 1.99.0
|
|
50
|
-
*/
|
|
51
|
-
var ViewStateManager = ViewStateManagerV1.extend("sap.ui.vk.threejs.v2.ViewStateManager", /** @lends sap.ui.vk.threejs.v2.ViewStateManager.prototype */ {
|
|
52
|
-
metadata: {
|
|
53
|
-
library: "sap.ui.vk"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
var basePrototype = ViewStateManager.getMetadata().getParent().getClass().prototype;
|
|
58
|
-
|
|
59
|
-
ViewStateManager.prototype.init = function() {
|
|
60
|
-
if (basePrototype.init) {
|
|
61
|
-
basePrototype.init.call(this);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this._nodeHierarchy = null;
|
|
65
|
-
|
|
66
|
-
// A map where `key` is `nodeRef` and `value` is a structure:
|
|
67
|
-
//
|
|
68
|
-
// type NodeState {
|
|
69
|
-
// visible?: bool
|
|
70
|
-
// selected: bool
|
|
71
|
-
// ancestorSelected: bool
|
|
72
|
-
// opacity?: number // floating number in range [0, 1]
|
|
73
|
-
// ancestorOverridesOpacity: bool
|
|
74
|
-
// tintColor?: int // tint color in ABGR format
|
|
75
|
-
// ancestorTintColor?: int // tint color of ancestor in ABGR format
|
|
76
|
-
// boundingBoxNode?: THREE.Box3Helper // assigned if selected; ancestorSelected does not affect this property
|
|
77
|
-
// material?: THREE.MeshPhongMaterial // if selected or ancestorSelected or opacity != null or
|
|
78
|
-
// // tintColor != null or ancestorTintColor != null
|
|
79
|
-
// needsMaterialUpdate: bool
|
|
80
|
-
// }
|
|
81
|
-
//
|
|
82
|
-
// If a NodeState property is `null`, `undefined` or missing then the property original
|
|
83
|
-
// value is taken from the node itself.
|
|
84
|
-
//
|
|
85
|
-
// The `selected` cannot have value `null` as it is a non-persistent runtime property.
|
|
86
|
-
this._nodeStates = new Map();
|
|
87
|
-
|
|
88
|
-
// A collection of selected nodes for quick access, usually there are not many selected objects, so it is OK to
|
|
89
|
-
// store them in a collection.
|
|
90
|
-
this._selectedNodes = new Set();
|
|
91
|
-
|
|
92
|
-
// TODO(VSM): outlining is not implemented yet.
|
|
93
|
-
// this._outlineRenderer = new OutlineRenderer(1.0);
|
|
94
|
-
this._outlinedNodes = new Set();
|
|
95
|
-
this.setOutlineColor("rgba(255, 0, 255, 1.0)");
|
|
96
|
-
this.setOutlineWidth(1.0);
|
|
97
|
-
|
|
98
|
-
this._materialCache = new MaterialCache();
|
|
99
|
-
|
|
100
|
-
this._showSelectionBoundingBox = true;
|
|
101
|
-
|
|
102
|
-
// This scene owns and renders boxHelper objects for selected objects. Though the scene owns
|
|
103
|
-
// boxHelpers, the `parent` properties of the boxHelpers are set to the corresponding nodes
|
|
104
|
-
// rather than to this scene as those nodes are used to calculate the world matrices of theOpa
|
|
105
|
-
// boxHelpers.
|
|
106
|
-
this._boundingBoxesScene = new THREE.Scene();
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
ViewStateManager.prototype.exit = function() {
|
|
110
|
-
this._clearNodeStates();
|
|
111
|
-
this._selectedNodes.clear();
|
|
112
|
-
|
|
113
|
-
// TODO(VSM): outlining is not implemented yet.
|
|
114
|
-
this._outlinedNodes.clear();
|
|
115
|
-
|
|
116
|
-
if (this._boundingBoxesScene) {
|
|
117
|
-
this._clearBoundingBoxScene();
|
|
118
|
-
this._boundingBoxesScene = null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
this._nodeHierarchy = null;
|
|
122
|
-
|
|
123
|
-
if (basePrototype.exit) {
|
|
124
|
-
basePrototype.exit.call(this);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
ViewStateManager.prototype._clearBoundingBoxScene = function() {
|
|
129
|
-
var all3DNodes = [];
|
|
130
|
-
var allGroupNodes = [];
|
|
131
|
-
|
|
132
|
-
ThreeUtils.getAllTHREENodes([this._boundingBoxesScene], all3DNodes, allGroupNodes);
|
|
133
|
-
all3DNodes.forEach(function(n3d) {
|
|
134
|
-
ThreeUtils.disposeObject(n3d);
|
|
135
|
-
// TODO: does not seem to be necessary as bounding boxes are owned by
|
|
136
|
-
// `_boundingBoxesScene` and they are not in `n3d.parent.children` arrays.
|
|
137
|
-
n3d.parent.remove(n3d);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
allGroupNodes.forEach(function(g3d) {
|
|
141
|
-
// TODO: see the comment above.
|
|
142
|
-
g3d.parent.remove(g3d);
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
ViewStateManager.prototype._clearNodeStates = function() {
|
|
147
|
-
var nodeStates = this._nodeStates;
|
|
148
|
-
|
|
149
|
-
nodeStates.forEach(function(state, nodeRef) {
|
|
150
|
-
if (state.material != null) {
|
|
151
|
-
ThreeUtils.disposeMaterial(state.material);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (state.boundingBoxNode) {
|
|
155
|
-
ThreeUtils.disposeObject(state.boundingBoxNode);
|
|
156
|
-
}
|
|
157
|
-
}, this);
|
|
158
|
-
|
|
159
|
-
nodeStates.clear();
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
////////////////////////////////////////////////////////////////////////
|
|
163
|
-
// Node hierarchy handling begins.
|
|
164
|
-
|
|
165
|
-
ViewStateManager.prototype._setScene = function(scene) {
|
|
166
|
-
this._clearNodeStates();
|
|
167
|
-
|
|
168
|
-
// TODO(VSM): Move this to _clearNodeStates.
|
|
169
|
-
if (this._boundingBoxesScene) {
|
|
170
|
-
this._clearBoundingBoxScene();
|
|
171
|
-
}
|
|
172
|
-
// TODO(VSM): Move this to _setNodeHierarchy?
|
|
173
|
-
this._boundingBoxesScene = new THREE.Scene();
|
|
174
|
-
this._setNodeHierarchy(scene ? scene.getDefaultNodeHierarchy() : null);
|
|
175
|
-
|
|
176
|
-
// TODO(VSM): WTF?! Remove this!
|
|
177
|
-
if (scene) {
|
|
178
|
-
scene.setViewStateManager(this);
|
|
179
|
-
}
|
|
180
|
-
this._scene = scene;
|
|
181
|
-
|
|
182
|
-
if (this._scene) {
|
|
183
|
-
var initialView = this._scene.getInitialView();
|
|
184
|
-
if (initialView) {
|
|
185
|
-
this.activateView(initialView);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return this;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// TODO(VSM): Move the body to _setScene?
|
|
192
|
-
ViewStateManager.prototype._setNodeHierarchy = function(nodeHierarchy) {
|
|
193
|
-
var oldNodeHierarchy = this._nodeHierarchy;
|
|
194
|
-
|
|
195
|
-
if (this._nodeHierarchy) {
|
|
196
|
-
this._nodeHierarchy.detachNodeReplaced(this._handleNodeReplaced, this);
|
|
197
|
-
this._nodeHierarchy.detachNodeUpdated(this._handleNodeUpdated, this);
|
|
198
|
-
this._nodeHierarchy.detachNodeRemoving(this._handleNodeRemoving, this);
|
|
199
|
-
this._nodeHierarchy = null;
|
|
200
|
-
this._clearNodeStates();
|
|
201
|
-
this._selectedNodes.clear();
|
|
202
|
-
this._outlinedNodes.clear();
|
|
203
|
-
this._visibilityTracker.clear();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (nodeHierarchy) {
|
|
207
|
-
this._nodeHierarchy = nodeHierarchy;
|
|
208
|
-
|
|
209
|
-
this._nodeHierarchy.attachNodeReplaced(this._handleNodeReplaced, this);
|
|
210
|
-
this._nodeHierarchy.attachNodeUpdated(this._handleNodeUpdated, this);
|
|
211
|
-
this._nodeHierarchy.attachNodeRemoving(this._handleNodeRemoving, this);
|
|
212
|
-
|
|
213
|
-
var visible = [];
|
|
214
|
-
var hidden = [];
|
|
215
|
-
nodeHierarchy.getSceneRef().traverse(function(nodeRef) {
|
|
216
|
-
(nodeRef.visible ? visible : hidden).push(nodeRef);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
this.fireVisibilityChanged({
|
|
220
|
-
visible: visible,
|
|
221
|
-
hidden: hidden
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (nodeHierarchy !== oldNodeHierarchy) {
|
|
226
|
-
this.fireNodeHierarchyReplaced({
|
|
227
|
-
oldNodeHierarchy: oldNodeHierarchy,
|
|
228
|
-
newNodeHierarchy: nodeHierarchy
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return this;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
ViewStateManager.prototype._handleNodeReplaced = function(event) {
|
|
236
|
-
var replacedNodeRef = event.getParameter("ReplacedNodeRef");
|
|
237
|
-
var replacementNodeRef = event.getParameter("ReplacementNodeRef");
|
|
238
|
-
|
|
239
|
-
if (this.getSelectionState(replacedNodeRef)) {
|
|
240
|
-
this.setSelectionStates(replacementNodeRef, replacedNodeRef);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
ViewStateManager.prototype._handleNodeUpdated = function(event) {
|
|
245
|
-
var nodeRef = event.getParameter("nodeRef");
|
|
246
|
-
|
|
247
|
-
if (this.getSelectionState(nodeRef)) {
|
|
248
|
-
// Just refresh selection by deselecting and selecting the same node again
|
|
249
|
-
this.setSelectionStates([], nodeRef);
|
|
250
|
-
this.setSelectionStates(nodeRef, []);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
ViewStateManager.prototype._handleNodeRemoving = function(event) {
|
|
255
|
-
var nodeRef = event.getParameter("nodeRef");
|
|
256
|
-
|
|
257
|
-
// Node is removed from node hierarchy, remove it from list of selected nodes
|
|
258
|
-
if (this.getSelectionState(nodeRef)) {
|
|
259
|
-
// Since this node is already removed from the scene don't send notification
|
|
260
|
-
this.setSelectionStates([], nodeRef, true, true);
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
ViewStateManager.prototype._renderOutline = function(renderer, scene, camera) {
|
|
265
|
-
// TODO(VSM): not implemented.
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// Node hierarchy handling ends.
|
|
269
|
-
////////////////////////////////////////////////////////////////////////
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Reset node property to the value defined by current view.
|
|
273
|
-
*
|
|
274
|
-
* @param {object} nodeRef reference to node.
|
|
275
|
-
* @param {string} property node property
|
|
276
|
-
* @public
|
|
277
|
-
*/
|
|
278
|
-
ViewStateManager.prototype.resetNodeProperty = function(nodeRef, property) {
|
|
279
|
-
// TODO(VSM): not implemented.
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
ViewStateManager.prototype.resetVisibility = function() {
|
|
283
|
-
var toShow = [];
|
|
284
|
-
var toHide = [];
|
|
285
|
-
this._nodeStates.forEach(function(state, nodeRef) {
|
|
286
|
-
var visible = state.visible;
|
|
287
|
-
if (visible === true) {
|
|
288
|
-
toHide.push(nodeRef);
|
|
289
|
-
} else if (visible === false) {
|
|
290
|
-
toShow.push(nodeRef);
|
|
291
|
-
}
|
|
292
|
-
state.visible = null;
|
|
293
|
-
});
|
|
294
|
-
this._deleteUnusedNodeStates();
|
|
295
|
-
|
|
296
|
-
this._visibilityTracker.clear();
|
|
297
|
-
this.fireVisibilityChanged({
|
|
298
|
-
visible: toShow,
|
|
299
|
-
hidden: toHide
|
|
300
|
-
});
|
|
301
|
-
return this;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Gets the visibility state of nodes.
|
|
306
|
-
*
|
|
307
|
-
* If a single node is passed to the method then a single visibility state is returned.<br/>
|
|
308
|
-
* If an array of nodes is passed to the method then an array of visibility states is returned.
|
|
309
|
-
*
|
|
310
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
311
|
-
* @returns {boolean|boolean[]} A single value or an array of values where the value is <code>true</code> if the node is visible, <code>false</code> otherwise.
|
|
312
|
-
* @public
|
|
313
|
-
*/
|
|
314
|
-
ViewStateManager.prototype.getVisibilityState = function(nodeRefs) {
|
|
315
|
-
if (Array.isArray(nodeRefs)) {
|
|
316
|
-
var result = [];
|
|
317
|
-
this._nodeStates.forEach(function(state, nodeRef) {
|
|
318
|
-
result.push(effectiveVisibility(nodeRef, state));
|
|
319
|
-
});
|
|
320
|
-
return result;
|
|
321
|
-
} else {
|
|
322
|
-
var state = this._getNodeState(nodeRefs, false);
|
|
323
|
-
return effectiveVisibility(nodeRefs, state);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Sets the visibility state of the nodes.
|
|
329
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
330
|
-
* @param {boolean|boolean[]} visible The new visibility state or array of states of the nodes.
|
|
331
|
-
* @param {boolean} recursive The flags indicates if the change needs to propagate recursively to child nodes.
|
|
332
|
-
* @param {boolean} force If a node is made visible but its parent is hidden then it will still be
|
|
333
|
-
* hidden in Viewport. This flag will force node to be visible regardless of
|
|
334
|
-
* parent's state.
|
|
335
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
336
|
-
* @public
|
|
337
|
-
*/
|
|
338
|
-
ViewStateManager.prototype.setVisibilityState = function(nodeRefs, visible, recursive, force) {
|
|
339
|
-
// normalize parameters to have array of nodeRefs and array of visibility values
|
|
340
|
-
if (!Array.isArray(nodeRefs)) {
|
|
341
|
-
nodeRefs = [nodeRefs];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// check if we have got an array of booleans as visibility change
|
|
345
|
-
var isBulkChange = Array.isArray(visible);
|
|
346
|
-
|
|
347
|
-
var recursiveVisibilities = [];
|
|
348
|
-
var allNodeRefs = nodeRefs;
|
|
349
|
-
|
|
350
|
-
if (recursive) {
|
|
351
|
-
allNodeRefs = [];
|
|
352
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
353
|
-
var collected = this._collectNodesRecursively(nodeRef);
|
|
354
|
-
allNodeRefs = allNodeRefs.concat(collected);
|
|
355
|
-
|
|
356
|
-
var length = recursiveVisibilities.length;
|
|
357
|
-
recursiveVisibilities.length += collected.length;
|
|
358
|
-
recursiveVisibilities.fill(isBulkChange ? visible[index] : visible, length);
|
|
359
|
-
}, this);
|
|
360
|
-
} else if (!isBulkChange) {
|
|
361
|
-
// not recursive, visible is a scalar
|
|
362
|
-
recursiveVisibilities.length = allNodeRefs.length;
|
|
363
|
-
recursiveVisibilities.fill(visible);
|
|
364
|
-
} else {
|
|
365
|
-
// not recursive, visible is an array
|
|
366
|
-
recursiveVisibilities = visible;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (force) {
|
|
370
|
-
// We use `force` when we un-hide the parents of the un-hidden node recursively up the tree. Extend the
|
|
371
|
-
// array of changed nodes with these ancestors. If they are already visible or there are duplicates they
|
|
372
|
-
// will be filtered out below.
|
|
373
|
-
var additionalNodeRefs = [];
|
|
374
|
-
allNodeRefs.forEach(function(nodeRef, index) {
|
|
375
|
-
var newVisibility = recursiveVisibilities[index];
|
|
376
|
-
if (newVisibility) {
|
|
377
|
-
for (var node = nodeRef; node && !node.isScene; node = node.parent) {
|
|
378
|
-
additionalNodeRefs.push(node);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
allNodeRefs = allNodeRefs.concat(additionalNodeRefs);
|
|
383
|
-
var length = recursiveVisibilities.length;
|
|
384
|
-
recursiveVisibilities.length += additionalNodeRefs.length;
|
|
385
|
-
recursiveVisibilities.fill(true, length);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// filter out unchanged visibility and duplicate nodes
|
|
389
|
-
var changedVisibility = [];
|
|
390
|
-
var usedNodeRefs = new Set();
|
|
391
|
-
var changedNodeRefs = allNodeRefs.filter(function(nodeRef, index) {
|
|
392
|
-
if (usedNodeRefs.has(nodeRef)) {
|
|
393
|
-
return false;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
usedNodeRefs.add(nodeRef);
|
|
397
|
-
|
|
398
|
-
var state = this._getNodeState(nodeRef, false);
|
|
399
|
-
var oldVisibility = effectiveVisibility(nodeRef, state);
|
|
400
|
-
var newVisibility = recursiveVisibilities[index];
|
|
401
|
-
|
|
402
|
-
var changed = oldVisibility !== newVisibility;
|
|
403
|
-
if (changed) {
|
|
404
|
-
changedVisibility.push(newVisibility);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return changed;
|
|
408
|
-
}, this);
|
|
409
|
-
|
|
410
|
-
if (changedNodeRefs.length > 0) {
|
|
411
|
-
this._applyVisibilityNodeState(changedNodeRefs, changedVisibility);
|
|
412
|
-
this._deleteUnusedNodeStates();
|
|
413
|
-
|
|
414
|
-
var eventParameters = {
|
|
415
|
-
visible: [],
|
|
416
|
-
hidden: []
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
changedNodeRefs.forEach(function(nodeRef, index) {
|
|
420
|
-
eventParameters[changedVisibility[index] ? "visible" : "hidden"].push(nodeRef);
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
if (this.getShouldTrackVisibilityChanges()) {
|
|
424
|
-
changedNodeRefs.forEach(this._visibilityTracker.trackNodeRef, this._visibilityTracker);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
this.fireVisibilityChanged(eventParameters);
|
|
428
|
-
}
|
|
429
|
-
return this;
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Enumerates IDs of the selected nodes.
|
|
434
|
-
*
|
|
435
|
-
* @param {function} callback A function to call when the selected nodes are enumerated. The function takes one parameter of type <code>string</code>.
|
|
436
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
437
|
-
* @public
|
|
438
|
-
*/
|
|
439
|
-
ViewStateManager.prototype.enumerateSelection = function(callback) {
|
|
440
|
-
this._selectedNodes.forEach(callback);
|
|
441
|
-
return this;
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Enumerates IDs of the outlined nodes.
|
|
446
|
-
*
|
|
447
|
-
* @param {function} callback A function to call when the outlined nodes are enumerated. The function takes one parameter of type <code>string</code>.
|
|
448
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
449
|
-
* @public
|
|
450
|
-
*/
|
|
451
|
-
ViewStateManager.prototype.enumerateOutlinedNodes = function(callback) {
|
|
452
|
-
this._outlinedNodes.forEach(callback);
|
|
453
|
-
return this;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Gets the selection state of the node.
|
|
458
|
-
*
|
|
459
|
-
* If a single node reference is passed to the method then a single selection state is returned.<br/>
|
|
460
|
-
* If an array of node references is passed to the method then an array of selection states is returned.
|
|
461
|
-
*
|
|
462
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
463
|
-
* @returns {boolean|boolean[]} A single value or an array of values where the value is <code>true</code> if the node is selected, <code>false</code> otherwise.
|
|
464
|
-
* @public
|
|
465
|
-
*/
|
|
466
|
-
ViewStateManager.prototype.getSelectionState = function(nodeRefs) {
|
|
467
|
-
var selected = this._selectedNodes.has.bind(this._selectedNodes);
|
|
468
|
-
|
|
469
|
-
return Array.isArray(nodeRefs) ? nodeRefs.map(selected) : selected(nodeRefs); // NB: The nodeRefs argument is a single nodeRef.
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
ViewStateManager.prototype._addBoundingBox = function(nodeRef) {
|
|
473
|
-
var state = this._getNodeState(nodeRef, true);
|
|
474
|
-
|
|
475
|
-
if (state.boundingBoxNode == null) {
|
|
476
|
-
var boundingBox = new THREE.Box3();
|
|
477
|
-
ThreeUtils.computeObjectOrientedBoundingBox(nodeRef, boundingBox);
|
|
478
|
-
|
|
479
|
-
// TODO(VSM): do we need to check for `!box.isEmpty()` before creating `helper`? What if the bounding box changes
|
|
480
|
-
// later - either to isEmpty() or from isEmpty()? Isn't it better to always have a Box3Helper?
|
|
481
|
-
var boundingBoxNode = new THREE.Box3Helper(boundingBox, boundingBoxColor);
|
|
482
|
-
this._boundingBoxesScene.add(boundingBoxNode);
|
|
483
|
-
// the owner of `boundingBoxNode` is `_boundingBoxesScene`; this parent is used for world matrix calculations only.
|
|
484
|
-
boundingBoxNode.parent = nodeRef;
|
|
485
|
-
|
|
486
|
-
state.boundingBoxNode = boundingBoxNode;
|
|
487
|
-
} else {
|
|
488
|
-
// Bounding box was already added.
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
return this;
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
ViewStateManager.prototype._removeBoundingBox = function(nodeRef) {
|
|
495
|
-
var state = this._getNodeState(nodeRef, false);
|
|
496
|
-
|
|
497
|
-
if (state != null && state.boundingBoxNode != null) {
|
|
498
|
-
this._boundingBoxesScene.remove(state.boundingBoxNode);
|
|
499
|
-
ThreeUtils.disposeObject(state.boundingBoxNode);
|
|
500
|
-
state.boundingBoxNode = null;
|
|
501
|
-
} else {
|
|
502
|
-
// Bounding box does not exist or was already removed.
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return this;
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
ViewStateManager.prototype._expandBoundingBoxWithSelected = function(boundingBox) {
|
|
509
|
-
this._selectedNodes.forEach(function(node) {
|
|
510
|
-
node._expandBoundingBox(boundingBox, false, false, false);
|
|
511
|
-
});
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
ViewStateManager.prototype._updateBoundingBoxes = function() {
|
|
515
|
-
var nodeStates = this._nodeStates;
|
|
516
|
-
|
|
517
|
-
this._selectedNodes.forEach(function(nodeRef) {
|
|
518
|
-
var state = nodeStates.get(nodeRef);
|
|
519
|
-
|
|
520
|
-
if (state != null && state.boundingBoxNode != null) {
|
|
521
|
-
ThreeUtils.computeObjectOrientedBoundingBox(nodeRef, state.boundingBoxNode.box);
|
|
522
|
-
} else {
|
|
523
|
-
// Bounding box for node does not exist. Probably `showSelectionBoundingBox === false`.
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
return this;
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Sets if showing the bounding box when nodes are selected
|
|
533
|
-
*
|
|
534
|
-
* @param {boolean} val <code>true</code> if bounding boxes of selected nodes are shown, <code>false</code> otherwise.
|
|
535
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
536
|
-
* @public
|
|
537
|
-
*/
|
|
538
|
-
ViewStateManager.prototype.setShowSelectionBoundingBox = function(val) {
|
|
539
|
-
this._showSelectionBoundingBox = val;
|
|
540
|
-
this._selectedNodes.forEach(val ? this._addBoundingBox : this._removeBoundingBox, this);
|
|
541
|
-
|
|
542
|
-
// TODO(VSM): WTF? The selection does not change! Is this to force Viewport to rerender?
|
|
543
|
-
this.fireSelectionChanged({
|
|
544
|
-
selected: this._selectedNodes, // TODO(VSM): WTF? selected is array, this._selected is Set.
|
|
545
|
-
unselected: []
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
return this;
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Gets if showing the bounding box when nodes are selected
|
|
553
|
-
*
|
|
554
|
-
* @returns {boolean} <code>true</code> if bounding boxes of selected nodes are shown, <code>false</code> otherwise.
|
|
555
|
-
* @public
|
|
556
|
-
*/
|
|
557
|
-
ViewStateManager.prototype.getShowSelectionBoundingBox = function() {
|
|
558
|
-
return this._showSelectionBoundingBox;
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Sets the selection state of the nodes.
|
|
563
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
564
|
-
* @param {boolean} selected The new selection state of the nodes.
|
|
565
|
-
* @param {boolean} recursive The flags indicates if the change needs to propagate recursively to child nodes.
|
|
566
|
-
* @param {boolean} blockNotification The flag to suppress selectionChanged event.
|
|
567
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
568
|
-
* @deprecated Since version 1.56.3. Use {@link sap.ui.vk.threejs.v2.ViewStateManager#setSelectionStates} instead.
|
|
569
|
-
* @public
|
|
570
|
-
*/
|
|
571
|
-
ViewStateManager.prototype.setSelectionState = function(nodeRefs, selected, recursive, blockNotification) {
|
|
572
|
-
if (!nodeRefs) {
|
|
573
|
-
return this;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if (!Array.isArray(nodeRefs)) {
|
|
577
|
-
nodeRefs = [nodeRefs];
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// First, extend `nodeRefs` with descendant nodes based on parameter `recursive` or property `recursiveSelection`.
|
|
581
|
-
nodeRefs = (recursive || this.getRecursiveSelection() ? this._collectNodesRecursively(nodeRefs) : nodeRefs)
|
|
582
|
-
.filter(function(value, index, array) {
|
|
583
|
-
return array.indexOf(value) === index;
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
// Then, extend `nodeRefs` with ancestors of nodes being unselected if the
|
|
587
|
-
// `recursiveSelection` property (but not necessarily the `recursive` parameter) is `true`.
|
|
588
|
-
if (this.getRecursiveSelection() && !selected) {
|
|
589
|
-
// E.g. if we deselect node D1 while the `recursiveSelection` property is `true` we
|
|
590
|
-
// deselect its ancestors C and B recursively. Nodes E and F are unselected previously,
|
|
591
|
-
// see the code above.
|
|
592
|
-
//
|
|
593
|
-
// The siblings stay as is.
|
|
594
|
-
//
|
|
595
|
-
// [ ] A [ ] A
|
|
596
|
-
// [x] B [ ] B
|
|
597
|
-
// [X] C -> [ ] C
|
|
598
|
-
// [X] *D1* [ ] *D1*
|
|
599
|
-
// [X] E [ ] E
|
|
600
|
-
// [X] F [ ] F
|
|
601
|
-
// [X] D2 [X] D2
|
|
602
|
-
// [X] D3 [X] D3
|
|
603
|
-
nodeRefs = this._nodeHierarchy._appendAncestors(nodeRefs);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
var selectedNodes = this._selectedNodes;
|
|
607
|
-
|
|
608
|
-
// These are the nodes whose selection state changed.
|
|
609
|
-
var changed = nodeRefs.filter(function(nodeRef) {
|
|
610
|
-
return selectedNodes.has(nodeRef) !== selected;
|
|
611
|
-
}, this);
|
|
612
|
-
|
|
613
|
-
if (changed.length > 0) {
|
|
614
|
-
this._applySelectionNodeState(changed, selected);
|
|
615
|
-
|
|
616
|
-
if (!selected) {
|
|
617
|
-
this._deleteUnusedNodeStates();
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
this._updateNodeStateMaterials();
|
|
621
|
-
|
|
622
|
-
if (!blockNotification) {
|
|
623
|
-
this.fireSelectionChanged({
|
|
624
|
-
selected: selected ? changed : [],
|
|
625
|
-
unselected: selected ? [] : changed
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
return this;
|
|
631
|
-
};
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Sets or resets the selection state of the nodes.
|
|
635
|
-
* @param {any|any[]} selectedNodeRefs The node reference or the array of node references of selected nodes.
|
|
636
|
-
* @param {any|any[]} unselectedNodeRefs The node reference or the array of node references of unselected nodes.
|
|
637
|
-
* @param {boolean} recursive The flags indicates if the change needs to propagate recursively to child nodes.
|
|
638
|
-
* @param {boolean} blockNotification The flag to suppress selectionChanged event.
|
|
639
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
640
|
-
* @public
|
|
641
|
-
*/
|
|
642
|
-
ViewStateManager.prototype.setSelectionStates = function(selectedNodeRefs, unselectedNodeRefs, recursive, blockNotification) {
|
|
643
|
-
if (!Array.isArray(selectedNodeRefs)) {
|
|
644
|
-
selectedNodeRefs = [selectedNodeRefs];
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
if (!Array.isArray(unselectedNodeRefs)) {
|
|
648
|
-
unselectedNodeRefs = [unselectedNodeRefs];
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
selectedNodeRefs = (recursive || this.getRecursiveSelection() ? this._collectNodesRecursively(selectedNodeRefs) : selectedNodeRefs);
|
|
652
|
-
unselectedNodeRefs = (recursive || this.getRecursiveSelection() ? this._collectNodesRecursively(unselectedNodeRefs) : unselectedNodeRefs);
|
|
653
|
-
|
|
654
|
-
if (this.getRecursiveSelection()) {
|
|
655
|
-
unselectedNodeRefs = this._nodeHierarchy._appendAncestors(unselectedNodeRefs, selectedNodeRefs);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
var selected = selectedNodeRefs.filter(function(nodeRef) {
|
|
659
|
-
return this._selectedNodes.has(nodeRef) === false;
|
|
660
|
-
}, this);
|
|
661
|
-
|
|
662
|
-
var unselected = unselectedNodeRefs.filter(function(nodeRef) {
|
|
663
|
-
return this._selectedNodes.has(nodeRef) === true;
|
|
664
|
-
}, this);
|
|
665
|
-
|
|
666
|
-
if (selected.length > 0 || unselected.length > 0) {
|
|
667
|
-
this._applySelectionNodeState(selected, true);
|
|
668
|
-
this._applySelectionNodeState(unselected, false);
|
|
669
|
-
|
|
670
|
-
if (unselected.length > 0) {
|
|
671
|
-
this._deleteUnusedNodeStates();
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
this._updateNodeStateMaterials();
|
|
675
|
-
|
|
676
|
-
if (!blockNotification) {
|
|
677
|
-
this.fireSelectionChanged({
|
|
678
|
-
selected: selected,
|
|
679
|
-
unselected: unselected
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
return this;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Sets the outline color
|
|
689
|
-
* @param {sap.ui.core.CSSColor|string|int} color The new outline color. The value can be defined as a string
|
|
690
|
-
* in the CSS color format or as an integer in the ABGR format. If <code>null</code>
|
|
691
|
-
* is passed then the tint color is reset and the node's own tint color should be used.
|
|
692
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
693
|
-
* @public
|
|
694
|
-
*/
|
|
695
|
-
ViewStateManager.prototype.setOutlineColor = function(color) {
|
|
696
|
-
switch (typeof color) {
|
|
697
|
-
case "number":
|
|
698
|
-
this._outlineColorABGR = color;
|
|
699
|
-
break;
|
|
700
|
-
case "string":
|
|
701
|
-
const CSSColor = DataType.getType("sap.ui.core.CSSColor");
|
|
702
|
-
if (CSSColor.isValid(color)) {
|
|
703
|
-
this._outlineColorABGR = colorToABGR(cssColorToColor(color));
|
|
704
|
-
}
|
|
705
|
-
break;
|
|
706
|
-
default:
|
|
707
|
-
return this;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
this.fireOutlineColorChanged({
|
|
711
|
-
outlineColor: colorToCSSColor(abgrToColor(this._outlineColorABGR)),
|
|
712
|
-
outlineColorABGR: this._outlineColorABGR
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
return this;
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* Gets the outline color
|
|
721
|
-
*
|
|
722
|
-
* @param {boolean} [inABGRFormat=false] This flag indicates to return the outline color in the ABGR format,
|
|
723
|
-
* if it equals <code>false</code> then the color is returned in the CSS color format.
|
|
724
|
-
* @returns {sap.ui.core.CSSColor|string|int}
|
|
725
|
-
* A single value or an array of values. Value <code>null</code> means that
|
|
726
|
-
* the node's own tint color should be used.
|
|
727
|
-
* @public
|
|
728
|
-
*/
|
|
729
|
-
ViewStateManager.prototype.getOutlineColor = function(inABGRFormat) {
|
|
730
|
-
return inABGRFormat ? this._outlineColorABGR : colorToCSSColor(abgrToColor(this._outlineColorABGR));
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* Gets the outlining state of the node.
|
|
736
|
-
*
|
|
737
|
-
* If a single node reference is passed to the method then a single outlining state is returned.<br/>
|
|
738
|
-
* If an array of node references is passed to the method then an array of outlining states is returned.
|
|
739
|
-
*
|
|
740
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
741
|
-
* @returns {boolean|boolean[]} A single value or an array of values where the value is <code>true</code> if the node is selected, <code>false</code> otherwise.
|
|
742
|
-
* @public
|
|
743
|
-
*/
|
|
744
|
-
ViewStateManager.prototype.getOutliningState = function(nodeRefs) {
|
|
745
|
-
var outliningSet = this._outlinedNodes;
|
|
746
|
-
function isOutlined(nodeRef) {
|
|
747
|
-
return outliningSet.has(nodeRef);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
return Array.isArray(nodeRefs) ?
|
|
751
|
-
nodeRefs.map(isOutlined) : isOutlined(nodeRefs); // NB: The nodeRefs argument is a single no
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Sets or resets the outlining state of the nodes.
|
|
757
|
-
* @param {any|any[]} outlinedNodeRefs The node reference or the array of node references of outlined nodes.
|
|
758
|
-
* @param {any|any[]} unoutlinedNodeRefs The node reference or the array of node references of un-outlined nodes.
|
|
759
|
-
* @param {boolean} recursive The flags indicates if the change needs to propagate recursively to child nodes.
|
|
760
|
-
* @param {boolean} blockNotification The flag to suppress outlineChanged event.
|
|
761
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
762
|
-
* @public
|
|
763
|
-
*/
|
|
764
|
-
ViewStateManager.prototype.setOutliningStates = function(outlinedNodeRefs, unoutlinedNodeRefs, recursive, blockNotification) {
|
|
765
|
-
if (!Array.isArray(outlinedNodeRefs)) {
|
|
766
|
-
outlinedNodeRefs = [outlinedNodeRefs];
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
if (!Array.isArray(unoutlinedNodeRefs)) {
|
|
770
|
-
unoutlinedNodeRefs = [unoutlinedNodeRefs];
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
outlinedNodeRefs = (recursive || this.getRecursiveOutlining() ? this._collectNodesRecursively(outlinedNodeRefs) : outlinedNodeRefs);
|
|
774
|
-
unoutlinedNodeRefs = (recursive || this.getRecursiveOutlining() ? this._collectNodesRecursively(unoutlinedNodeRefs) : unoutlinedNodeRefs);
|
|
775
|
-
|
|
776
|
-
if (this.getRecursiveOutlining()) {
|
|
777
|
-
unoutlinedNodeRefs = this._nodeHierarchy._appendAncestors(unoutlinedNodeRefs, outlinedNodeRefs);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
var outlined = outlinedNodeRefs.filter(function(nodeRef) {
|
|
781
|
-
return this._outlinedNodes.has(nodeRef) === false;
|
|
782
|
-
}, this);
|
|
783
|
-
|
|
784
|
-
var unoutlined = unoutlinedNodeRefs.filter(function(nodeRef) {
|
|
785
|
-
return this._outlinedNodes.has(nodeRef) === true;
|
|
786
|
-
}, this);
|
|
787
|
-
|
|
788
|
-
if (outlined.length > 0 || unoutlined.length > 0) {
|
|
789
|
-
outlined.forEach(function(nodeRef) {
|
|
790
|
-
this._outlinedNodes.add(nodeRef);
|
|
791
|
-
}, this);
|
|
792
|
-
|
|
793
|
-
unoutlined.forEach(function(nodeRef) {
|
|
794
|
-
this._outlinedNodes.delete(nodeRef);
|
|
795
|
-
}, this);
|
|
796
|
-
|
|
797
|
-
if (!blockNotification) {
|
|
798
|
-
this.fireOutliningChanged({
|
|
799
|
-
outlined: outlined,
|
|
800
|
-
unoutlined: unoutlined
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
return this;
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Sets the outline width
|
|
810
|
-
* @param {float} width width of outline
|
|
811
|
-
* @returns {this} <code>this</code> to allow method chaining.
|
|
812
|
-
* @public
|
|
813
|
-
*/
|
|
814
|
-
ViewStateManager.prototype.setOutlineWidth = function(width) {
|
|
815
|
-
this._outlineWidth = width;
|
|
816
|
-
// this._outlineRenderer.setOutlineWidth(width);
|
|
817
|
-
this.fireOutlineWidthChanged({
|
|
818
|
-
width: width
|
|
819
|
-
});
|
|
820
|
-
return this;
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Gets the outline width
|
|
825
|
-
* @returns {float} width of outline
|
|
826
|
-
* @public
|
|
827
|
-
*/
|
|
828
|
-
ViewStateManager.prototype.getOutlineWidth = function() {
|
|
829
|
-
return this._outlineWidth;
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* Gets the opacity of the node.
|
|
834
|
-
*
|
|
835
|
-
* A helper method to ensure the returned value is either <code>float</code> or <code>null</code>.
|
|
836
|
-
*
|
|
837
|
-
* @param {any} nodeRef The node reference.
|
|
838
|
-
* @returns {float|null} The opacity or <code>null</code> if no opacity set.
|
|
839
|
-
* @private
|
|
840
|
-
*/
|
|
841
|
-
ViewStateManager.prototype._getOpacity = function(nodeRef) {
|
|
842
|
-
var state = this._getNodeState(nodeRef, false);
|
|
843
|
-
return state != null ? state._opacity : null;
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
/**
|
|
847
|
-
* Gets the opacity of the node.
|
|
848
|
-
*
|
|
849
|
-
* If a single node is passed to the method then a single value is returned.<br/>
|
|
850
|
-
* If an array of nodes is passed to the method then an array of values is returned.
|
|
851
|
-
*
|
|
852
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
853
|
-
* @returns {float|float[]|null|null[]} A single value or an array of values. Value <code>null</code> means that the node's own opacity should be used.
|
|
854
|
-
* @public
|
|
855
|
-
*/
|
|
856
|
-
ViewStateManager.prototype.getOpacity = function(nodeRefs) {
|
|
857
|
-
if (Array.isArray(nodeRefs)) {
|
|
858
|
-
return nodeRefs.map(this._getOpacity, this);
|
|
859
|
-
} else {
|
|
860
|
-
return this._getOpacity(nodeRefs); // NB: The nodeRefs argument is a single nodeRef.
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Sets the opacity of the nodes.
|
|
866
|
-
*
|
|
867
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
868
|
-
* @param {float|float[]|null} opacity The new opacity of the nodes. If <code>null</code> is passed then the opacity is reset
|
|
869
|
-
* and the node's own opacity should be used.
|
|
870
|
-
* @param {boolean} [recursive=false] This flag is not used, as opacity is always recursively applied to the offspring nodes by multiplication
|
|
871
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
872
|
-
* @public
|
|
873
|
-
*/
|
|
874
|
-
ViewStateManager.prototype.setOpacity = function(nodeRefs, opacity, recursive) {
|
|
875
|
-
// normalize parameters to have array of nodeRefs and array of visibility values
|
|
876
|
-
if (!Array.isArray(nodeRefs)) {
|
|
877
|
-
nodeRefs = [nodeRefs];
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
// check if we got an array as opacity
|
|
881
|
-
var isBulkChange = Array.isArray(opacity);
|
|
882
|
-
|
|
883
|
-
var recursiveOpacities = [];
|
|
884
|
-
var allNodeRefs = nodeRefs;
|
|
885
|
-
|
|
886
|
-
if (recursive) {
|
|
887
|
-
allNodeRefs = [];
|
|
888
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
889
|
-
var collected = this._collectNodesRecursively(nodeRef);
|
|
890
|
-
allNodeRefs = allNodeRefs.concat(collected);
|
|
891
|
-
|
|
892
|
-
var length = recursiveOpacities.length;
|
|
893
|
-
recursiveOpacities.length += collected.length;
|
|
894
|
-
recursiveOpacities.fill(isBulkChange ? opacity[index] : opacity, length);
|
|
895
|
-
}, this);
|
|
896
|
-
} else if (!isBulkChange) {
|
|
897
|
-
// not recursive, opacity is a scalar
|
|
898
|
-
recursiveOpacities.length = allNodeRefs.length;
|
|
899
|
-
recursiveOpacities.fill(opacity);
|
|
900
|
-
} else {
|
|
901
|
-
// not recursive, opacity is an array
|
|
902
|
-
recursiveOpacities = opacity;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
// filter out unchanged opacity and duplicate nodes
|
|
906
|
-
var changedOpacities = [];
|
|
907
|
-
var usedNodeRefs = new Set();
|
|
908
|
-
var changedNodeRefs = allNodeRefs.filter(function(nodeRef, index) {
|
|
909
|
-
if (usedNodeRefs.has(nodeRef)) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
usedNodeRefs.add(nodeRef);
|
|
914
|
-
|
|
915
|
-
var state = this._getNodeState(nodeRef, false);
|
|
916
|
-
var opacity = recursiveOpacities[index];
|
|
917
|
-
var changed = state == null && opacity != null || state != null && state.opacity !== opacity;
|
|
918
|
-
if (changed) {
|
|
919
|
-
changedOpacities.push(opacity);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
return changed;
|
|
923
|
-
}, this);
|
|
924
|
-
|
|
925
|
-
if (changedNodeRefs.length > 0) {
|
|
926
|
-
this._applyOpacityNodeState(changedNodeRefs, changedOpacities);
|
|
927
|
-
this._deleteUnusedNodeStates();
|
|
928
|
-
this._updateNodeStateMaterials();
|
|
929
|
-
|
|
930
|
-
var eventParameters = {
|
|
931
|
-
changed: changedNodeRefs,
|
|
932
|
-
opacity: isBulkChange ? changedOpacities : changedOpacities[0]
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
this.fireOpacityChanged(eventParameters);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
return this;
|
|
939
|
-
};
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Gets the tint color of the node in the ABGR format.
|
|
943
|
-
*
|
|
944
|
-
* A helper method to ensure that the returned value is either <code>int</code> or <code>null</code>.
|
|
945
|
-
*
|
|
946
|
-
* @param {any} nodeRef The node reference.
|
|
947
|
-
* @returns {int|null} The color in the ABGR format or <code>null</code> if no tint color is set.
|
|
948
|
-
* @private
|
|
949
|
-
*/
|
|
950
|
-
ViewStateManager.prototype._getTintColorABGR = function(nodeRef) {
|
|
951
|
-
var state = this._getNodeState(nodeRef, false);
|
|
952
|
-
return state && state.tintColor;
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* Gets the tint color in the CSS color format.
|
|
957
|
-
*
|
|
958
|
-
* A helper method to ensure that the returned value is either {@link sap.ui.core.CSSColor} or <code>null</code>.
|
|
959
|
-
*
|
|
960
|
-
* @param {any} nodeRef The node reference.
|
|
961
|
-
* @returns {sap.ui.core.CSSColor|null} The color in the CSS color format or <code>null</code> if no tint color is set.
|
|
962
|
-
* @private
|
|
963
|
-
*/
|
|
964
|
-
ViewStateManager.prototype._getTintColor = function(nodeRef) {
|
|
965
|
-
var tintColorABGR = this._getTintColorABGR(nodeRef);
|
|
966
|
-
return tintColorABGR != null ? colorToCSSColor(abgrToColor(tintColorABGR)) : null;
|
|
967
|
-
};
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Gets the tint color of the node.
|
|
971
|
-
*
|
|
972
|
-
* If a single node reference is passed to the method then a single value is returned.<br/>
|
|
973
|
-
* If an array of node references is passed to the method then an array of values is returned.
|
|
974
|
-
*
|
|
975
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
976
|
-
* @param {boolean} [inABGRFormat=false] This flag indicates to return the tint color in the ABGR format,
|
|
977
|
-
* if it equals <code>false</code> then the color is returned in the CSS color format.
|
|
978
|
-
* @returns {sap.ui.core.CSSColor|sap.ui.core.CSSColor[]|int|int[]}
|
|
979
|
-
* A single value or an array of values. Value <code>null</code> means that
|
|
980
|
-
* the node's own tint color should be used.
|
|
981
|
-
* @public
|
|
982
|
-
*/
|
|
983
|
-
ViewStateManager.prototype.getTintColor = function(nodeRefs, inABGRFormat) {
|
|
984
|
-
var getTintColorMethod = inABGRFormat ? this._getTintColorABGR : this._getTintColor;
|
|
985
|
-
if (Array.isArray(nodeRefs)) {
|
|
986
|
-
return nodeRefs.map(getTintColorMethod, this);
|
|
987
|
-
} else {
|
|
988
|
-
return getTintColorMethod.call(this, nodeRefs); // NB: The nodeRefs argument is a single nodeRef.
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
function toABGR(color) {
|
|
993
|
-
switch (typeof color) {
|
|
994
|
-
case "number":
|
|
995
|
-
return color;
|
|
996
|
-
case "string":
|
|
997
|
-
const CSSColor = DataType.getType("sap.ui.core.CSSColor");
|
|
998
|
-
return CSSColor.isValid(color) ? colorToABGR(cssColorToColor(color)) : null;
|
|
999
|
-
default:
|
|
1000
|
-
return null; // The color is invalid, reset it to null.
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* Sets the tint color of the nodes.
|
|
1006
|
-
* @param {any|any[]} nodeRefs The node reference or the array of node references.
|
|
1007
|
-
* @param {sap.ui.core.CSSColor|int|sap.ui.core.CSSColor[]|int[]|null} tintColor The new tint color of the nodes. The
|
|
1008
|
-
* value can be defined as a string in the CSS color format
|
|
1009
|
-
* or as an integer in the ABGR format or it could be an
|
|
1010
|
-
* array of these values. If <code>null</code> is passed then
|
|
1011
|
-
* the tint color is reset and the node's own tint color
|
|
1012
|
-
* should be used.
|
|
1013
|
-
* @param {boolean} [recursive=false] This flag indicates if the change needs to propagate
|
|
1014
|
-
* recursively to child nodes.
|
|
1015
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
1016
|
-
* @public
|
|
1017
|
-
*/
|
|
1018
|
-
ViewStateManager.prototype.setTintColor = function(nodeRefs, tintColor, recursive) {
|
|
1019
|
-
if (!Array.isArray(nodeRefs)) {
|
|
1020
|
-
nodeRefs = [nodeRefs];
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
// check if we got an array as tint color
|
|
1024
|
-
var isBulkChange = Array.isArray(tintColor);
|
|
1025
|
-
|
|
1026
|
-
var recursiveColors = [];
|
|
1027
|
-
var allNodeRefs = nodeRefs;
|
|
1028
|
-
|
|
1029
|
-
if (recursive) {
|
|
1030
|
-
allNodeRefs = [];
|
|
1031
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
1032
|
-
var collected = this._collectNodesRecursively(nodeRef);
|
|
1033
|
-
allNodeRefs = allNodeRefs.concat(collected);
|
|
1034
|
-
|
|
1035
|
-
var length = recursiveColors.length;
|
|
1036
|
-
recursiveColors.length += collected.length;
|
|
1037
|
-
recursiveColors.fill(isBulkChange ? tintColor[index] : tintColor, length);
|
|
1038
|
-
}, this);
|
|
1039
|
-
} else if (!isBulkChange) {
|
|
1040
|
-
// not recursive, tintColor is a scalar
|
|
1041
|
-
recursiveColors.length = allNodeRefs.length;
|
|
1042
|
-
recursiveColors.fill(tintColor);
|
|
1043
|
-
} else {
|
|
1044
|
-
// not recursive, tintColor is an array
|
|
1045
|
-
recursiveColors = tintColor;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
// filter out unchanged tintColor and duplicate nodes
|
|
1049
|
-
var changedColors = [];
|
|
1050
|
-
var changedColorsABGR = [];
|
|
1051
|
-
var usedNodeRefs = new Set();
|
|
1052
|
-
var changedNodeRefs = allNodeRefs.filter(function(nodeRef, index) {
|
|
1053
|
-
if (usedNodeRefs.has(nodeRef)) {
|
|
1054
|
-
return false;
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
usedNodeRefs.add(nodeRef);
|
|
1058
|
-
|
|
1059
|
-
var state = this._getNodeState(nodeRef, false);
|
|
1060
|
-
var tintColor = recursiveColors[index];
|
|
1061
|
-
var tintColorABGR = toABGR(recursiveColors[index]);
|
|
1062
|
-
var changed = state == null && tintColor != null || state != null && state.tintColor !== tintColorABGR;
|
|
1063
|
-
if (changed) {
|
|
1064
|
-
changedColors.push(tintColor);
|
|
1065
|
-
changedColorsABGR.push(tintColorABGR);
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
return changed;
|
|
1069
|
-
}, this);
|
|
1070
|
-
|
|
1071
|
-
if (changedNodeRefs.length > 0) {
|
|
1072
|
-
this._applyTintColorNodeState(changedNodeRefs, changedColorsABGR);
|
|
1073
|
-
this._deleteUnusedNodeStates();
|
|
1074
|
-
this._updateNodeStateMaterials();
|
|
1075
|
-
|
|
1076
|
-
var eventParameters = {
|
|
1077
|
-
changed: changedNodeRefs,
|
|
1078
|
-
tintColor: isBulkChange ? changedColors : changedColors[0],
|
|
1079
|
-
tintColorABGR: isBulkChange ? changedColorsABGR : changedColorsABGR[0]
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
|
-
this.fireTintColorChanged(eventParameters);
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
return this;
|
|
1086
|
-
};
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Sets the default highlighting color
|
|
1090
|
-
* @param {sap.ui.core.CSSColor|string|int} color The new highlighting color. The value can be defined as a string in
|
|
1091
|
-
* the CSS color format or as an integer in the ABGR format. If
|
|
1092
|
-
* <code>null</code> is passed then the tint color is reset and the
|
|
1093
|
-
* node's own tint color should be used.
|
|
1094
|
-
* @returns {this} Returns <code>this</code> to allow method chaining
|
|
1095
|
-
* @public
|
|
1096
|
-
*/
|
|
1097
|
-
ViewStateManager.prototype.setHighlightColor = function(color) {
|
|
1098
|
-
|
|
1099
|
-
switch (typeof color) {
|
|
1100
|
-
case "number":
|
|
1101
|
-
this._highlightColorABGR = color;
|
|
1102
|
-
break;
|
|
1103
|
-
case "string":
|
|
1104
|
-
const CSSColor = DataType.getType("sap.ui.core.CSSColor");
|
|
1105
|
-
if (CSSColor.isValid(color)) {
|
|
1106
|
-
this._highlightColorABGR = colorToABGR(cssColorToColor(color));
|
|
1107
|
-
}
|
|
1108
|
-
break;
|
|
1109
|
-
default:
|
|
1110
|
-
return this;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
if (this._selectedNodes.size > 0) {
|
|
1114
|
-
// NB: above we check if there are any nodes selected and below we traverse `_nodeStates` because unselected
|
|
1115
|
-
// descendants of selected nodes are not in `_selectedNodes` and we need to update both classes of nodes.
|
|
1116
|
-
this._nodeStates.forEach(function(state) {
|
|
1117
|
-
if (state.selected || state.ancestorSelected) {
|
|
1118
|
-
state.needsMaterialUpdate = true;
|
|
1119
|
-
}
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
this.fireHighlightColorChanged({
|
|
1124
|
-
highlightColor: colorToCSSColor(abgrToColor(this._highlightColorABGR)),
|
|
1125
|
-
highlightColorABGR: this._highlightColorABGR
|
|
1126
|
-
});
|
|
1127
|
-
|
|
1128
|
-
return this;
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
ViewStateManager.prototype._getNodeState = function(nodeRef, createIfNotExists) {
|
|
1132
|
-
var nodeStates = this._nodeStates;
|
|
1133
|
-
var state = nodeStates.get(nodeRef);
|
|
1134
|
-
if (state == null && createIfNotExists) {
|
|
1135
|
-
state = {
|
|
1136
|
-
visible: null,
|
|
1137
|
-
originalVisible: null,
|
|
1138
|
-
selected: false,
|
|
1139
|
-
ancestorSelected: false,
|
|
1140
|
-
tintColor: null,
|
|
1141
|
-
ancestorTintColor: null,
|
|
1142
|
-
opacity: null,
|
|
1143
|
-
ancestorOverridesOpacity: false,
|
|
1144
|
-
boundingBoxNode: null,
|
|
1145
|
-
material: null,
|
|
1146
|
-
originalMaterial: null,
|
|
1147
|
-
needsMaterialUpdate: false
|
|
1148
|
-
};
|
|
1149
|
-
nodeStates.set(nodeRef, state);
|
|
1150
|
-
}
|
|
1151
|
-
return state;
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
ViewStateManager.prototype._deleteUnusedNodeStates = function() {
|
|
1155
|
-
var materialCache = this._materialCache;
|
|
1156
|
-
this._nodeStates.forEach(function(state, nodeRef, nodeStates) {
|
|
1157
|
-
if (state.visible == null
|
|
1158
|
-
&& !state.selected
|
|
1159
|
-
&& !state.ancestorSelected
|
|
1160
|
-
&& state.tintColor == null
|
|
1161
|
-
&& state.ancestorTintColor == null
|
|
1162
|
-
&& state.opacity == null
|
|
1163
|
-
&& !state.ancestorOverridesOpacity
|
|
1164
|
-
) {
|
|
1165
|
-
nodeStates.delete(nodeRef);
|
|
1166
|
-
if (state.material != null) {
|
|
1167
|
-
materialCache.releaseMaterial(state.material);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
});
|
|
1171
|
-
|
|
1172
|
-
return this;
|
|
1173
|
-
};
|
|
1174
|
-
|
|
1175
|
-
ViewStateManager.prototype._applyVisibilityNodeState = function(nodeRefs, visibilities) {
|
|
1176
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
1177
|
-
var newVisibility = visibilities[index];
|
|
1178
|
-
var ownVisibility = nodeRef.visible;
|
|
1179
|
-
var newVisibilityIsDifferentFromOwn = newVisibility !== ownVisibility;
|
|
1180
|
-
var state = this._getNodeState(nodeRef, newVisibilityIsDifferentFromOwn);
|
|
1181
|
-
if (state) {
|
|
1182
|
-
if (newVisibilityIsDifferentFromOwn) {
|
|
1183
|
-
state.visible = newVisibility;
|
|
1184
|
-
} else {
|
|
1185
|
-
// When we assign `null` the state is marked for deletion as it might be identical to the unmodified
|
|
1186
|
-
// original state.
|
|
1187
|
-
state.visible = null;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
}, this);
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
|
-
ViewStateManager.prototype._applySelectionNodeState = function(nodeRefs, selected) {
|
|
1194
|
-
if (selected) {
|
|
1195
|
-
nodeRefs.forEach(function(nodeRef) {
|
|
1196
|
-
this._selectedNodes.add(nodeRef);
|
|
1197
|
-
if (this._showSelectionBoundingBox) {
|
|
1198
|
-
this._addBoundingBox(nodeRef);
|
|
1199
|
-
}
|
|
1200
|
-
var state = this._getNodeState(nodeRef, true);
|
|
1201
|
-
var nodeWasHighlighted = nodeIsHighlighted(state);
|
|
1202
|
-
state.selected = true;
|
|
1203
|
-
if (nodeIsHighlighted(state) !== nodeWasHighlighted) {
|
|
1204
|
-
state.needsMaterialUpdate = true;
|
|
1205
|
-
}
|
|
1206
|
-
// If state.ancestorSelected === true then descendants have already been processed.
|
|
1207
|
-
if (!state.ancestorSelected) {
|
|
1208
|
-
nodeRef.children.forEach(this._setAncestorSelectedRecursively.bind(this, true), this);
|
|
1209
|
-
}
|
|
1210
|
-
}, this);
|
|
1211
|
-
} else {
|
|
1212
|
-
nodeRefs.forEach(function(nodeRef) {
|
|
1213
|
-
this._selectedNodes.delete(nodeRef);
|
|
1214
|
-
if (this._showSelectionBoundingBox) {
|
|
1215
|
-
this._removeBoundingBox(nodeRef);
|
|
1216
|
-
}
|
|
1217
|
-
var state = this._getNodeState(nodeRef, false);
|
|
1218
|
-
if (state != null) {
|
|
1219
|
-
var nodeWasHighlighted = nodeIsHighlighted(state);
|
|
1220
|
-
state.selected = false;
|
|
1221
|
-
if (nodeIsHighlighted(state) !== nodeWasHighlighted) {
|
|
1222
|
-
state.needsMaterialUpdate = true;
|
|
1223
|
-
}
|
|
1224
|
-
// If state.ancestorSelected === true then the descendants also are highlighted and we should not
|
|
1225
|
-
// unset the state, they inherit it from the node's ancestor.
|
|
1226
|
-
if (!state.ancestorSelected) {
|
|
1227
|
-
nodeRef.children.forEach(this._setAncestorSelectedRecursively.bind(this, false), this);
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
}, this);
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
return this;
|
|
1234
|
-
};
|
|
1235
|
-
|
|
1236
|
-
ViewStateManager.prototype._setAncestorSelectedRecursively = function(ancestorSelected, nodeRef) {
|
|
1237
|
-
var state = this._getNodeState(nodeRef, ancestorSelected);
|
|
1238
|
-
if (state != null && state.ancestorSelected !== ancestorSelected) {
|
|
1239
|
-
var nodeWasHighlighted = nodeIsHighlighted(state);
|
|
1240
|
-
state.ancestorSelected = ancestorSelected;
|
|
1241
|
-
if (nodeIsHighlighted(state) !== nodeWasHighlighted) {
|
|
1242
|
-
state.needsMaterialUpdate = true;
|
|
1243
|
-
}
|
|
1244
|
-
// If state.selected === true then its descendants have already been processed.
|
|
1245
|
-
if (!state.selected) {
|
|
1246
|
-
nodeRef.children.forEach(this._setAncestorSelectedRecursively.bind(this, ancestorSelected), this);
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
return this;
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
ViewStateManager.prototype._applyTintColorNodeState = function(nodeRefs, colors) {
|
|
1254
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
1255
|
-
var tintColor = colors[index];
|
|
1256
|
-
var state = this._getNodeState(nodeRef, tintColor != null);
|
|
1257
|
-
if (state != null) {
|
|
1258
|
-
state.tintColor = tintColor;
|
|
1259
|
-
state.needsMaterialUpdate = true;
|
|
1260
|
-
nodeRef.children.forEach(this._setAncestorTintColorRecursively.bind(this,
|
|
1261
|
-
tintColor != null ? tintColor : state.ancestorTintColor), this);
|
|
1262
|
-
}
|
|
1263
|
-
}, this);
|
|
1264
|
-
|
|
1265
|
-
return this;
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
ViewStateManager.prototype._setAncestorTintColorRecursively = function(ancestorTintColor, nodeRef) {
|
|
1269
|
-
var state = this._getNodeState(nodeRef, ancestorTintColor != null);
|
|
1270
|
-
if (state != null && state.ancestorTintColor !== ancestorTintColor) {
|
|
1271
|
-
var previousEffectiveTintColor = effectiveTintColor(state);
|
|
1272
|
-
state.ancestorTintColor = ancestorTintColor;
|
|
1273
|
-
if (effectiveTintColor(state) !== previousEffectiveTintColor) {
|
|
1274
|
-
state.needsMaterialUpdate = true;
|
|
1275
|
-
}
|
|
1276
|
-
// If this node has its own tint color then this tint color is already propagated to its descendants and we
|
|
1277
|
-
// don't need to do anything. But if we remove tint color from this node then we need to propagate its
|
|
1278
|
-
// ancestor's tint color (or its absence) to this node's descendants.
|
|
1279
|
-
if (state.tintColor == null) {
|
|
1280
|
-
nodeRef.children.forEach(this._setAncestorTintColorRecursively.bind(this, ancestorTintColor), this);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
return this;
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
|
-
ViewStateManager.prototype._applyOpacityNodeState = function(nodeRefs, opacities) {
|
|
1288
|
-
nodeRefs.forEach(function(nodeRef, index) {
|
|
1289
|
-
var opacity = opacities[index];
|
|
1290
|
-
var state = this._getNodeState(nodeRef, opacity != null);
|
|
1291
|
-
if (state != null) {
|
|
1292
|
-
state.opacity = opacity;
|
|
1293
|
-
// We do not compare whether the effective (world) opacity has changed, as this is a relatively
|
|
1294
|
-
// expensive computation, and if the opacity is assigned, we expect it to be assigned a new value, so
|
|
1295
|
-
// the effective opacity has surely changed.
|
|
1296
|
-
state.needsMaterialUpdate = true;
|
|
1297
|
-
|
|
1298
|
-
nodeRef.children.forEach(this._setAncestorOverridesOpacityRecursively.bind(this, opacity != null), this);
|
|
1299
|
-
}
|
|
1300
|
-
}, this);
|
|
1301
|
-
|
|
1302
|
-
return this;
|
|
1303
|
-
};
|
|
1304
|
-
|
|
1305
|
-
ViewStateManager.prototype._setAncestorOverridesOpacityRecursively = function(ancestorOverridesOpacity, nodeRef) {
|
|
1306
|
-
var state = this._getNodeState(nodeRef, ancestorOverridesOpacity);
|
|
1307
|
-
if (state != null) {
|
|
1308
|
-
state.ancestorOverridesOpacity = ancestorOverridesOpacity;
|
|
1309
|
-
state.needsMaterialUpdate = true;
|
|
1310
|
-
|
|
1311
|
-
nodeRef.children.forEach(this._setAncestorOverridesOpacityRecursively.bind(this, state.opacity != null || ancestorOverridesOpacity), this);
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
return this;
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
|
-
ViewStateManager.prototype._computeWorldOpacity = function(nodeRef, state) {
|
|
1318
|
-
if (state == null) {
|
|
1319
|
-
state = this._getNodeState(nodeRef, false);
|
|
1320
|
-
}
|
|
1321
|
-
var localOpacity = state && state.opacity;
|
|
1322
|
-
if (localOpacity == null) {
|
|
1323
|
-
var userData = nodeRef.userData;
|
|
1324
|
-
localOpacity = userData && userData.opacity;
|
|
1325
|
-
if (localOpacity == null) {
|
|
1326
|
-
// Default opacity value is 1.
|
|
1327
|
-
localOpacity = 1;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
var parent = nodeRef.parent;
|
|
1331
|
-
if (parent == null) {
|
|
1332
|
-
return localOpacity;
|
|
1333
|
-
} else {
|
|
1334
|
-
return localOpacity * this._computeWorldOpacity(parent);
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
ViewStateManager.prototype._updateNodeStateMaterials = function() {
|
|
1339
|
-
var materialCache = this._materialCache;
|
|
1340
|
-
|
|
1341
|
-
// node highlighting and tinting may work and look differently in the default ViewStateManager.js as it uses
|
|
1342
|
-
// THREE.Object3D._vkUpdateMaterialColorAndOpacity() method to update the material color and opacity
|
|
1343
|
-
|
|
1344
|
-
const defaultHighlightingEmissive = { r: 0.0235, g: 0.0235, b: 0.0235 };
|
|
1345
|
-
const defaultHighlightingSpecular = { r: 0.0602, g: 0.0602, b: 0.0602 };
|
|
1346
|
-
var highlightColorABGR = this.getHighlightColor(true);
|
|
1347
|
-
var highlightColor = abgrToColor(highlightColorABGR);
|
|
1348
|
-
var highlightColorThreeJS = new THREE.Color(highlightColor.red / 255.0, highlightColor.green / 255.0, highlightColor.blue / 255.0);
|
|
1349
|
-
|
|
1350
|
-
this._nodeStates.forEach(function(state, nodeRef) {
|
|
1351
|
-
if (state.needsMaterialUpdate && nodeRef.material != null) {
|
|
1352
|
-
if (state.material == null) {
|
|
1353
|
-
state.material = materialCache.cloneMaterial(nodeRef.material);
|
|
1354
|
-
} else {
|
|
1355
|
-
// TODO(VSM): do we really need this? I added this in case if material.color was
|
|
1356
|
-
// modified in a previous iteration. When can it happen?
|
|
1357
|
-
state.material.color.copy(nodeRef.material.color);
|
|
1358
|
-
state.material.emissive?.copy(nodeRef.material.emissive);
|
|
1359
|
-
state.material.specular?.copy(nodeRef.material.specular);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
var material = state.material;
|
|
1363
|
-
var color;
|
|
1364
|
-
|
|
1365
|
-
var tintColor = effectiveTintColor(state);
|
|
1366
|
-
if (tintColor != null) {
|
|
1367
|
-
color = abgrToColor(tintColor);
|
|
1368
|
-
material.color.lerp(new THREE.Color(color.red / 255.0, color.green / 255.0, color.blue / 255.0), color.alpha);
|
|
1369
|
-
material.emissive?.copy(defaultHighlightingEmissive);
|
|
1370
|
-
material.specular?.copy(defaultHighlightingSpecular);
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
if (state.selected || state.ancestorSelected) {
|
|
1374
|
-
material.color.lerp(highlightColorThreeJS, highlightColor.alpha);
|
|
1375
|
-
// when highlightColor = 0: total transparent, so do not change original emissive and specular
|
|
1376
|
-
material.emissive?.copy(defaultHighlightingEmissive);
|
|
1377
|
-
material.specular?.copy(defaultHighlightingSpecular);
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
var worldOpacity = this._computeWorldOpacity(nodeRef, state);
|
|
1381
|
-
material.opacity = worldOpacity;
|
|
1382
|
-
material.transparent = worldOpacity < 1;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
state.needsMaterialUpdate = false;
|
|
1386
|
-
}, this);
|
|
1387
|
-
|
|
1388
|
-
return this;
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
ViewStateManager.prototype.applyNodeStates = function() {
|
|
1392
|
-
this._nodeStates.forEach(function(state, nodeRef) {
|
|
1393
|
-
if (state.material != null) {
|
|
1394
|
-
state.originalMaterial = nodeRef.material;
|
|
1395
|
-
nodeRef.material = state.material;
|
|
1396
|
-
}
|
|
1397
|
-
if (state.visible != null) {
|
|
1398
|
-
state.originalVisible = nodeRef.visible;
|
|
1399
|
-
nodeRef.visible = state.visible;
|
|
1400
|
-
}
|
|
1401
|
-
});
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
ViewStateManager.prototype.revertNodeStates = function() {
|
|
1405
|
-
this._nodeStates.forEach(function(state, nodeRef) {
|
|
1406
|
-
if (state.originalMaterial) {
|
|
1407
|
-
nodeRef.material = state.originalMaterial;
|
|
1408
|
-
state.originalMaterial = null;
|
|
1409
|
-
}
|
|
1410
|
-
if (state.originalVisible != null) {
|
|
1411
|
-
nodeRef.visible = state.originalVisible;
|
|
1412
|
-
state.originalVisible = null;
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
};
|
|
1416
|
-
|
|
1417
|
-
function nodeIsHighlighted(state) {
|
|
1418
|
-
return state != null && (state.selected || state.ancestorSelected);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
function effectiveVisibility(nodeRef, state) {
|
|
1422
|
-
var visible = state && state.visible;
|
|
1423
|
-
return visible != null ? visible : nodeRef.visible;
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
function effectiveTintColor(state) {
|
|
1427
|
-
return state.tintColor || state.ancestorTintColor;
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
MaterialCache = function() {
|
|
1431
|
-
};
|
|
1432
|
-
|
|
1433
|
-
MaterialCache.prototype.cloneMaterial = function(material, nodeState) {
|
|
1434
|
-
// TODO: a proper implementation required.
|
|
1435
|
-
return material.clone();
|
|
1436
|
-
};
|
|
1437
|
-
|
|
1438
|
-
MaterialCache.prototype.releaseMaterial = function(material) {
|
|
1439
|
-
// TODO: a proper implementation required.
|
|
1440
|
-
ThreeUtils.disposeMaterial(material);
|
|
1441
|
-
return this;
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
return ViewStateManager;
|
|
1445
|
-
});
|