@pirireis/webglobeplugins 0.6.26-a → 0.6.27-a

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": "@pirireis/webglobeplugins",
3
- "version": "0.6.26-a",
3
+ "version": "0.6.27-a",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -22,6 +22,8 @@ export class ContextTextWriter3 {
22
22
  opacity: 1.0,
23
23
  zMode: CSZMode.Z_GROUND_PERVERTEX,
24
24
  },
25
+ xOffset = 0,
26
+ yOffset = 0,
25
27
  doDraw = true,
26
28
  textAdaptor = null,
27
29
  coordinatesAdaptor = null,
@@ -29,8 +31,7 @@ export class ContextTextWriter3 {
29
31
  opacityAdaptor = null,
30
32
  angleAdaptor = null,
31
33
  angleOnSphere = false,
32
- xOffset = 0,
33
- yOffset = 0,
34
+ positionAdaptor = (item, i, container, properties) => "left",
34
35
  zoomLevelAdaptor = (zoomLevel) => (item) => {
35
36
  return {
36
37
  opacityMultiplier: 1,
@@ -49,7 +50,7 @@ export class ContextTextWriter3 {
49
50
  this.keyAdaptor = keyAdaptor;
50
51
 
51
52
  this.zoomLevelAdaptor = zoomLevelAdaptor;
52
-
53
+ this.positionAdaptor = positionAdaptor;
53
54
  this.opacityAdaptor = opacityAdaptor ? opacityAdaptor : () => 1;
54
55
  this.angleOnSphere = angleOnSphere;
55
56
  if (angleAdaptor) {
@@ -104,7 +105,7 @@ export class ContextTextWriter3 {
104
105
  const zoomLevel = globe.api_GetCurrentLODWithDecimal();
105
106
  const zoomAdaptor = this.zoomLevelAdaptor(zoomLevel);
106
107
  for (const [key, item] of itemMap) {
107
- const { lat, long, text, opacity = null, angle = null, payload } = item;
108
+ const { lat, long, text, opacity = null, angle = null, payload, position } = item;
108
109
  const { x, y } = globe.api_GetScreenPointFromGeo(
109
110
  {
110
111
  long: long,
@@ -116,7 +117,7 @@ export class ContextTextWriter3 {
116
117
  const { opacityMultiplier, sizeMultiplier } = zoomAdaptor(payload);
117
118
  const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
118
119
  textFont.size = sizeMultiplier * textSize;
119
-
120
+ textFont.position = position;
120
121
  if (x !== null && y !== null) globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffset, y: y - yOffset }, angleIsOn, angle);
121
122
  }
122
123
  textFont.size = textSize;
@@ -154,7 +155,8 @@ export class ContextTextWriter3 {
154
155
  };
155
156
  const opacity = this.opacityAdaptor(item, id, container, properties);
156
157
  const angle = this.angleAdaptor(item, id, container, properties);
157
- this.itemMap.set(key, { long: coords.long, lat: coords.lat, text, opacity, angle, payload: item });
158
+ const position = this.positionAdaptor(item, id, container, properties);
159
+ this.itemMap.set(key, { long: coords.long, lat: coords.lat, text, opacity, angle, payload: item, position });
158
160
  }
159
161
 
160
162
  clear() {