Changing the selection UI.
This commit is contained in:
parent
82cdad5f1f
commit
35937a933c
|
@ -146,6 +146,8 @@ const Map: Component = () => {
|
|||
}
|
||||
});
|
||||
|
||||
let selectedFeatures: Feature[] = [];
|
||||
|
||||
const clickHandler = (event: any) => {
|
||||
const pixel = [event.originalEvent.x, event.originalEvent.y];
|
||||
const features = event.map.getFeaturesAtPixel(pixel, { hitTolerance: 30 });
|
||||
|
@ -155,9 +157,11 @@ const Map: Component = () => {
|
|||
features,
|
||||
tree: unwrap(tree),
|
||||
});
|
||||
selectedFeatures.map((feature) => feature.set('isSelected', false));
|
||||
selectedFeatures = features;
|
||||
features.map((feature) => {
|
||||
const id = feature.get('id');
|
||||
feature.set('isSelected', !feature.get('isSelected'));
|
||||
feature.set('isSelected', true);
|
||||
console.log({ caller: 'clickHandler / feature', event, feature, id });
|
||||
const branch = tree[id];
|
||||
if (branch?.updateHandler) branch.updateHandler(feature);
|
||||
|
|
Loading…
Reference in New Issue