@openglobus/og 0.12.4 → 0.13.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/README.md +0 -2
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/og/Extent.js +3 -3
- package/src/og/Globe.js +277 -275
- package/src/og/ImageCanvas.js +3 -3
- package/src/og/LonLat.js +9 -9
- package/src/og/QueueArray.js +2 -2
- package/src/og/Rectangle.js +5 -5
- package/src/og/bv/Box.js +1 -1
- package/src/og/bv/Sphere.js +2 -2
- package/src/og/camera/Camera.js +1 -1
- package/src/og/camera/PlanetCamera.js +649 -646
- package/src/og/control/LayerSwitcher.js +1 -1
- package/src/og/control/MouseNavigation.js +22 -13
- package/src/og/control/MouseWheelZoomControl.js +2 -2
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/TouchNavigation.js +319 -319
- package/src/og/control/ZoomControl.js +132 -132
- package/src/og/control/visibleExtent/Segment.js +12 -12
- package/src/og/ellipsoid/Ellipsoid.js +577 -567
- package/src/og/entity/BillboardHandler.js +878 -1051
- package/src/og/entity/Entity.js +1 -1
- package/src/og/entity/EntityCollection.js +847 -857
- package/src/og/entity/GeoObjectHandler.js +2 -2
- package/src/og/entity/LabelHandler.js +887 -1040
- package/src/og/entity/LabelWorker.js +0 -6
- package/src/og/entity/PointCloud.js +495 -495
- package/src/og/entity/Polyline.js +2218 -2222
- package/src/og/entity/RayHandler.js +1 -1
- package/src/og/layer/CanvasTiles.js +6 -3
- package/src/og/layer/GeoImage.js +1 -1
- package/src/og/layer/KML.js +5 -5
- package/src/og/layer/Layer.js +800 -752
- package/src/og/layer/Vector.js +997 -1010
- package/src/og/layer/XYZ.js +359 -357
- package/src/og/math/Line2.js +4 -4
- package/src/og/math/Quat.js +2 -2
- package/src/og/math/Ray.js +2 -2
- package/src/og/math/Vec2.js +524 -524
- package/src/og/math/Vec3.js +900 -900
- package/src/og/math/Vec4.js +261 -261
- package/src/og/math.js +397 -398
- package/src/og/quadTree/EntityCollectionNode.js +389 -387
- package/src/og/renderer/Renderer.js +14 -20
- package/src/og/renderer/RendererEvents.js +1034 -1045
- package/src/og/scene/Planet.js +12 -9
- package/src/og/scene/RenderNode.js +347 -354
- package/src/og/segment/Segment.js +3 -1
- package/src/og/segment/SegmentLonLat.js +1 -4
- package/src/og/shaders/billboard.js +220 -204
- package/src/og/shaders/drawnode.js +607 -603
- package/src/og/shaders/label.js +576 -456
- package/src/og/shaders/polyline.js +365 -361
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/FontAtlas.js +209 -200
- package/src/og/utils/GeoImageCreator.js +4 -5
- package/src/og/utils/TextureAtlas.js +4 -4
- package/src/og/utils/VectorTileCreator.js +414 -414
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Handler.js +28 -60
- package/src/og/webgl/Multisample.js +260 -260
- package/src/og/webgl/Program.js +411 -396
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +1 -1
- package/types/camera/PlanetCamera.d.ts +3 -3
- package/types/control/LayerSwitcher.d.ts +1 -1
- package/types/ellipsoid/Ellipsoid.d.ts +9 -2
- package/types/entity/BillboardHandler.d.ts +0 -4
- package/types/entity/EntityCollection.d.ts +0 -8
- package/types/entity/LabelHandler.d.ts +0 -2
- package/types/entity/Polyline.d.ts +1 -1
- package/types/layer/KML.d.ts +11 -11
- package/types/layer/Layer.d.ts +4 -0
- package/types/layer/Vector.d.ts +1 -8
- package/types/math/Line2.d.ts +4 -4
- package/types/math/Ray.d.ts +2 -2
- package/types/math/Vec2.d.ts +1 -1
- package/types/math/Vec3.d.ts +1 -1
- package/types/math/Vec4.d.ts +2 -2
- package/types/math.d.ts +1 -1
- package/types/renderer/Renderer.d.ts +1 -1
- package/types/renderer/RendererEvents.d.ts +1 -1
- package/types/shaders/label.d.ts +1 -1
- package/types/utils/FontAtlas.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +3 -3
- package/types/utils/VectorTileCreator.d.ts +4 -4
- package/types/utils/shared.d.ts +1 -1
- package/types/webgl/Handler.d.ts +6 -31
- package/types/webgl/Program.d.ts +2 -0
|
@@ -1,204 +1,213 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/utils/FontAtlas
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
import { Rectangle } from '../Rectangle.js';
|
|
8
|
-
import { TextureAtlas, TextureAtlasNode } from './TextureAtlas.js';
|
|
9
|
-
import { Deferred } from '../Deferred.js';
|
|
10
|
-
import { ARIAL_FONT_B64 } from '../res/images.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this._handler =
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
tc
|
|
70
|
-
|
|
71
|
-
tc[
|
|
72
|
-
tc[
|
|
73
|
-
|
|
74
|
-
tc[
|
|
75
|
-
tc[
|
|
76
|
-
|
|
77
|
-
tc[
|
|
78
|
-
tc[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
atlas.nodes[ti]
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module og/utils/FontAtlas
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
import { Rectangle } from '../Rectangle.js';
|
|
8
|
+
import { TextureAtlas, TextureAtlasNode } from './TextureAtlas.js';
|
|
9
|
+
import { Deferred } from '../Deferred.js';
|
|
10
|
+
import { ARIAL_FONT_B64 } from '../res/images.js';
|
|
11
|
+
|
|
12
|
+
//TODO: get the value from shader module
|
|
13
|
+
const MAX_SIZE = 11;
|
|
14
|
+
|
|
15
|
+
class FontAtlas {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.atlasesArr = [];
|
|
18
|
+
this.atlasIndexes = {};
|
|
19
|
+
this.atlasIndexesDeferred = [];
|
|
20
|
+
this.tokenImageSize = 64;
|
|
21
|
+
this.samplerArr = new Uint32Array(MAX_SIZE);
|
|
22
|
+
this.sdfParamsArr = new Float32Array(MAX_SIZE * 4);
|
|
23
|
+
this._handler = null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
assignHandler(handler) {
|
|
27
|
+
this._handler = handler;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getFontIndex(face) {
|
|
31
|
+
let fullName = this.getFullIndex(face);
|
|
32
|
+
if (!this.atlasIndexesDeferred[fullName]) {
|
|
33
|
+
this.atlasIndexesDeferred[fullName] = new Deferred();
|
|
34
|
+
}
|
|
35
|
+
return this.atlasIndexesDeferred[fullName].promise;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getFullIndex(face) {
|
|
39
|
+
return face.trim().toLowerCase();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_applyFontDataToAtlas(atlas, data, index = 0) {
|
|
43
|
+
let chars = data.chars;
|
|
44
|
+
|
|
45
|
+
atlas.height = data.common.scaleH;
|
|
46
|
+
atlas.width = data.common.scaleW;
|
|
47
|
+
atlas.gliphSize = data.info.size;
|
|
48
|
+
atlas.distanceRange = data.distanceField.distanceRange;
|
|
49
|
+
|
|
50
|
+
let w = atlas.width,
|
|
51
|
+
h = atlas.height,
|
|
52
|
+
s = atlas.gliphSize;
|
|
53
|
+
|
|
54
|
+
this.sdfParamsArr[index * 4] = w;
|
|
55
|
+
this.sdfParamsArr[index * 4 + 1] = h;
|
|
56
|
+
this.sdfParamsArr[index * 4 + 2] = s;
|
|
57
|
+
this.sdfParamsArr[index * 4 + 3] = atlas.distanceRange;
|
|
58
|
+
|
|
59
|
+
let idToChar = {};
|
|
60
|
+
|
|
61
|
+
for (let i = 0; i < chars.length; i++) {
|
|
62
|
+
let ci = chars[i];
|
|
63
|
+
let ti = ci.char;
|
|
64
|
+
|
|
65
|
+
idToChar[ci.id] = ti;
|
|
66
|
+
|
|
67
|
+
let r = new Rectangle(ci.x, ci.y, ci.x + ci.width, ci.y + ci.height);
|
|
68
|
+
|
|
69
|
+
let tc = new Array(12);
|
|
70
|
+
|
|
71
|
+
tc[0] = r.left / w;
|
|
72
|
+
tc[1] = r.top / h;
|
|
73
|
+
|
|
74
|
+
tc[2] = r.left / w;
|
|
75
|
+
tc[3] = r.bottom / h;
|
|
76
|
+
|
|
77
|
+
tc[4] = r.right / w;
|
|
78
|
+
tc[5] = r.bottom / h;
|
|
79
|
+
|
|
80
|
+
tc[6] = r.right / w;
|
|
81
|
+
tc[7] = r.bottom / h;
|
|
82
|
+
|
|
83
|
+
tc[8] = r.right / w;
|
|
84
|
+
tc[9] = r.top / h;
|
|
85
|
+
|
|
86
|
+
tc[10] = r.left / w;
|
|
87
|
+
tc[11] = r.top / h;
|
|
88
|
+
|
|
89
|
+
atlas.nodes[ti] = new TextureAtlasNode(r, tc);
|
|
90
|
+
atlas.nodes[ti].metrics = ci;
|
|
91
|
+
|
|
92
|
+
atlas.nodes[ti].metrics.nWidth = atlas.nodes[ti].metrics.width / s;
|
|
93
|
+
atlas.nodes[ti].metrics.nHeight = atlas.nodes[ti].metrics.height / s;
|
|
94
|
+
atlas.nodes[ti].metrics.nAdvance = atlas.nodes[ti].metrics.xadvance / s;
|
|
95
|
+
atlas.nodes[ti].metrics.nXOffset = atlas.nodes[ti].metrics.xoffset / s;
|
|
96
|
+
atlas.nodes[ti].metrics.nYOffset = 1.0 - atlas.nodes[ti].metrics.yoffset / s;
|
|
97
|
+
|
|
98
|
+
atlas.nodes[ti].emptySize = 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
atlas.kernings = {};
|
|
102
|
+
|
|
103
|
+
for (let i = 0; i < data.kernings.length; i++) {
|
|
104
|
+
let ki = data.kernings[i];
|
|
105
|
+
|
|
106
|
+
let first = ki.first,
|
|
107
|
+
second = ki.second;
|
|
108
|
+
|
|
109
|
+
let charFirst = idToChar[first],
|
|
110
|
+
charSecond = idToChar[second];
|
|
111
|
+
|
|
112
|
+
if (!atlas.kernings[charFirst]) {
|
|
113
|
+
atlas.kernings[charFirst] = {};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
atlas.kernings[charFirst][charSecond] = ki.amount / s;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
initFont(faceName, dataJson, imageBase64) {
|
|
121
|
+
let index = this.atlasesArr.length;
|
|
122
|
+
let fullName = this.getFullIndex(faceName);
|
|
123
|
+
|
|
124
|
+
this.atlasIndexes[fullName] = index;
|
|
125
|
+
|
|
126
|
+
let def = this.atlasIndexesDeferred[fullName];
|
|
127
|
+
if (!def) {
|
|
128
|
+
def = this.atlasIndexesDeferred[fullName] = new Deferred();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.samplerArr[this.atlasesArr.length] = index;
|
|
132
|
+
|
|
133
|
+
// TODO: FontTextureAtlas();
|
|
134
|
+
let atlas = new TextureAtlas();
|
|
135
|
+
|
|
136
|
+
atlas.height = 0;
|
|
137
|
+
atlas.width = 0;
|
|
138
|
+
atlas.gliphSize = 0;
|
|
139
|
+
atlas.distanceRange = 0;
|
|
140
|
+
atlas.kernings = {};
|
|
141
|
+
|
|
142
|
+
atlas.assignHandler(this._handler);
|
|
143
|
+
|
|
144
|
+
this.atlasesArr[index] = atlas;
|
|
145
|
+
|
|
146
|
+
this._applyFontDataToAtlas(atlas, dataJson, index);
|
|
147
|
+
|
|
148
|
+
let img = new Image();
|
|
149
|
+
img.onload = () => {
|
|
150
|
+
this._createTexture(atlas, img);
|
|
151
|
+
def.resolve(index);
|
|
152
|
+
};
|
|
153
|
+
img.src = ARIAL_FONT_B64;
|
|
145
154
|
}
|
|
146
155
|
|
|
147
156
|
_createTexture(atlas, img) {
|
|
148
|
-
atlas.createTexture(img);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
loadFont(faceName, srcDir, atlasUrl) {
|
|
152
|
-
|
|
153
|
-
let index = this.atlasesArr.length;
|
|
154
|
-
let fullName = this.getFullIndex(faceName);
|
|
155
|
-
|
|
156
|
-
this.atlasIndexes[fullName] = index;
|
|
157
|
-
|
|
158
|
-
let def = this.atlasIndexesDeferred[fullName];
|
|
159
|
-
if (!def) {
|
|
160
|
-
def = this.atlasIndexesDeferred[fullName] = new Deferred();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.samplerArr[this.atlasesArr.length] = index;
|
|
164
|
-
|
|
165
|
-
// TODO: FontTextureAtlas();
|
|
166
|
-
let atlas = new TextureAtlas();
|
|
167
|
-
|
|
168
|
-
atlas.height = 0;
|
|
169
|
-
atlas.width = 0;
|
|
170
|
-
atlas.gliphSize = 0;
|
|
171
|
-
atlas.distanceRange = 0;
|
|
172
|
-
atlas.kernings = {};
|
|
173
|
-
|
|
174
|
-
atlas.assignHandler(this._handler);
|
|
175
|
-
this.atlasesArr[index] = atlas;
|
|
176
|
-
|
|
177
|
-
fetch(`${srcDir}/${atlasUrl}`)
|
|
178
|
-
.then(response => {
|
|
179
|
-
if (!response.ok) {
|
|
180
|
-
throw Error(`Unable to load "${srcDir}/${atlasUrl}"`);
|
|
181
|
-
}
|
|
182
|
-
return response.json(response);
|
|
183
|
-
})
|
|
184
|
-
.then(data => {
|
|
185
|
-
|
|
186
|
-
this._applyFontDataToAtlas(atlas, data);
|
|
187
|
-
|
|
188
|
-
let img = new Image();
|
|
189
|
-
img.onload = () => {
|
|
190
|
-
this._createTexture(atlas, img);
|
|
191
|
-
def.resolve(index);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
img.src = `${srcDir}/${data.pages[0]}`;
|
|
195
|
-
img.crossOrigin = "Anonymous";
|
|
196
|
-
})
|
|
197
|
-
.catch(err => {
|
|
198
|
-
def.reject();
|
|
199
|
-
return { 'status': "error", 'msg': err.toString() };
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
157
|
+
atlas.createTexture(img);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
loadFont(faceName, srcDir, atlasUrl) {
|
|
161
|
+
|
|
162
|
+
let index = this.atlasesArr.length;
|
|
163
|
+
let fullName = this.getFullIndex(faceName);
|
|
164
|
+
|
|
165
|
+
this.atlasIndexes[fullName] = index;
|
|
166
|
+
|
|
167
|
+
let def = this.atlasIndexesDeferred[fullName];
|
|
168
|
+
if (!def) {
|
|
169
|
+
def = this.atlasIndexesDeferred[fullName] = new Deferred();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
this.samplerArr[this.atlasesArr.length] = index;
|
|
173
|
+
|
|
174
|
+
// TODO: FontTextureAtlas();
|
|
175
|
+
let atlas = new TextureAtlas();
|
|
176
|
+
|
|
177
|
+
atlas.height = 0;
|
|
178
|
+
atlas.width = 0;
|
|
179
|
+
atlas.gliphSize = 0;
|
|
180
|
+
atlas.distanceRange = 0;
|
|
181
|
+
atlas.kernings = {};
|
|
182
|
+
|
|
183
|
+
atlas.assignHandler(this._handler);
|
|
184
|
+
this.atlasesArr[index] = atlas;
|
|
185
|
+
|
|
186
|
+
fetch(`${srcDir}/${atlasUrl}`)
|
|
187
|
+
.then(response => {
|
|
188
|
+
if (!response.ok) {
|
|
189
|
+
throw Error(`Unable to load "${srcDir}/${atlasUrl}"`);
|
|
190
|
+
}
|
|
191
|
+
return response.json(response);
|
|
192
|
+
})
|
|
193
|
+
.then(data => {
|
|
194
|
+
|
|
195
|
+
this._applyFontDataToAtlas(atlas, data, index);
|
|
196
|
+
|
|
197
|
+
let img = new Image();
|
|
198
|
+
img.onload = () => {
|
|
199
|
+
this._createTexture(atlas, img);
|
|
200
|
+
def.resolve(index);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
img.src = `${srcDir}/${data.pages[0]}`;
|
|
204
|
+
img.crossOrigin = "Anonymous";
|
|
205
|
+
})
|
|
206
|
+
.catch(err => {
|
|
207
|
+
def.reject();
|
|
208
|
+
return { 'status': "error", 'msg': err.toString() };
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
204
213
|
export { FontAtlas };
|
|
@@ -136,8 +136,8 @@ export class GeoImageCreator {
|
|
|
136
136
|
extentParams: { type: types.VEC4 }
|
|
137
137
|
},
|
|
138
138
|
attributes: {
|
|
139
|
-
corners:
|
|
140
|
-
texCoords:
|
|
139
|
+
corners: "vec2",
|
|
140
|
+
texCoords: "vec2"
|
|
141
141
|
},
|
|
142
142
|
vertexShader: `attribute vec2 corners;
|
|
143
143
|
attribute vec2 texCoords;
|
|
@@ -153,12 +153,11 @@ export class GeoImageCreator {
|
|
|
153
153
|
varying vec2 v_texCoords;
|
|
154
154
|
void main () {
|
|
155
155
|
if(v_texCoords.x <= 0.001 || v_texCoords.x >= 0.999 ||
|
|
156
|
-
v_texCoords.y <= 0.001 || v_texCoords.y >= 0.999) {
|
|
157
|
-
discard;
|
|
156
|
+
v_texCoords.y <= 0.001 || v_texCoords.y >= 0.999) {
|
|
157
|
+
discard;
|
|
158
158
|
}
|
|
159
159
|
gl_FragColor = texture2D(sourceTexture, v_texCoords);
|
|
160
160
|
}`
|
|
161
161
|
}));
|
|
162
162
|
}
|
|
163
|
-
|
|
164
163
|
}
|
|
@@ -12,7 +12,7 @@ import { ImagesCacheManager } from "./ImagesCacheManager.js";
|
|
|
12
12
|
* @param {number} [height] - Texture atlas height, if it hasn't 1024 default..
|
|
13
13
|
*/
|
|
14
14
|
class TextureAtlas {
|
|
15
|
-
constructor(width, height) {
|
|
15
|
+
constructor(width = 1024, height = 1024) {
|
|
16
16
|
/**
|
|
17
17
|
* Atlas nodes where input images store. It can be access by image.__nodeIndex.
|
|
18
18
|
* @public
|
|
@@ -31,7 +31,7 @@ class TextureAtlas {
|
|
|
31
31
|
* @public
|
|
32
32
|
* @type {canvas}
|
|
33
33
|
*/
|
|
34
|
-
this.canvas = new ImageCanvas(width
|
|
34
|
+
this.canvas = new ImageCanvas(width, height);
|
|
35
35
|
this.clearCanvas();
|
|
36
36
|
|
|
37
37
|
this._handler = null;
|
|
@@ -220,11 +220,11 @@ class TextureAtlas {
|
|
|
220
220
|
* @param {Rectangle} rect - Node image rectangle.
|
|
221
221
|
*/
|
|
222
222
|
class TextureAtlasNode {
|
|
223
|
-
constructor(rect, texCoords) {
|
|
223
|
+
constructor(rect, texCoords = []) {
|
|
224
224
|
this.childNodes = null;
|
|
225
225
|
this.image = null;
|
|
226
226
|
this.rect = rect;
|
|
227
|
-
this.texCoords = texCoords
|
|
227
|
+
this.texCoords = texCoords;
|
|
228
228
|
this.atlas = null;
|
|
229
229
|
}
|
|
230
230
|
|