Skip to content

PB-1493 : Add iframe parameter to scroll / zoom with CTRL#1283

Merged
sami-nouidri-swisstopo merged 1 commit intodevelopfrom
task-PB-1493-add-iframe-specific-scroll
Apr 10, 2025
Merged

PB-1493 : Add iframe parameter to scroll / zoom with CTRL#1283
sami-nouidri-swisstopo merged 1 commit intodevelopfrom
task-PB-1493-add-iframe-specific-scroll

Conversation

@sami-nouidri-swisstopo
Copy link
Contributor

@sami-nouidri-swisstopo sami-nouidri-swisstopo commented Mar 28, 2025

If the nosimplezoom = true parameter is added to an embedded URL, the user needs to press ctrl in order to zoom into the map. Here's a preview of the hint :
image

Test link

@sami-nouidri-swisstopo sami-nouidri-swisstopo changed the title PB-1493 : Add flag to store scrolling mode PB-1493 : Add iframe parameter to scroll / zoom with CTRL Mar 28, 2025
@cypress
Copy link

cypress bot commented Mar 28, 2025

web-mapviewer    Run #4992

Run Properties:  status check passed Passed #4992  •  git commit 38f7d73c7e: Merge pull request #1283 from geoadmin/task-PB-1493-add-iframe-specific-scroll
Project web-mapviewer
Branch Review develop
Run status status check passed Passed #4992
Run duration 01m 39s
Commit git commit 38f7d73c7e: Merge pull request #1283 from geoadmin/task-PB-1493-add-iframe-specific-scroll
Committer Sami Nouidri
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 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 48
View all changes introduced in this branch ↗︎

@sami-nouidri-swisstopo sami-nouidri-swisstopo force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 167d14a to fbd94ff Compare April 4, 2025 14:27
@sami-nouidri-swisstopo sami-nouidri-swisstopo marked this pull request as ready for review April 4, 2025 14:27
@sami-nouidri-swisstopo sami-nouidri-swisstopo requested review from ltkum, pakb and schtibe and removed request for pakb April 4, 2025 14:27
@sami-nouidri-swisstopo sami-nouidri-swisstopo force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 51a0a1d to b7d1823 Compare April 7, 2025 06:43
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

In general, seems good, three things :

  1. The naming convention is not that great, it would be better if, within the code, we knew it was a parameter meant for the embed view, and that we knew it was for the zoom. Something in the form :
    noSimpleZoom for the url parameter and noSimpleEmbedZoom for the store.
  2. I would add a button in the embed preview window to add or remove that parameter from the embed link, so people have a way to add the parameter.
  3. When I scroll on a page with the embed link, it stops the scrolling and focus on the map, stopping from going further down the page. It could be a good idea to find a way to stop the embedded viewer from overriding the main page scroll

@sami-nouidri-swisstopo sami-nouidri-swisstopo force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 3912b49 to 2a44ee3 Compare April 7, 2025 14:17
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

We discussed a bit on slack, and translations should be coming soon.
One last thing: for the sake of consistency, It would be better to use a square button, since other options (like for example : in the print) are using this kind of button to be toggled.

@ltkum ltkum force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 2a44ee3 to d0c0f40 Compare April 8, 2025 07:40
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

Functionality seems good, now it's time for details and cleanup :)

I think our LLM has provided the translations in the ticket, if you want to add them :)

@sami-nouidri-swisstopo sami-nouidri-swisstopo force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 9742e17 to abd2d48 Compare April 9, 2025 07:34
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

We're getting there :)

only a few more details to go through :)

const style = { 'max-width': iFrameWidth.value }
// Uses the width of the zoomModeLabel to set the width of the modal
// to avoid line breaks
const style = { 'min-width': `${Math.max(300, labelWidth.value)}px` }
Copy link
Contributor

Choose a reason for hiding this comment

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

also add the max width of Math.max(labelWidth.value, iFrameWidth.value)

class="form-check-label"
for="toggleZoomModeCheckbox"
>
{{ t('toggle_zooming_mode') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

The message on the box's tooltip is not the same as the one displayed on the map

return
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

when the popup is displayed, ctrl+zooming when the mouse is on the popup does a browser zoom. If you can find a way to avoid that, that would be great. (an event listener on the ctrl key for example)

If it adds too much complexity, don't bother about it

})

onMounted(() => {
log.info(`Embedded map view mounted`)
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add that log again at the end :)

@sami-nouidri-swisstopo sami-nouidri-swisstopo force-pushed the task-PB-1493-add-iframe-specific-scroll branch from 0b71722 to fe93908 Compare April 10, 2025 11:36
Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

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

LGTM. I'll add the translations in the google sheet :)

Issue : We wanted to add a way for people to have an iframe which did not zoom
automatically when we were scrolling the page on which they were embedded. We
also did not want to alter the default behavior, as we did not want thousands of mails

Fix: We added a new URL parameter, and put it in the store, to alter the behavior
of the scroll on embed views when it is active. We also added a button to toggle it when
creating a new iframe.

Added test for scrolling embedded preview & make modal window size dynamic
@ltkum ltkum force-pushed the task-PB-1493-add-iframe-specific-scroll branch from b1dd937 to 489d2bd Compare April 10, 2025 14:22
@sami-nouidri-swisstopo sami-nouidri-swisstopo merged commit 38f7d73 into develop Apr 10, 2025
6 checks passed
@sami-nouidri-swisstopo sami-nouidri-swisstopo deleted the task-PB-1493-add-iframe-specific-scroll branch April 10, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants