@geoblocks/cesium-iso 0.1.1 → 0.2.0

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 CHANGED
@@ -36,6 +36,8 @@ iso.turnTo(200); // to a heading, in degrees, the shorter way
36
36
  iso.zoom(0.8); // in, toward the middle of the screen
37
37
  iso.glideTo(position);
38
38
  iso.target = position; // at once
39
+ iso.heading = 90; // at once, in degrees, no easing
40
+ iso.size = 300; // at once, in meters across the screen's shorter side, within minSize and maxSize
39
41
  ```
40
42
 
41
43
  ## Options
package/cesium-iso.js CHANGED
@@ -185,6 +185,30 @@ export default class CesiumIso {
185
185
  return CesiumMath.toDegrees(this.heading_);
186
186
  }
187
187
 
188
+ /**
189
+ * The heading set, in degrees: the view turned there at once, with no easing (turnTo eases); an animation under way,
190
+ * a drift or a turn, is dropped. While active.
191
+ * @param {number} heading
192
+ */
193
+ set heading(heading) {
194
+ this.turning_ = this.drift_ = this.drifted_ = undefined;
195
+ this.heading_ = CesiumMath.toRadians(heading);
196
+ this.place_();
197
+ }
198
+
199
+ /**
200
+ * The view's size, in meters across the screen's shorter side; set, within its bounds, the view zooms at once about
201
+ * its target (zoom zooms about a point of the screen).
202
+ */
203
+ get size() {
204
+ return this.size_;
205
+ }
206
+
207
+ set size(size) {
208
+ this.size_ = CesiumMath.clamp(size, this.minSize_, this.maxSize_);
209
+ this.place_();
210
+ }
211
+
188
212
  /**
189
213
  * A turn, eased, to a heading, in degrees, the shorter way round: the view toward a side a place is seen from.
190
214
  * @param {number} heading
@@ -261,7 +285,10 @@ export default class CesiumIso {
261
285
  Cartesian3.clone(up, camera.up);
262
286
  Cartesian3.cross(direction, up, camera.right);
263
287
  // the orthographic frustum's width
264
- Object.assign(camera.frustum, {width: this.width_()});
288
+ // the orthographic frustum's width; a subclass placing the camera on a perspective frustum has none to set
289
+ if ('width' in camera.frustum) {
290
+ camera.frustum.width = this.width_();
291
+ }
265
292
  this.viewer.scene.requestRender();
266
293
  }
267
294
 
@@ -444,6 +471,10 @@ export default class CesiumIso {
444
471
  * @param {PointerEvent} e
445
472
  */
446
473
  up_(e) {
474
+ // a pointer pressed elsewhere (on a control over the canvas) and let go here was never the view's
475
+ if (!this.pointers_.has(e.pointerId)) {
476
+ return;
477
+ }
447
478
  this.pointers_.delete(e.pointerId);
448
479
  // a finger lifted: the other slides on, from here
449
480
  this.drag_ = this.pointers_.size ? this.start_(e) : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geoblocks/cesium-iso",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "repository": {
@@ -21,5 +21,5 @@
21
21
  "@cesium/core": ">=0.1.0",
22
22
  "@cesium/engine": ">=10"
23
23
  },
24
- "gitHead": "0abb7f3381fdf13b15d50047a46d3789f5f95a9e"
24
+ "gitHead": "5c6ee12b4e35f46ff733cf628da105f55121fbf3"
25
25
  }