mascot-vis 1.9.1 → 1.9.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/dist/mascot.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- // version: 1.9.1
2
+ // version: 1.9.2
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3'), require('pixi.js')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', 'd3', 'pixi.js'], factory) :
@@ -3664,54 +3664,90 @@
3664
3664
  }
3665
3665
  this.scene._relayoutAncestors(this.anyItem, this.items);
3666
3666
  } else if (this._rectNegativeValues){
3667
- let dMax = Math.max(...this.data), dMin = Math.min(...this.data);
3668
- if (this.channel == "width") {
3669
- let base = Math.min(...this.items.map(d => d.bounds.left));
3670
- for (let i = 0; i < this.items.length; i++) {
3671
- let offset, peer = this.items[i], left = peer.leftSegment.vertex1.x, right = peer.rightSegment.vertex1.x;
3672
- if (peer.parent && peer.parent.type == ItemType.Collection) {
3673
- offset = peer.parent.bounds.left;
3674
- } else {
3675
- offset = base;
3676
- }
3677
- peer.rightSegment._doTranslate(offset + this.scale.map(this.data[i]) - right, 0);
3678
- peer.leftSegment._doTranslate(offset + this.scale.map(0) - left, 0);
3679
- peer._updateBounds();
3680
- if (this.data[i] > 0) {
3681
- peer.boundsOffsets.right = this.scale.map(dMax) - this.scale.map(this.data[i]);
3682
- peer.boundsOffsets.left = this.scale.map(0) - this.scale.map(dMin);
3667
+ let dMax = Math.max(...this.data), dMin = Math.min(...this.data),
3668
+ base = this.channel === "width" ? Math.min(...this.items.map(d => d.bounds.left)) :
3669
+ Math.min(...this.items.map(d => d.bounds.top)) + this.scale.rangeExtent,
3670
+ maxSide = this.channel === "width" ? "right" : "top",
3671
+ minSide = this.channel === "width" ? "left" : "bottom";
3672
+ for (let i = 0; i < this.items.length; i++) {
3673
+ let offset, peer = this.items[i];
3674
+ if (peer.parent && peer.parent.type === ItemType.Collection) {
3675
+ let pp = peer.parent.parent;
3676
+ if (pp.type === ItemType.Collection && pp.layout && pp.layout.type === LayoutType.Grid) {
3677
+ let idx = pp.children.indexOf(peer.parent);
3678
+ offset = pp.layout.cellBounds[idx][minSide];
3683
3679
  } else {
3684
- peer.boundsOffsets.left = this.scale.map(this.data[i]) - this.scale.map(dMin);
3685
- peer.boundsOffsets.right = this.scale.map(dMax) - this.scale.map(0);
3680
+ offset = peer.parent.refBounds[minSide];
3686
3681
  }
3682
+ } else {
3683
+ offset = base;
3687
3684
  }
3688
- } else if (this.channel == "height") {
3689
- let base = Math.min(...this.items.map(d => d.bounds.top)) + this.scale.rangeExtent;
3690
- for (let i = 0; i < this.items.length; i++) {
3691
- let offset, peer = this.items[i], top = peer.topSegment.vertex1.y, btm = peer.bottomSegment.vertex1.y;
3692
- if (peer.parent && peer.parent.type === ItemType.Collection) {
3693
- let pp = peer.parent.parent;
3694
- if (pp.type === ItemType.Collection && pp.layout && pp.layout.type === LayoutType.Grid) {
3695
- let idx = pp.children.indexOf(peer.parent);
3696
- offset = pp.layout.cellBounds[idx].bottom;
3697
- } else {
3698
- offset = peer.parent.bounds.bottom;
3699
- }
3700
- } else {
3701
- offset = base;
3702
- }
3703
- peer.topSegment._doTranslate(0, offset - this.scale.map(this.data[i]) - top);
3704
- peer.bottomSegment._doTranslate(0, offset - this.scale.map(0) - btm);
3705
- peer._updateBounds();
3706
- if (this.data[i] > 0) {
3707
- peer.boundsOffsets.top = this.scale.map(dMax) - this.scale.map(this.data[i]);
3708
- peer.boundsOffsets.bottom = this.scale.map(0) - this.scale.map(dMin);
3709
- } else {
3710
- peer.boundsOffsets.bottom = this.scale.map(this.data[i]) - this.scale.map(dMin);
3711
- peer.boundsOffsets.top = this.scale.map(dMax) - this.scale.map(0);
3712
- }
3685
+ if (this.channel === "width") {
3686
+ peer.leftSegment._doTranslate(offset + this.scale.map(0) - peer.leftSegment.vertex1.x, 0);
3687
+ peer.rightSegment._doTranslate(offset + this.scale.map(this.data[i]) - peer.rightSegment.vertex1.x, 0);
3688
+ } else {
3689
+ peer.topSegment._doTranslate(0, offset - this.scale.map(this.data[i]) - peer.topSegment.vertex1.y);
3690
+ peer.bottomSegment._doTranslate(0, offset - this.scale.map(0) - peer.bottomSegment.vertex1.y);
3691
+ }
3692
+
3693
+ peer._updateBounds();
3694
+ if (this.data[i] > 0) {
3695
+ peer.boundsOffsets[maxSide] = this.scale.map(dMax) - this.scale.map(this.data[i]);
3696
+ peer.boundsOffsets[minSide] = this.scale.map(0) - this.scale.map(dMin);
3697
+ } else {
3698
+ peer.boundsOffsets[minSide] = this.scale.map(this.data[i]) - this.scale.map(dMin);
3699
+ peer.boundsOffsets[maxSide] = this.scale.map(dMax) - this.scale.map(0);
3713
3700
  }
3714
3701
  }
3702
+
3703
+
3704
+ // if (this.channel == "width") {
3705
+ // let base = Math.min(...this.items.map(d => d.bounds.left));
3706
+ // for (let i = 0; i < this.items.length; i++) {
3707
+ // let offset, peer = this.items[i], left = peer.leftSegment.vertex1.x, right = peer.rightSegment.vertex1.x;
3708
+ // if (peer.parent && peer.parent.type == ItemType.Collection) {
3709
+ // offset = peer.parent.bounds.left;
3710
+ // } else {
3711
+ // offset = base;
3712
+ // }
3713
+ // peer.rightSegment._doTranslate(offset + this.scale.map(this.data[i]) - right, 0);
3714
+ // peer.leftSegment._doTranslate(offset + this.scale.map(0) - left, 0);
3715
+ // peer._updateBounds();
3716
+ // if (this.data[i] > 0) {
3717
+ // peer.boundsOffsets.right = this.scale.map(dMax) - this.scale.map(this.data[i]);
3718
+ // peer.boundsOffsets.left = this.scale.map(0) - this.scale.map(dMin);
3719
+ // } else {
3720
+ // peer.boundsOffsets.left = this.scale.map(this.data[i]) - this.scale.map(dMin);
3721
+ // peer.boundsOffsets.right = this.scale.map(dMax) - this.scale.map(0);
3722
+ // }
3723
+ // }
3724
+ // } else if (this.channel == "height") {
3725
+ // for (let i = 0; i < this.items.length; i++) {
3726
+ // let offset, peer = this.items[i], top = peer.topSegment.vertex1.y, btm = peer.bottomSegment.vertex1.y;
3727
+ // if (peer.parent && peer.parent.type === ItemType.Collection) {
3728
+ // let pp = peer.parent.parent;
3729
+ // if (pp.type === ItemType.Collection && pp.layout && pp.layout.type === LayoutType.Grid) {
3730
+ // let idx = pp.children.indexOf(peer.parent);
3731
+ // offset = pp.layout.cellBounds[idx].bottom;
3732
+ // } else {
3733
+ // offset = peer.parent.refBounds.bottom;
3734
+ // }
3735
+ // } else {
3736
+ // let base = Math.min(...this.items.map(d => d.bounds.top)) + this.scale.rangeExtent;
3737
+ // offset = base;
3738
+ // }
3739
+ // peer.topSegment._doTranslate(0, offset - this.scale.map(this.data[i]) - top);
3740
+ // peer.bottomSegment._doTranslate(0, offset - this.scale.map(0) - btm);
3741
+ // peer._updateBounds();
3742
+ // if (this.data[i] > 0) {
3743
+ // peer.boundsOffsets.top = this.scale.map(dMax) - this.scale.map(this.data[i]);
3744
+ // peer.boundsOffsets.bottom = this.scale.map(0) - this.scale.map(dMin);
3745
+ // } else {
3746
+ // peer.boundsOffsets.bottom = this.scale.map(this.data[i]) - this.scale.map(dMin);
3747
+ // peer.boundsOffsets.top = this.scale.map(dMax) - this.scale.map(0);
3748
+ // }
3749
+ // }
3750
+ // }
3715
3751
  } else if (this.channel == "area") {
3716
3752
  for (let i = 0; i < this.items.length; i++) {
3717
3753
  let peer = this.items[i], s = Math.sqrt(this.scale.map(this.data[i]));
@@ -8247,6 +8283,14 @@
8247
8283
  if (Object.keys(e) === 0)
8248
8284
  delete scene.encodings[getEncodingKey(item)];
8249
8285
  }
8286
+
8287
+ let axes = scene.getRelatedAxes(item);
8288
+ for (let a of axes) {
8289
+ if (a._item.classId === item.classId) {
8290
+ a._item = newItem;
8291
+ a._items = getPeers(newItem, scene);
8292
+ }
8293
+ }
8250
8294
  //TODO: update constraints
8251
8295
  },
8252
8296
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mascot-vis",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Manipulable Semantic Components in Data Visualization",
5
5
  "scripts": {
6
6
  "build": "rollup --config",