Skip to content

PB-1068: Add CTRL + Click to Toggle Selected Features#1357

Merged
pakb merged 20 commits intodevelopfrom
feat-pb-1068-ctrl-click
Jun 26, 2025
Merged

PB-1068: Add CTRL + Click to Toggle Selected Features#1357
pakb merged 20 commits intodevelopfrom
feat-pb-1068-ctrl-click

Conversation

@ismailsunni
Copy link
Contributor

@ismailsunni ismailsunni commented Jun 3, 2025

@ismailsunni ismailsunni requested a review from Copilot June 3, 2025 06:29

This comment was marked as outdated.

@cypress
Copy link

cypress bot commented Jun 3, 2025

web-mapviewer    Run #5461

Run Properties:  status check passed Passed #5461  •  git commit bd4a703f3f: PB-1068: Improves feature selection with CTRL+Click
Project web-mapviewer
Branch Review feat-pb-1068-ctrl-click
Run status status check passed Passed #5461
Run duration 05m 16s
Commit git commit bd4a703f3f: PB-1068: Improves feature selection with CTRL+Click
Committer Pascal Barth
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 20
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 253
View all changes introduced in this branch ↗︎

@ismailsunni ismailsunni requested review from pakb and sommerfe June 3, 2025 06:58
Copy link
Contributor

@sommerfe sommerfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

just a small comment, is it possible to not show the drag box when only ctrl+click on a feature and only show the drag box when ctrl+click+drag?

Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have an e2e test that checks for this new feature support

@ismailsunni
Copy link
Contributor Author

@sommerfe it seems it's handled internally by OpenLayers, and it will be quite difficult to do it
@pakb done, test and tolerance are added.

@ismailsunni ismailsunni requested a review from pakb June 4, 2025 07:24
@ismailsunni ismailsunni force-pushed the feat-pb-1068-ctrl-click branch from 4c35a3b to 5a89172 Compare June 5, 2025 03:40
@ismailsunni ismailsunni force-pushed the feat-pb-1068-ctrl-click branch 2 times, most recently from f62aead to ee4cbb8 Compare June 9, 2025 02:57
@ismailsunni ismailsunni requested a review from Copilot June 9, 2025 03:29

This comment was marked as outdated.

@ismailsunni ismailsunni requested a review from pakb June 9, 2025 03:35
@ismailsunni
Copy link
Contributor Author

The test was failing over and over, I need to the update from develop branch to fix it.

Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it so that the selection box isn't reset when we de-select one element from it?

@ismailsunni ismailsunni force-pushed the feat-pb-1068-ctrl-click branch from ab18b95 to 412eab5 Compare June 17, 2025 04:20
@ismailsunni ismailsunni requested review from Copilot and pakb June 17, 2025 04:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for CTRL+click to toggle feature selection and visual feedback via a selection rectangle.

  • Introduce a new IdentifyMode (NEW vs TOGGLE) and CTRL click type to dispatch toggle vs replace identify operations
  • Render a red rectangle around box selections and expose its visibility and coordinates in the store
  • Update e2e tests, map interaction composables, and z-index calculations to cover the new behavior

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mapviewer/tests/cypress/tests-e2e/featureSelection.cy.js Added clickOnMap helper and a new test for CTRL+click toggling
packages/mapviewer/tests/cypress/fixtures/import-tool/4-points.kml Added KML fixture for toggle selection test
packages/mapviewer/src/store/plugins/click-on-map-management.plugin.js Extended click plugin to detect CTRL clicks and set IdentifyMode
packages/mapviewer/src/store/modules/map.store.js Introduced CTRL_LEFT_SINGLECLICK click type
packages/mapviewer/src/store/modules/features.store.js Added IdentifyMode enum, toggle logic, and rectangle state
packages/mapviewer/src/modules/map/components/openlayers/utils/useMapInteractions.composable.js Use platformModifierKeyOnly to flag CTRL clicks
packages/mapviewer/src/modules/map/components/openlayers/utils/useDragBoxSelect.composable.js Enforce minimum drag distance and dispatch rectangle coords
packages/mapviewer/src/modules/map/components/openlayers/OpenLayersSelectionRectangle.vue New component to draw the selection rectangle
packages/mapviewer/src/modules/map/components/openlayers/OpenLayersMap.vue Conditionally include the selection rectangle overlay
packages/mapviewer/src/modules/map/components/common/z-index.composable.js Compute a z-index for the selection rectangle layer
packages/mapviewer/src/config/map.config.js Defined DEFAULT_FEATURE_IDENTIFICATION_TOLERANCE
packages/mapviewer/src/api/features/features.api.js Removed hardcoded tolerance and imported from config
Comments suppressed due to low confidence (2)

packages/mapviewer/src/modules/map/components/openlayers/utils/useMapInteractions.composable.js:2

  • Missing imports for ClickType and ClickInfo, which are used later in the file. Please add: import { ClickType, ClickInfo } from '@/store/modules/map.store'.
import { altKeyOnly, platformModifierKeyOnly, primaryAction } from 'ol/events/condition'

packages/mapviewer/src/modules/map/components/openlayers/utils/useMapInteractions.composable.js:2

  • [nitpick] altKeyOnly is imported but not used in this file. Consider removing it to clean up unused imports.
import { altKeyOnly, platformModifierKeyOnly, primaryAction } from 'ol/events/condition'

@ismailsunni
Copy link
Contributor Author

@pakb done, I use the same approach as in the layer extents to keep showing the box. It's actually handled internally by OpenLayers.

Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change a bit the store logic here.

Instead of storing a flag, telling if the selection extent should be shown (and used only in one edge case), I'd store the selection extent itself (derived from the clickInfo).
If the extent is defined, we show it, also in other circumstances (not only when we toggle features off)

A little thing that could be also changed : if we toggle (CTRL+click) on a selected feature, any adjacent feature (or underlying feature) should not be toggled on. If we toggle something off, we are are in "Toggle off" mode. I find it a bit confusing when you CTRL click on the map, with only one of two stacked features selected, and the other one is then toggle on. It feels like the app didn't do anything

@ismailsunni
Copy link
Contributor Author

@pakb

A little thing that could be also changed : if we toggle (CTRL+click) on a selected feature, any adjacent feature (or underlying feature) should not be toggled on. If we toggle something off, we are are in "Toggle off" mode. I find it a bit confusing when you CTRL click on the map, with only one of two stacked features selected, and the other one is then toggle on. It feels like the app didn't do anything

but how do we differentiate if the user want to select the unselected feature? I mean the reverse case, when the user want to select a feature, the selected adjacent feature will be unselected.

actually, is it really possible? since normally, we select all features in the clicked area or stacked.

@ismailsunni ismailsunni force-pushed the feat-pb-1068-ctrl-click branch from f3beb8d to 9144f9f Compare June 24, 2025 08:31
@ismailsunni ismailsunni requested a review from pakb June 24, 2025 08:32
Refines the CTRL+Click feature selection logic to prevent user confusion when toggling features.

Specifically, it ensures that adding new features via CTRL+Click does not occur immediately after deselecting an existing feature at the same location, thus avoiding the impression that the deselect action had no effect.
@pakb pakb merged commit 430d020 into develop Jun 26, 2025
6 checks passed
@pakb pakb deleted the feat-pb-1068-ctrl-click branch June 26, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants