@sapui5/sap.ui.vbm 1.103.0 → 1.104.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ui.vbm",
3
- "version": "1.103.0",
3
+ "version": "1.104.0",
4
4
  "description": "SAPUI5 Library sap.ui.vbm",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -3,7 +3,7 @@
3
3
  <name>sap.ui.vbm</name>
4
4
  <vendor>SAP SE</vendor>
5
5
  <copyright>SAP UI development toolkit for HTML5 (SAPUI5) (c) Copyright 2009-2012 SAP AG. All rights reserved</copyright>
6
- <version>1.103.0</version>
6
+ <version>1.104.0</version>
7
7
 
8
8
  <documentation>SAP UI library: sap.ui.vbm</documentation>
9
9
 
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @param {string} [sId] id for the new control, generated automatically if no id is given
23
23
  * @param {object} [mSettings] initial settings for the new object
24
24
  * @author SAP SE
25
- * @version 1.103.0
25
+ * @version 1.104.0
26
26
  * @extends sap.ui.core.Element
27
27
  * @constructor
28
28
  * @public
@@ -14,6 +14,7 @@ sap.ui.define([
14
14
  "./adapter3d/VBIJSONParser",
15
15
  "./adapter3d/SceneBuilder",
16
16
  "./adapter3d/Utilities",
17
+ "./adapter3d/DragDropHandler",
17
18
  "sap/m/HBox",
18
19
  "sap/m/VBox",
19
20
  "sap/m/Link",
@@ -24,10 +25,13 @@ sap.ui.define([
24
25
  "sap/base/Log",
25
26
  "jquery.sap.global",
26
27
  "./library"
27
- ], function(Element, Observer, Menu, MenuItem, Popover, Viewport, ObjectFactory, Parser, SceneBuilder, Utilities, HBox, VBox, Link, Button, Text, Image, THREE, Log, jQuery, library) {
28
+ ], function(Element, Observer, Menu, MenuItem, Popover, Viewport, ObjectFactory, Parser, SceneBuilder, Utilities, DragDropHandler, HBox, VBox, Link, Button, Text, Image, THREE, Log, jQuery, library) {
28
29
  "use strict";
29
30
 
30
- var thisModule = "sap.ui.vbm.Adapter3D";
31
+ var Vector2 = THREE.Vector2;
32
+ var Vector3 = THREE.Vector3;
33
+ var toBoolean = Utilities.toBoolean;
34
+ var thisModule = "sap.ui.vbm.Adapter3D";
31
35
 
32
36
  // Forward declaration;
33
37
  var viewportEventDelegate;
@@ -41,7 +45,7 @@ sap.ui.define([
41
45
  * @param {string} [sId] id for the new control, generated automatically if no id is given
42
46
  * @param {object} [mSettings] initial settings for the new object
43
47
  * @author SAP SE
44
- * @version 1.103.0
48
+ * @version 1.104.0
45
49
  * @extends sap.ui.core.Element
46
50
  * @constructor
47
51
  * @public
@@ -99,6 +103,11 @@ sap.ui.define([
99
103
  // It is populated by VBIJSONParser and consumed by SceneBuilder.
100
104
  resources: new Map(),
101
105
 
106
+ // A map with config names as keys and config value as values.
107
+ // Both config keys & values are strings.
108
+ // It is populated by VBIJSONParser and consumed by all classes require access to config section.
109
+ config: new Map(),
110
+
102
111
  // An array of data types. See dataTypePrototype and dataTypeAttributePrototype in ObjectFactory.js.
103
112
  dataTypes: [],
104
113
 
@@ -182,7 +191,7 @@ sap.ui.define([
182
191
  }
183
192
  },
184
193
 
185
- // containes instructions how to setup view when most recent payload contains 3d scene with camera setup instructions
194
+ // contains instructions how to setup view when most recent payload contains 3d scene with camera setup instructions
186
195
  setupView: undefined
187
196
  };
188
197
 
@@ -217,10 +226,15 @@ sap.ui.define([
217
226
  pending: undefined // pending popover, if viewport has not been rendered yet
218
227
  };
219
228
 
229
+ // Ray caster used for detecting hover instance
220
230
  this._raycaster = new THREE.Raycaster();
231
+
232
+ // Drag and drop handler
233
+ this._dragDropHandler = null;
221
234
  };
222
235
 
223
236
  Adapter3D.prototype.exit = function() {
237
+
224
238
  if (this._clickTimerId) {
225
239
  clearTimeout(this._clickTimerId);
226
240
  this._clickTimerId = null;
@@ -236,6 +250,11 @@ sap.ui.define([
236
250
  this._viewportObserver.disconnect();
237
251
  this._viewportObserver = null;
238
252
 
253
+ if (this._dragDropHandler) {
254
+ this._dragDropHandler.destroy();
255
+ this._dragDropHandler = null;
256
+ }
257
+
239
258
  if (this._sceneBuilder) {
240
259
  this._sceneBuilder.destroy();
241
260
  this._sceneBuilder = null;
@@ -246,7 +265,10 @@ sap.ui.define([
246
265
  this._parser = null;
247
266
  }
248
267
 
268
+ this._detail = null;
249
269
  this._context = null;
270
+ this._raycaster = null;
271
+ this._hoverInstance = null;
250
272
 
251
273
  if (basePrototype.exit) {
252
274
  basePrototype.exit.call(this);
@@ -282,6 +304,7 @@ sap.ui.define([
282
304
  if (this._viewport) {
283
305
  this._viewportObserver.observe(this._viewport, { destroy: true });
284
306
  this._viewport.addEventDelegate(viewportEventDelegate, this);
307
+ this._dragDropHandler = new DragDropHandler(this);
285
308
  }
286
309
  };
287
310
 
@@ -291,6 +314,9 @@ sap.ui.define([
291
314
  */
292
315
  Adapter3D.prototype._disconnectViewport = function() {
293
316
  if (this._viewport) {
317
+ this._dragDropHandler.destroy();
318
+ this._dragDropHandler = null;
319
+
294
320
  this._viewport.removeEventDelegate(viewportEventDelegate);
295
321
  // onBeforeRendering unsubscribes from DOM events.
296
322
  viewportEventDelegate.onBeforeRendering.call(this);
@@ -380,15 +406,20 @@ sap.ui.define([
380
406
  }, that);
381
407
  }, that);
382
408
 
383
- // clear before next update
384
- that._context.voQueues.clear();
385
- that._context.sceneQueues.clear();
386
- that._context.windowQueues.clear();
409
+ // update drag and drop handler
410
+ if (that._dragDropHandler) {
411
+ that._dragDropHandler.update();
412
+ }
387
413
 
388
414
  // scene has changed -> adjust camera clipping planes
389
415
  that._viewport._resetBBox();
390
416
  that._viewport._updateCamera();
391
417
 
418
+ // clear before next update
419
+ that._context.voQueues.clear();
420
+ that._context.sceneQueues.clear();
421
+ that._context.windowQueues.clear();
422
+
392
423
  that._viewport.setBusy(false);
393
424
  });
394
425
  // return last promise in chain
@@ -473,7 +504,7 @@ sap.ui.define([
473
504
 
474
505
  Adapter3D.prototype._openDetailWindow = function(popover, definition) {
475
506
  var pos = definition.pos.split(";");
476
- var world = new THREE.Vector3(parseFloat(pos[0]), parseFloat(pos[1]), parseFloat(pos[2]));
507
+ var world = new Vector3(parseFloat(pos[0]), parseFloat(pos[1]), parseFloat(pos[2]));
477
508
 
478
509
  if (!this._viewport.getDomRef()) {
479
510
  if (this._detail.pending) {
@@ -949,7 +980,7 @@ sap.ui.define([
949
980
  var p = event.cursor || this._getXY(event);
950
981
 
951
982
  var rect = this._viewport.getDomRef().getBoundingClientRect();
952
- var normalizedXY = new THREE.Vector2(p.x / rect.width * 2 - 1, -p.y / rect.height * 2 + 1);
983
+ var normalizedXY = new Vector2(p.x / rect.width * 2 - 1, -p.y / rect.height * 2 + 1);
953
984
 
954
985
  this._raycaster.layers.set(0); // test objects from layer #0 only
955
986
  this._raycaster.setFromCamera(normalizedXY, camera);
@@ -1060,6 +1091,7 @@ sap.ui.define([
1060
1091
 
1061
1092
  onBeforeRendering: function(event) {
1062
1093
  if (this._onhoverProxy) {
1094
+ this._viewport.$().off("wheel", this._onhoverProxy);
1063
1095
  this._viewport.$().off(sap.ui.Device.browser.msie || sap.ui.Device.browser.edge ? "pointermove" : "mousemove", this._onhoverProxy);
1064
1096
  }
1065
1097
  if (this._onpointerdownProxy) {
@@ -1074,7 +1106,9 @@ sap.ui.define([
1074
1106
  if (!this._onhoverProxy) {
1075
1107
  this._onhoverProxy = viewportEventDelegate.onhover.bind(this);
1076
1108
  }
1109
+ this._viewport.$().on("wheel", this._onhoverProxy);
1077
1110
  this._viewport.$().on(sap.ui.Device.browser.msie || sap.ui.Device.browser.edge ? "pointermove" : "mousemove", this._onhoverProxy);
1111
+
1078
1112
  if (sap.ui.Device.browser.msie || sap.ui.Device.browser.edge) {
1079
1113
  if (!this._onpointerdownProxy) {
1080
1114
  this._onpointerdownProxy = viewportEventDelegate.onmousedown.bind(this);
@@ -1169,7 +1203,7 @@ sap.ui.define([
1169
1203
  var selected = [];
1170
1204
  var deselected = [];
1171
1205
  var group = instance.voGroup;
1172
- var wasSelected = Utilities.toBoolean(instance["VB:s"]);
1206
+ var wasSelected = toBoolean(instance["VB:s"]);
1173
1207
  var selectedIndex;
1174
1208
 
1175
1209
  if (action === "select") {
@@ -124,7 +124,7 @@ sap.ui.define([
124
124
  clusterVos: {
125
125
  type: "sap.ui.core.Control",
126
126
  multiple: true,
127
- visiblity: "hidden",
127
+ visibility: "hidden",
128
128
  singularName: "clusterVo"
129
129
  },
130
130
  /**
@@ -133,7 +133,7 @@ sap.ui.define([
133
133
  clusterContainers: {
134
134
  type: "sap.ui.vbm.ClusterContainer",
135
135
  multiple: true,
136
- visiblity: "hidden",
136
+ visibility: "hidden",
137
137
  singularName: "clusterContainer"
138
138
  }
139
139
 
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  *
24
24
  * @public
25
25
  * @author SAP SE
26
- * @version 1.103.0
26
+ * @version 1.104.0
27
27
  * @extends sap.ui.core.Control
28
28
  * @alias sap.ui.vbm.Viewport
29
29
  */
@@ -189,9 +189,14 @@ sap.ui.define([
189
189
  }
190
190
  this._stopRenderLoop();
191
191
 
192
+ this._cameraController.dispose();
193
+ this._cameraController = null;
194
+
195
+ this._renderer.dispose();
196
+ this._renderer = null;
197
+
192
198
  this._scene = null;
193
199
  this._camera = null;
194
- this._renderer = null;
195
200
 
196
201
  if (basePrototype.exit) {
197
202
  basePrototype.exit.call(this);
@@ -577,7 +582,7 @@ sap.ui.define([
577
582
  // when camera is almost on XZ plane, intersection point could be very far or very close
578
583
  // setting it straight as camera target makes navigation unusable, as either
579
584
  // small mouse movements results in huge move of camera in space (when intersection is far away)
580
- // or huge mouse movements result in bearly visible camera move in space (when intersection point is too close)
585
+ // or huge mouse movements result in barely visible camera move in space (when intersection point is too close)
581
586
  // so don't update camera target in those extreme cases
582
587
  if (THREE.Math.radToDeg(this._camera.position.clone().sub(target).angleTo(normal)) < CAMERA_TARGET_LIMIT) {
583
588
  this._cameraController.target.copy(target);