-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable zoom by box selection #319
Conversation
components/MapSelection.jsx
Outdated
condition: ol.events.condition.shiftKeyOnly | ||
condition: () => { | ||
return ["ZoomIn", "ZoomOut"].includes(this.props.currentTask) || ol.events.condition.shiftKeyOnly; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can generally simplify the condition to return true
, shiftKeyOnly
looks like leftover code, and I don't think it makes any sense here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was used by the shift+drag zoom already implemented but nope. I have removed all the condition
plugins/ZoomButtons.jsx
Outdated
if (this.props.currentTask !== null && this.props.currentTask === this.state.task && this.state.disabled) { | ||
this.props.setCurrentTask(null); | ||
} | ||
if (this.props.currentTask === this.state.task && prevProps !== this.props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you write this.props.click && this.props.click !== prevProps.click
here and directly use this.props.click.coordinate
below you can simplify the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
A general remark: Does this conflict/overlap with the already implemented shift+drag zoomin? |
No, it does not conflict with this feature. I thought it was implemented with the |
plugins/ZoomButtons.jsx
Outdated
if (this.props.currentTask !== null && this.props.currentTask === this.state.task && this.state.disabled) { | ||
this.props.setCurrentTask(null); | ||
} | ||
if (this.props.currentTask === this.state.task && prevProps !== this.props && this.props.click !== prevProps.click) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.props.currentTask === this.state.task && this.props.click && this.props.click !== prevProps.click
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🤦
I'd propose these additional changes [1], what do you think? [1] db228da |
Yes I agree with all of your changes, thanks. For |
It will just re-center the map without changing the zoom level, which I think is not a bad behaviour. |
Manually merged, thanks! |
Hi,
This PR introduces a new
enableZoomByBoxSelection
option forZoom(In|Out)Plugin
to allow user to zoom by box selection. I needed to updateMapSelection
to make it work, I don't think I breaks something for other plugins that use this component but I'm not sure...I tried to reproduce behavior for Zoom buttons in QGIS Desktop.
Here is a screencast with
enableZoomByBoxSelection: false
forZoomInPlugin
(actual behavior) andenableZoomByBoxSelection: true
forZoomOutPlugin
:Thanks for the review !
This feature has been funded by Grand Lyon Métropole https://www.grandlyon.com/