@abi-software/flatmapvuer 1.2.0-beta.2 → 1.2.0-beta.4

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": "@abi-software/flatmapvuer",
3
- "version": "1.2.0-beta.2",
3
+ "version": "1.2.0-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -1983,7 +1983,6 @@ export default {
1983
1983
  * @arg feature
1984
1984
  */
1985
1985
  displayTooltip: function (feature, geometry = undefined) {
1986
- this.tooltipDisplay = true
1987
1986
  let featureId = undefined
1988
1987
  let options = { className: 'flatmapvuer-popover' }
1989
1988
  if (geometry) {
@@ -1999,8 +1998,9 @@ export default {
1999
1998
  // Connectivity info will show in sidebar
2000
1999
  if (this.connectivityInfoSidebar && this.viewingMode !== 'Annotation') {
2001
2000
  // move the map center to highlighted area
2002
- const featureIds = [feature];
2003
- this.moveMap(featureIds);
2001
+ // this method is moved to sidebar connectivity info
2002
+ // const featureIds = [feature];
2003
+ // this.moveMap(featureIds);
2004
2004
  this.$emit('connectivity-info-open', this.tooltipEntry);
2005
2005
  }
2006
2006
  // If UI is not disabled,
@@ -2008,6 +2008,7 @@ export default {
2008
2008
  // Provenance popup will be shown on map
2009
2009
  // Tooltip will be shown for Annotation view
2010
2010
  if (!this.disableUI && (!this.connectivityInfoSidebar || this.viewingMode === 'Annotation')) {
2011
+ this.tooltipDisplay = true;
2011
2012
  this.$nextTick(() => {
2012
2013
  this.mapImp.showPopup(featureId, this.$refs.tooltip.$el, options)
2013
2014
  this.popUpCssHacks()
@@ -2020,11 +2021,11 @@ export default {
2020
2021
  * because the sidebar is opened
2021
2022
  * @arg featureIds
2022
2023
  */
2023
- moveMap: function (featureIds) {
2024
+ moveMap: function (featureIds, options = {}) {
2024
2025
  if (this.mapImp) {
2026
+ const { offsetX = 0, offsetY = 0, zoom = 4 } = options;
2025
2027
  const Map = this.mapImp._map;
2026
2028
  const bbox = this.mapImp._bounds.toArray();
2027
- const sidebarWidth = 500; // actual width is 600
2028
2029
 
2029
2030
  // Zoom the map to features first
2030
2031
  this.mapImp.zoomToFeatures(featureIds, { noZoomIn: true });
@@ -2038,9 +2039,8 @@ export default {
2038
2039
  if (bbox?.length) {
2039
2040
  setTimeout(() => {
2040
2041
  Map.fitBounds(bbox, {
2041
- padding: {
2042
- right: sidebarWidth
2043
- },
2042
+ offset: [offsetX, offsetY],
2043
+ zoom: zoom,
2044
2044
  animate: true
2045
2045
  });
2046
2046
  });
@@ -222,7 +222,7 @@ let FlatmapQueries = function () {
222
222
  this.origins = []
223
223
  this.components = []
224
224
  if (!keastIds || keastIds.length == 0) return
225
-
225
+
226
226
  let prom1 = this.queryForConnectivity(keastIds, signal) // This on returns a promise so dont need 'await'
227
227
  let prom2 = await this.pubmedQueryOnIds(eventData)
228
228
  let results = await Promise.all([prom1, prom2])
@@ -281,10 +281,10 @@ let FlatmapQueries = function () {
281
281
  if (node.length === 1) { // If the node is in the form [id]
282
282
  console.error("Server returns a single node", node)
283
283
  return node[0]
284
- } else {
284
+ } else {
285
285
  if (node.length === 2 && node[1].length === 0) { // If the node is in the form [id, []]
286
286
  return node[0]
287
- } else {
287
+ } else {
288
288
  return false // If the node is in the form [id, [id1, id2]]
289
289
  }
290
290
  }
@@ -294,7 +294,7 @@ let FlatmapQueries = function () {
294
294
 
295
295
  // Check if the node is a single node or a node with multiple children
296
296
  let nodeIsSingle = this.findIfNodeIsSingle(node)
297
-
297
+
298
298
  // Case where node is in the form [id]
299
299
  if (nodeIsSingle) {
300
300
  return lookUp[nodeIsSingle]
@@ -467,7 +467,8 @@ let FlatmapQueries = function () {
467
467
  this.pubmedSearchUrl = function (ids) {
468
468
  let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
469
469
  let params = new URLSearchParams()
470
- params.append('term', ids)
470
+ const decodedIDs = ids.map((id) => decodeURIComponent(id));
471
+ params.append('term', decodedIDs);
471
472
  return url + params.toString()
472
473
  }
473
474
  }