@openglobus/og 0.13.4 → 0.13.5

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": "@openglobus/og",
3
- "version": "0.13.4",
3
+ "version": "0.13.5",
4
4
  "description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"
@@ -1,165 +1,165 @@
1
- /**
2
- * @module og/entity/Billboard
3
- */
4
-
5
- "use strict";
6
-
7
- import { BaseBillboard } from "./BaseBillboard.js";
8
-
9
- /**
10
- * Represents basic quad billboard image.
11
- * @class
12
- * @extends {BaseBillboard}
13
- * @param {Object} [options] - Options:
14
- * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
- * @param {number} [options.rotation] - Screen angle rotaion.
16
- * @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
17
- * @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
- * @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
19
- * @param {boolean} [options.visibility] - Visibility.
20
- * @param {string} [options.src] - Billboard image url source.
21
- * @param {Image} [options.image] - Billboard image object.
22
- * @param {number} [options.width] - Screen width.
23
- * @param {number} [options.height] - Screen height.
24
- * @param {number} [options.scale] - Billboard scale.
25
- */
26
- class Billboard extends BaseBillboard {
27
- constructor(options) {
28
- super(options);
29
-
30
- options = options || {};
31
-
32
- /**
33
- * Image src.
34
- * @protected
35
- * @type {string}
36
- */
37
- this._src = options.src || null;
38
-
39
- /**
40
- * Image object.
41
- * @protected
42
- * @type {Object}
43
- */
44
- this._image = options.image || null;
45
-
46
- this._scale = 1.0;
47
-
48
- /**
49
- * Billboard screen width.
50
- * @protected
51
- * @type {number}
52
- */
53
- this._width = options.width || (options.size ? options.size[0] : 30);
54
-
55
- /**
56
- * Billboard screen height.
57
- * @protected
58
- * @type {number}
59
- */
60
- this._height = options.height || (options.size ? options.size[1] : 30);
61
- }
62
-
63
- /**
64
- * Sets billboard image url source.
65
- * @public
66
- * @param {string} src - Image url.
67
- */
68
- setSrc(src) {
69
- this._src = src;
70
- var bh = this._handler;
71
- if (bh && src) {
72
- var rn = bh._entityCollection.renderNode;
73
- if (rn) {
74
- var ta = rn.renderer.billboardsTextureAtlas;
75
- var that = this;
76
- ta.loadImage(src, function (img) {
77
- if (ta.nodes[img.__nodeIndex]) {
78
- that._image = img;
79
- bh.setTexCoordArr(
80
- that._handlerIndex,
81
- ta.nodes[that._image.__nodeIndex].texCoords
82
- );
83
- } else {
84
- ta.addImage(img);
85
- ta.createTexture();
86
- that._image = img;
87
- rn.updateBillboardsTexCoords();
88
- }
89
- });
90
- }
91
- }
92
- }
93
-
94
- /**
95
- * Sets image object.
96
- * @public
97
- * @param {Object} image - JavaScript image object.
98
- */
99
- setImage(image) {
100
- this.setSrc(image.src);
101
- }
102
-
103
- /**
104
- * Sets billboard screen size in pixels.
105
- * @public
106
- * @param {number} width - Billboard width.
107
- * @param {number} height - Billboard height.
108
- */
109
- setSize(width, height) {
110
- this._width = width;
111
- this._height = height;
112
- this._handler &&
113
- this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
114
- }
115
-
116
- /**
117
- * Returns billboard screen size.
118
- * @public
119
- * @returns {Object}
120
- */
121
- getSize() {
122
- return {
123
- width: this._width,
124
- height: this._height
125
- };
126
- }
127
-
128
- /**
129
- * Sets billboard screen width.
130
- * @public
131
- * @param {number} width - Width.
132
- */
133
- setWidth(width) {
134
- this.setSize(width, this._height);
135
- }
136
-
137
- /**
138
- * Gets billboard screen width.
139
- * @public
140
- * @returns {number}
141
- */
142
- getWidth() {
143
- return this._width;
144
- }
145
-
146
- /**
147
- * Sets billboard screen heigh.
148
- * @public
149
- * @param {number} height - Height.
150
- */
151
- setHeight(height) {
152
- this.setSize(this._width, height);
153
- }
154
-
155
- /**
156
- * Gets billboard screen height.
157
- * @public
158
- * @returns {number}
159
- */
160
- getHeight() {
161
- return this._height;
162
- }
163
- }
164
-
165
- export { Billboard };
1
+ /**
2
+ * @module og/entity/Billboard
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { BaseBillboard } from "./BaseBillboard.js";
8
+
9
+ /**
10
+ * Represents basic quad billboard image.
11
+ * @class
12
+ * @extends {BaseBillboard}
13
+ * @param {Object} [options] - Options:
14
+ * @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
15
+ * @param {number} [options.rotation] - Screen angle rotaion.
16
+ * @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
17
+ * @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
18
+ * @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
19
+ * @param {boolean} [options.visibility] - Visibility.
20
+ * @param {string} [options.src] - Billboard image url source.
21
+ * @param {Image} [options.image] - Billboard image object.
22
+ * @param {number} [options.width] - Screen width.
23
+ * @param {number} [options.height] - Screen height.
24
+ * @param {number} [options.scale] - Billboard scale.
25
+ */
26
+ class Billboard extends BaseBillboard {
27
+ constructor(options) {
28
+ super(options);
29
+
30
+ options = options || {};
31
+
32
+ /**
33
+ * Image src.
34
+ * @protected
35
+ * @type {string}
36
+ */
37
+ this._src = options.src || null;
38
+
39
+ /**
40
+ * Image object.
41
+ * @protected
42
+ * @type {Object}
43
+ */
44
+ this._image = options.image || null;
45
+
46
+ this._scale = 1.0;
47
+
48
+ /**
49
+ * Billboard screen width.
50
+ * @protected
51
+ * @type {number}
52
+ */
53
+ this._width = options.width || (options.size ? options.size[0] : 30);
54
+
55
+ /**
56
+ * Billboard screen height.
57
+ * @protected
58
+ * @type {number}
59
+ */
60
+ this._height = options.height || (options.size ? options.size[1] : 30);
61
+ }
62
+
63
+ /**
64
+ * Sets billboard image url source.
65
+ * @public
66
+ * @param {string} src - Image url.
67
+ */
68
+ setSrc(src) {
69
+ this._src = src;
70
+ var bh = this._handler;
71
+ if (bh && src) {
72
+ var rn = bh._entityCollection.renderNode;
73
+ if (rn) {
74
+ var ta = rn.renderer.billboardsTextureAtlas;
75
+ var that = this;
76
+ ta.loadImage(src, function (img) {
77
+ if (ta.get(img.__nodeIndex)) {
78
+ that._image = img;
79
+ bh.setTexCoordArr(
80
+ that._handlerIndex,
81
+ ta.get(that._image.__nodeIndex).texCoords
82
+ );
83
+ } else {
84
+ ta.addImage(img);
85
+ ta.createTexture();
86
+ that._image = img;
87
+ rn.updateBillboardsTexCoords();
88
+ }
89
+ });
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Sets image object.
96
+ * @public
97
+ * @param {Object} image - JavaScript image object.
98
+ */
99
+ setImage(image) {
100
+ this.setSrc(image.src);
101
+ }
102
+
103
+ /**
104
+ * Sets billboard screen size in pixels.
105
+ * @public
106
+ * @param {number} width - Billboard width.
107
+ * @param {number} height - Billboard height.
108
+ */
109
+ setSize(width, height) {
110
+ this._width = width;
111
+ this._height = height;
112
+ this._handler &&
113
+ this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
114
+ }
115
+
116
+ /**
117
+ * Returns billboard screen size.
118
+ * @public
119
+ * @returns {Object}
120
+ */
121
+ getSize() {
122
+ return {
123
+ width: this._width,
124
+ height: this._height
125
+ };
126
+ }
127
+
128
+ /**
129
+ * Sets billboard screen width.
130
+ * @public
131
+ * @param {number} width - Width.
132
+ */
133
+ setWidth(width) {
134
+ this.setSize(width, this._height);
135
+ }
136
+
137
+ /**
138
+ * Gets billboard screen width.
139
+ * @public
140
+ * @returns {number}
141
+ */
142
+ getWidth() {
143
+ return this._width;
144
+ }
145
+
146
+ /**
147
+ * Sets billboard screen heigh.
148
+ * @public
149
+ * @param {number} height - Height.
150
+ */
151
+ setHeight(height) {
152
+ this.setSize(this._width, height);
153
+ }
154
+
155
+ /**
156
+ * Gets billboard screen height.
157
+ * @public
158
+ * @returns {number}
159
+ */
160
+ getHeight() {
161
+ return this._height;
162
+ }
163
+ }
164
+
165
+ export { Billboard };
@@ -866,7 +866,7 @@ class BillboardHandler {
866
866
  var bi = this._billboards[i];
867
867
  var img = bi._image;
868
868
  if (img) {
869
- var imageNode = ta.nodes[bi._image.__nodeIndex];
869
+ var imageNode = ta.get(bi._image.__nodeIndex);
870
870
  if (imageNode) {
871
871
  this.setTexCoordArr(bi._handlerIndex, imageNode.texCoords);
872
872
  }