@vizabi/bubblechart 5.2.2 → 5.3.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.
@@ -1,4 +1,4 @@
1
- // https://github.com/vizabi/bubblechart#readme v5.2.2 build 1747332366038 Copyright 2025 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v5.3.0 build 1750548202909 Copyright 2025 Gapminder Foundation and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vizabi/shared-components'), require('d3'), require('mobx')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', '@vizabi/shared-components', 'd3', 'mobx'], factory) :
@@ -44465,6 +44465,7 @@ void main(void) {
44465
44465
  this.DOM.canvasWrap.select("canvas")
44466
44466
  .call(this._panZoom.dragRectangle)
44467
44467
  .call(this._panZoom.zoomer)
44468
+ .on("contextmenu", (evt) => evt.preventDefault())
44468
44469
  .on("dblclick.zoom", null)
44469
44470
  .on("mouseup", () => {
44470
44471
  _this.draggingNow = false;
@@ -44913,6 +44914,7 @@ void main(void) {
44913
44914
  let trailChunkIndex = 0;
44914
44915
  let trailChunkIndex1 = 0;
44915
44916
  let indexOffset;
44917
+ let newData = [];
44916
44918
  //let deltaTrailChunkIndex = 0;
44917
44919
  let currentTrailKey = null;
44918
44920
  //const _updateRanges = [];
@@ -44925,7 +44927,7 @@ void main(void) {
44925
44927
  let dataTrailChunkIndex;
44926
44928
  const trailsShowAndSomeSelected = this.MDL.trail.show && this.__someSelected;
44927
44929
 
44928
- const newData = trailsShowAndSomeSelected ? this.model.dataArray.reduce((res, d, i) => {
44930
+ if (trailsShowAndSomeSelected) newData = this.model.dataArray.reduce((res, d, i) => {
44929
44931
  d.r = sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size || 0));
44930
44932
  if (d[TRAIL_KEY]) {
44931
44933
  if (!currentTrailKey) {
@@ -44965,7 +44967,18 @@ void main(void) {
44965
44967
  }
44966
44968
  return res;
44967
44969
 
44968
- }, []) : this.model.dataArray.filter(d => {
44970
+ }, []);
44971
+
44972
+ //handle a situation when user is using opacity feature to hide unselected bubbles completely
44973
+ //the invisible bubbles should be completely transparent to mouse events, better yet not exist at all
44974
+ //it is convenient to do here because we are running O(N) filter for other purposes anyway
44975
+ else if (this.__someSelected && this.ui.opacitySelectDim === 0) newData = this.model.dataArray.filter(d => {
44976
+ if (d[REQUIRED_KEY] || !this.MDL.selected.data.filter.markers.has(d[KEY])) return false;
44977
+ d.r = sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size || 0));
44978
+ return true;
44979
+ });
44980
+
44981
+ else newData = this.model.dataArray.filter(d => {
44969
44982
  if (d[REQUIRED_KEY]) return false;
44970
44983
  d.r = sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size || 0));
44971
44984
  return true;
@@ -45718,34 +45731,35 @@ void main(void) {
45718
45731
  //}, 0);
45719
45732
  }
45720
45733
  },
45721
- onClick: ({ object:d, index }) => {
45722
- //console.log("onclick", d, this.activeObject);
45734
+ onClick: ({ object:d, index }, event) => {
45723
45735
  if (!d) return;
45724
- //zero opacity for non-selected markers
45736
+ //invisible bubbles should not react to clicks
45725
45737
  if (this._getBubbleOpacity(d) == 0) return;
45726
-
45727
- let dataKey = {[KEY]: d[KEY]};
45728
- console.log("click pretoggle", d, dataKey);
45729
- if (d[TRAIL_KEY]) {
45730
- const nextIndex = index + 1;
45731
- if (this.__data[nextIndex]?.[TRAIL_KEY] == d[TRAIL_KEY]) {
45732
- return;
45738
+ //no reaction on trail bubbles either
45739
+ if (d[TRAIL_KEY]) return;
45740
+
45741
+ mobx.runInAction(() => {
45742
+ const dataKey = {[KEY] : d[KEY]};
45743
+
45744
+ if (event.rightButton) {
45745
+ dataKey.name = this.__labelWithoutFrame(d);
45746
+ const margin = this.profileConstants.margin;
45747
+ const toolNode = this.element.node();
45748
+ const x = (this.width - event.offsetCenter.x) < 250 ? this.width - 250 : event.offsetCenter.x - 5;
45749
+
45750
+ //set context menu
45751
+ const contextMenuComponent = this.root.findChild({type: "MarkerContextmenu"});
45752
+ contextMenuComponent.show(dataKey, {
45753
+ x: toolNode.offsetLeft + x + margin.left * this.profileConstants.leftMarginRatio,
45754
+ y: toolNode.offsetTop + event.offsetCenter.y + margin.top - 5
45755
+ });
45733
45756
  } else {
45734
- dataKey = {[KEY]: d[TRAIL_KEY]};
45757
+ this.MDL.selected.data.filter.toggle(dataKey);
45735
45758
  }
45736
- }
45737
- //const invalidate = d?.[KEY] !== this.activeObject?.[KEY]
45738
- mobx.runInAction(() => {
45739
- this.MDL.selected.data.filter.toggle(dataKey);
45740
- console.log("click toggle", dataKey);
45741
- });
45742
- //this.activeObject = d;
45743
- //if (invalidate) {
45744
- //setTimeout(() => {
45745
- //console.log("invalidate", d, this.activeObject);
45746
- this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false)});
45747
- //}, 0);
45748
- //}
45759
+ });
45760
+
45761
+ // not sure why this is needed? -- angie
45762
+ //this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false)})
45749
45763
  },
45750
45764
  }
45751
45765
  }
@@ -46156,6 +46170,11 @@ void main(void) {
46156
46170
  placeholder: ".vzb-treemenu",
46157
46171
  model: marker,
46158
46172
  name: "tree-menu"
46173
+ },{
46174
+ type: sharedComponents.MarkerContextmenu,
46175
+ placeholder: ".vzb-marker-contextmenu",
46176
+ model: marker,
46177
+ name: "marker-contextmenu"
46159
46178
  },{
46160
46179
  type: sharedComponents.DataWarning,
46161
46180
  placeholder: ".vzb-datawarning",
@@ -46200,6 +46219,7 @@ void main(void) {
46200
46219
  <div class="vzb-buttonlist"></div>
46201
46220
  </div>
46202
46221
  <div class="vzb-treemenu"></div>
46222
+ <div class="vzb-marker-contextmenu"></div>
46203
46223
  <div class="vzb-datawarning"></div>
46204
46224
  <div class="vzb-spaceconfig"></div>
46205
46225
  <div class="vzb-datanotes"></div>
@@ -46340,7 +46360,7 @@ void main(void) {
46340
46360
  }
46341
46361
  });
46342
46362
 
46343
- BubbleChart.versionInfo = { version: "5.2.2", build: 1747332366038, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46363
+ BubbleChart.versionInfo = { version: "5.3.0", build: 1750548202909, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46344
46364
 
46345
46365
  exports.Base = BubbleChart;
46346
46366