@sapui5/sap.ui.vbm 1.136.1 → 1.136.2
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/vbm/.library +1 -1
- package/src/sap/ui/vbm/Adapter.js +1 -1
- package/src/sap/ui/vbm/Adapter3D.js +195 -53
- package/src/sap/ui/vbm/AnalyticMap.js +9 -7
- package/src/sap/ui/vbm/ContainerBase.js +4 -4
- package/src/sap/ui/vbm/MapContainer.js +3 -2
- package/src/sap/ui/vbm/Viewport.js +1 -1
- package/src/sap/ui/vbm/VoBase.js +5 -4
- package/src/sap/ui/vbm/adapter3d/ColladaBounds.js +1 -1
- package/src/sap/ui/vbm/adapter3d/DragDropHandler.js +14 -2
- package/src/sap/ui/vbm/adapter3d/ModelHandler.js +1 -1
- package/src/sap/ui/vbm/adapter3d/ObjectFactory.js +1 -1
- package/src/sap/ui/vbm/adapter3d/PolygonHandler.js +1 -1
- package/src/sap/ui/vbm/adapter3d/RectangleTracker.js +199 -170
- package/src/sap/ui/vbm/adapter3d/SceneBuilder.js +1 -1
- package/src/sap/ui/vbm/adapter3d/VBIJSONParser.js +1 -1
- package/src/sap/ui/vbm/library.js +2 -2
- package/src/sap/ui/vbm/vector/MapRenderer.js +204 -30
- package/src/sap/ui/vbm/vector/PayloadGenerator.js +1 -1
- package/src/sap/ui/vbm/vector/RectangularSelection.js +1 -1
- package/src/sap/ui/vbm/vector/VBITransformer.js +64 -17
- package/src/sap/ui/vbm/vector/VectorUtils.js +124 -13
|
@@ -34,23 +34,32 @@ sap.ui.define([
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
// create a DOM element for the marker (parent div)
|
|
37
|
+
VectorUtils.createSpotElement = (marker, spotid) => {
|
|
39
38
|
const el = document.createElement('div');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var base64decoded = "data:image/png;base64," + marker.properties.base64;
|
|
39
|
+
const base64decoded = "data:image/png;base64," + (marker.properties.base64 || "");
|
|
40
|
+
el.id = '__mapmarker' + spotid++;
|
|
43
41
|
el.style.backgroundImage = `url(${base64decoded})`;
|
|
44
|
-
el.style.
|
|
45
|
-
el.style.
|
|
46
|
-
el.style.
|
|
47
|
-
|
|
42
|
+
el.style.backgroundSize = 'cover';
|
|
43
|
+
el.style.display = 'inline-block';
|
|
44
|
+
el.style.transform = 'translate(-50%, -100%)';
|
|
45
|
+
|
|
46
|
+
// load the image to get natural size
|
|
47
|
+
const img = new Image();
|
|
48
|
+
img.src = base64decoded;
|
|
49
|
+
img.onload = () => {
|
|
50
|
+
const scaleParts = (marker.properties.Scale || "1;1;1").split(';').map(Number);
|
|
51
|
+
const [sx, sy] = scaleParts.some(isNaN) ? [1, 1] : [scaleParts[0], scaleParts[1]];
|
|
52
|
+
el.style.width = `${img.naturalWidth * sx}px`;
|
|
53
|
+
el.style.height = `${img.naturalHeight * sy}px`;
|
|
54
|
+
};
|
|
55
|
+
return {spotEl:el, spotId:spotid};
|
|
48
56
|
};
|
|
57
|
+
|
|
49
58
|
VectorUtils.isAccepted = (drag, drop) => {
|
|
50
59
|
var validDrop = drag.some(item => drop.includes(item));
|
|
51
60
|
return validDrop;
|
|
52
61
|
};
|
|
53
|
-
VectorUtils.createIconElement = (Icon) => {
|
|
62
|
+
VectorUtils.createIconElement = (Icon, iconColor) => {
|
|
54
63
|
const child_el = document.createElement('div');
|
|
55
64
|
child_el.className = 'marker';
|
|
56
65
|
child_el.style.position = 'absolute'; // Position it absolutely inside the parent
|
|
@@ -59,15 +68,16 @@ sap.ui.define([
|
|
|
59
68
|
child_el.style.transform = 'translate(-50%, -50%)'; // Center the icon
|
|
60
69
|
child_el.style.fontFamily = 'SAP-icons';
|
|
61
70
|
child_el.style.fontSize = '20px'; // Adjust size as needed
|
|
71
|
+
child_el.style.color = iconColor;
|
|
62
72
|
var iconInfo = sap.ui.core.IconPool.getIconInfo(Icon);
|
|
63
73
|
child_el.innerHTML = iconInfo.content;
|
|
64
74
|
return child_el;
|
|
65
75
|
}
|
|
66
76
|
//Function to set the canvas id
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
VectorUtils._setcanvasid = () => {
|
|
78
|
+
var mapCanvas = '__mapcanvas';
|
|
69
79
|
return mapCanvas;
|
|
70
|
-
|
|
80
|
+
}
|
|
71
81
|
|
|
72
82
|
VectorUtils.createDropdownMenu = (menuData) => {
|
|
73
83
|
const dropdown = document.createElement('div');
|
|
@@ -231,6 +241,107 @@ sap.ui.define([
|
|
|
231
241
|
|
|
232
242
|
return windowContainer;
|
|
233
243
|
};
|
|
244
|
+
|
|
245
|
+
VectorUtils.createMarkerLabel = (label, labelcolor) => {
|
|
246
|
+
var r, g, b, a;
|
|
247
|
+
const obj = document.createElement('div');
|
|
248
|
+
obj.className = 'marker-label';
|
|
249
|
+
obj.textContent = label;
|
|
250
|
+
obj.style.color = labelcolor;
|
|
251
|
+
obj.style.position = 'absolute';
|
|
252
|
+
obj.style.top = '100%';
|
|
253
|
+
if (!labelcolor) {
|
|
254
|
+
[r, g, b, a] = [211, 211, 211, 1];
|
|
255
|
+
} else {
|
|
256
|
+
[r, g, b, a] = VectorUtils.parseRGBAString(labelcolor);
|
|
257
|
+
}
|
|
258
|
+
obj.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
259
|
+
obj.style.border = `2px solid rgba(${r}, ${g}, ${b}, ${a})`;
|
|
260
|
+
const textColor = VectorUtils.getContrastTextColor(r, g, b);
|
|
261
|
+
obj.style.color = textColor;
|
|
262
|
+
obj.style.fontFamily = 'Arial, sans-serif';
|
|
263
|
+
obj.style.fontSize = '14px';
|
|
264
|
+
obj.style.padding = '2px 6px';
|
|
265
|
+
obj.style.borderRadius = '4px';
|
|
266
|
+
obj.style.whiteSpace = 'pre-wrap';
|
|
267
|
+
obj.style.boxSizing = 'border-box';
|
|
268
|
+
obj.style.textAlign = 'center';
|
|
269
|
+
|
|
270
|
+
return obj;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
VectorUtils.createRouteLabel = (label, labelcolor) => {
|
|
274
|
+
let r, g, b, a;
|
|
275
|
+
const obj = document.createElement('div');
|
|
276
|
+
obj.className = 'route-label';
|
|
277
|
+
obj.textContent = label;
|
|
278
|
+
|
|
279
|
+
if (!labelcolor) {
|
|
280
|
+
[r, g, b, a] = [211, 211, 211, 1];
|
|
281
|
+
} else {
|
|
282
|
+
[r, g, b, a] = VectorUtils.parseRGBAString(labelcolor);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const textColor = VectorUtils.getContrastTextColor(r, g, b);
|
|
286
|
+
|
|
287
|
+
obj.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
288
|
+
obj.style.border = `2px solid rgba(${r}, ${g}, ${b}, ${a})`;
|
|
289
|
+
obj.style.color = textColor;
|
|
290
|
+
obj.style.fontFamily = 'Arial, sans-serif';
|
|
291
|
+
obj.style.fontSize = '14px';
|
|
292
|
+
obj.style.padding = '2px 6px';
|
|
293
|
+
obj.style.borderRadius = '4px';
|
|
294
|
+
obj.style.whiteSpace = 'pre-wrap';
|
|
295
|
+
obj.style.boxSizing = 'border-box';
|
|
296
|
+
obj.style.textAlign = 'center';
|
|
297
|
+
|
|
298
|
+
return obj;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
VectorUtils.rgbaToHexAndOpacity = (rgbaString) => {
|
|
302
|
+
const rgbaRegex = /rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d*\.?\d+)\s*\)/i;
|
|
303
|
+
const match = rgbaString.match(rgbaRegex);
|
|
304
|
+
|
|
305
|
+
if (!match) {
|
|
306
|
+
throw new Error("Invalid RGBA format");
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const r = parseInt(match[1], 10);
|
|
310
|
+
const g = parseInt(match[2], 10);
|
|
311
|
+
const b = parseInt(match[3], 10);
|
|
312
|
+
const a = parseFloat(match[4]);
|
|
313
|
+
|
|
314
|
+
const toHex = (value) => value.toString(16).padStart(2, '0');
|
|
315
|
+
|
|
316
|
+
const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
hexColor: hex,
|
|
320
|
+
opacity: a
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
VectorUtils.parseRGBAString = (rgbaStr) => {
|
|
326
|
+
const match = rgbaStr.match(/rgba?\s*\(\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)\s*\)/i);
|
|
327
|
+
|
|
328
|
+
if (!match) return null;
|
|
329
|
+
|
|
330
|
+
const r = parseInt(match[1]);
|
|
331
|
+
const g = parseInt(match[2]);
|
|
332
|
+
const b = parseInt(match[3]);
|
|
333
|
+
const a = parseInt(match[4]) / 255;
|
|
334
|
+
|
|
335
|
+
return [r, g, b, parseFloat(a.toFixed(3))];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
VectorUtils.getContrastTextColor = (r, g, b) => {
|
|
339
|
+
if (r === 0 && g === 0 && b === 0) {
|
|
340
|
+
return '#000000';
|
|
341
|
+
}
|
|
342
|
+
const brightness = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
343
|
+
return brightness < 128 ? '#FFFFFF' : '#000000';
|
|
344
|
+
}
|
|
234
345
|
VectorUtils.createSubCaption = (item) => {
|
|
235
346
|
const obj = document.createElement('div');
|
|
236
347
|
obj.setAttribute("role", sap.ui.core.AccessibleRole.Secondary);
|