geojs 1.10.2 → 1.10.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": "geojs",
3
- "version": "1.10.2",
3
+ "version": "1.10.5",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -141,6 +141,9 @@ var annotation = function (type, args) {
141
141
  * Clean up any resources that the annotation is using.
142
142
  */
143
143
  this._exit = function () {
144
+ if (m_this.layer()) {
145
+ m_this.layer().geoOff(geo_event.mousemove, m_this._cursorHandleMousemove);
146
+ }
144
147
  };
145
148
 
146
149
  /**
@@ -754,6 +757,9 @@ var annotation = function (type, args) {
754
757
  */
755
758
  this.coordinates = function (gcs) {
756
759
  var coord = m_this._coordinates() || [];
760
+ if (!coord.length && (!coord.outer || !coord.outer.length)) {
761
+ coord = [];
762
+ }
757
763
  if (m_this.layer()) {
758
764
  var map = m_this.layer().map();
759
765
  gcs = (gcs === null ? map.gcs() : (
@@ -134,7 +134,7 @@ var polygonAnnotation = function (args) {
134
134
  (coord.inner || []).forEach((h) => result[0].push(h.map((pt) => [pt.x, pt.y])));
135
135
  return result;
136
136
  }
137
- if (coord.length < 3) {
137
+ if (coord.length < 3 || !coord.map) {
138
138
  return [];
139
139
  }
140
140
  return [[coord.map((pt) => [pt.x, pt.y])]];
@@ -69,7 +69,9 @@ var canvas_tileLayer = function () {
69
69
  */
70
70
  this._update = function (request) {
71
71
  s_update.call(m_this, request);
72
- m_quadFeature.nearestPixel(m_this.nearestPixel());
72
+ if (m_quadFeature && m_quadFeature.nearestPixel) {
73
+ m_quadFeature.nearestPixel(m_this.nearestPixel());
74
+ }
73
75
  m_this._addBaseQuadToTiles(m_quadFeature, m_tiles);
74
76
  return m_this;
75
77
  };
package/src/object.js CHANGED
@@ -273,6 +273,15 @@ var object = function () {
273
273
  return m_this;
274
274
  };
275
275
 
276
+ /**
277
+ * Report the current event handlers.
278
+ *
279
+ * @returns {object} An object with all of the event handlers.
280
+ */
281
+ this._eventHandlers = function () {
282
+ return m_eventHandlers;
283
+ };
284
+
276
285
  /**
277
286
  * Free all resources and destroy the object.
278
287
  */
@@ -184,7 +184,9 @@ var webgl_pixelmapFeature = function (arg) {
184
184
 
185
185
  if (arg.quadFeature) {
186
186
  m_quadFeature = arg.quadFeature;
187
- m_quadFeature.nearestPixel(true);
187
+ if (m_quadFeature.nearestPixel) {
188
+ m_quadFeature.nearestPixel(true);
189
+ }
188
190
  }
189
191
  this._init(arg);
190
192
  return this;
@@ -373,7 +373,19 @@ var webgl_quadFeature = function (arg) {
373
373
  }
374
374
  m_quads.imgQuads.forEach((quad) => {
375
375
  if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel) {
376
+ /* This could just be
377
+ * quad.texture.setNearestPixel(nearestPixel);
378
+ * but that needlessly redecodes the image. Instead, just change the
379
+ * the interpolation flags, then change the nearestPixel value
380
+ * without triggering a complete re-setup. */
381
+ renderState.m_context.bindTexture(vgl.GL.TEXTURE_2D, quad.texture.textureHandle());
382
+ renderState.m_context.texParameteri(vgl.GL.TEXTURE_2D, vgl.GL.TEXTURE_MIN_FILTER, nearestPixel ? vgl.GL.NEAREST : vgl.GL.LINEAR);
383
+ renderState.m_context.texParameteri(vgl.GL.TEXTURE_2D, vgl.GL.TEXTURE_MAG_FILTER, nearestPixel ? vgl.GL.NEAREST : vgl.GL.LINEAR);
384
+ renderState.m_context.bindTexture(vgl.GL.TEXTURE_2D, null);
385
+ const oldmod = quad.texture.modified;
386
+ quad.texture.modified = () => {};
376
387
  quad.texture.setNearestPixel(nearestPixel);
388
+ quad.texture.modified = oldmod;
377
389
  }
378
390
  });
379
391
  }
@@ -171,7 +171,9 @@ var webgl_tileLayer = function () {
171
171
  */
172
172
  this._update = function (request) {
173
173
  s_update.call(m_this, request);
174
- m_quadFeature.nearestPixel(m_this.nearestPixel());
174
+ if (m_quadFeature && m_quadFeature.nearestPixel) {
175
+ m_quadFeature.nearestPixel(m_this.nearestPixel());
176
+ }
175
177
  m_this._addBaseQuadToTiles(m_quadFeature, m_tiles);
176
178
  return m_this;
177
179
  };