@abi-software/flatmap-viewer 2.7.0 → 2.7.1-a.1

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/flatmap-viewer",
3
- "version": "2.7.0",
3
+ "version": "2.7.1-a.1",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1020,6 +1020,10 @@ export class UserInteractions
1020
1020
  // Simulate `mouseenter` events on features
1021
1021
 
1022
1022
  const feature = features[0];
1023
+
1024
+ //is feature a marker??
1025
+ console.log('mm', event.type, feature)
1026
+
1023
1027
  const featureModels = ('properties' in feature && 'models' in feature.properties)
1024
1028
  ? feature.properties.models
1025
1029
  : null;
@@ -1444,6 +1448,7 @@ export class UserInteractions
1444
1448
  markerMouseEvent_(marker, anatomicalId, event)
1445
1449
  //============================================
1446
1450
  {
1451
+ console.log('mk', event.type)
1447
1452
  // No tooltip when context menu is open
1448
1453
  if (this._modal
1449
1454
  || (this.__activeMarker !== null && event.type === 'mouseleave')) {
@@ -1464,6 +1469,7 @@ export class UserInteractions
1464
1469
 
1465
1470
  this.markerEvent_(event, markerId, marker.getLngLat(),
1466
1471
  anatomicalId, annotation)
1472
+ console.log('mk handled...')
1467
1473
  event.stopPropagation()
1468
1474
  }
1469
1475
  }
@@ -113,6 +113,7 @@ export class ClusteredMarkerLayer
113
113
  const features = this.#map.queryRenderedFeatures(e.point, {
114
114
  layers: ['clustered-markers']
115
115
  })
116
+ console.log('Cluster marker', features)
116
117
  const clusterId = features[0].properties.cluster_id
117
118
  const zoom = await this.#map.getSource('markers').getClusterExpansionZoom(clusterId)
118
119
  this.#map.easeTo({
@@ -121,10 +122,10 @@ export class ClusteredMarkerLayer
121
122
  })
122
123
  })
123
124
 
124
- console.log('Unclustered click', e, features)
125
125
  this.#map.on('click', 'single-points', this.singleMarkerEvent.bind(this))
126
126
  this.#map.on('mouseenter', 'single-points', this.singleMarkerEvent.bind(this))
127
127
  this.#map.on('mousemove', 'single-points', this.singleMarkerEvent.bind(this))
128
+ // this.#map.on('mouseleave', 'single-points', this.singleMarkerEvent.bind(this))
128
129
 
129
130
  this.#map.on('mouseenter', 'clustered-markers', () => {
130
131
  this.#map.getCanvas().style.cursor = 'pointer'
@@ -138,6 +139,7 @@ export class ClusteredMarkerLayer
138
139
  singleMarkerEvent(event)
139
140
  //======================
140
141
  {
142
+ console.log('cl', event.type)
141
143
  const features = this.#map.queryRenderedFeatures(event.point, {
142
144
  layers: ['single-points']
143
145
  })
@@ -146,6 +148,7 @@ export class ClusteredMarkerLayer
146
148
  const position = properties.markerPosition.slice(1, -1).split(',').map(p => +p)
147
149
  this.#ui.markerEvent_(event, feature.id, position, properties.models, properties)
148
150
  }
151
+ console.log('cl handled...')
149
152
  event.originalEvent.stopPropagation()
150
153
  }
151
154
 
@@ -425,10 +425,14 @@ export class LayerManager
425
425
  mapLayer.setFilter(this.__layerOptions);
426
426
  }
427
427
  if (this.#flightPathLayer) {
428
+ // * @arg options.layerOptions.sckan {string} Show neuron paths known to SCKAN: values are ``valid`` (default),
429
+ // * ``invalid``, ``all`` or ``none``.
430
+
431
+
428
432
  const sckanState = options.sckan || 'valid'
429
433
  const sckanFilter = (sckanState == 'none') ? {NOT: {HAS: 'sckan'}} :
430
434
  (sckanState == 'valid') ? {sckan: true} :
431
- (sckanState == 'invalid') ? {NOT: {sckan: true}} :
435
+ (sckanState == 'invalid') ? {NOT: {sckan: true}} : // {sckan: false} is different...
432
436
  true
433
437
  const featureFilter = new PropertiesFilter(sckanFilter)
434
438
  if ('taxons' in options) {
package/src/main.js CHANGED
@@ -49,12 +49,15 @@ const ALL_MARKERS = [
49
49
  'UBERON:0037094',
50
50
  'ILX:0738305',
51
51
 
52
- 'UBERON:0000948', // {className: 'heart-marker'}); // Heart
52
+ // 'UBERON:0000948', // {className: 'heart-marker'}); // Heart
53
53
  'UBERON:0002048', // Lung
54
54
  'UBERON:0000945', // Stomach
55
55
  'UBERON:0001155', // Colon
56
56
  'UBERON:0001255', // Bladder
57
57
  'UBERON:0001759', // Vagus
58
+
59
+ 'UBERON:0016508', // Pelvic ganglion
60
+
58
61
  ]
59
62
 
60
63
  //==============================================================================
@@ -172,6 +175,8 @@ export async function standaloneViewer(map_endpoint=null, options={})
172
175
  mapOptions.background = args[0].value;
173
176
  } else if (eventType === 'annotation') {
174
177
  drawControl.handleEvent(...args)
178
+ } else if (args[0].type === 'marker') {
179
+ console.log(eventType, ...args)
175
180
  }
176
181
  }, mapOptions)
177
182
  .then(map => {
@@ -183,7 +188,11 @@ export async function standaloneViewer(map_endpoint=null, options={})
183
188
  map.addMarker('UBERON:0001255'); // Bladder
184
189
  map.addMarker('UBERON:0001759'); // Vagus
185
190
  */
186
- map.addMarkers(ALL_MARKERS, {cluster: true})
191
+ map.addMarker('UBERON:0000945', {cluster: true}); // Stomach
192
+ // map.addMarker('UBERON:0016508', {cluster: false}); // Pelvic ganglion
193
+ map.addMarker('UBERON:0016508', {cluster: true}); // Pelvic ganglion
194
+ map.addMarker('UBERON:0000948', {cluster: true, className: 'heart-marker'}); // Heart
195
+ // map.addMarkers(ALL_MARKERS)
187
196
  currentMap = map;
188
197
  drawControl = new DrawControl(map)
189
198
  })
package/src/types.ts ADDED
@@ -0,0 +1,26 @@
1
+ /******************************************************************************
2
+
3
+ Flatmap viewer and annotation tool
4
+
5
+ Copyright (c) 2019 - 2024 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+
21
+ export type Constructor<T> = new(...args: any[]) => T
22
+
23
+ export type ObjectRecord = Record<string, any>
24
+
25
+ //==============================================================================
26
+
package/src/utils.js CHANGED
@@ -120,6 +120,7 @@ export function normaliseId(id)
120
120
 
121
121
  export function setDefaults(options, defaultOptions)
122
122
  {
123
+ // c.f. Object.assign({}, defaultOptions, options)
123
124
  if (options === undefined || options === null) {
124
125
  return defaultOptions;
125
126
  }