Skip to content

Draw should not interfere with dragPan.disable()#1191

Closed
MauPalantir wants to merge 3 commits intomapbox:mainfrom
MauPalantir:master
Closed

Draw should not interfere with dragPan.disable()#1191
MauPalantir wants to merge 3 commits intomapbox:mainfrom
MauPalantir:master

Conversation

@MauPalantir
Copy link

@MauPalantir MauPalantir commented Aug 3, 2023

Fixes #654

The issue is that Draw assumes that dragPan is enabled and simply enables it without question after certain operations (when dragpan is temporarily disabled). This change would set a variable called initialDragPanState and only re-enables when it was originally enabled.

canDragMove: false,
selectedCoordPaths: opts.coordPath ? [opts.coordPath] : []
selectedCoordPaths: opts.coordPath ? [opts.coordPath] : [],
desiredDragPanState: null
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: probably this is some leftover variable?


if (ctx.options.boxSelect) {
map.boxZoom.disable();
const dragPanState = map.dragPan.isEnabled();
Copy link
Contributor

@stepankuzmin stepankuzmin Aug 3, 2023

Choose a reason for hiding this comment

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

Nit: maybe it's worth renaming using isEnabled instead of state?

Suggested change
const dragPanState = map.dragPan.isEnabled();
const dragPanIsEnabled = map.dragPan.isEnabled();

@stepankuzmin
Copy link
Contributor

Hi @MauPalantir, thanks for the contribution! Overall this looks good to me, just a couple of nits.

@stepankuzmin
Copy link
Contributor

Done in #1216

@lukeMichalakisTK
Copy link

lukeMichalakisTK commented Oct 2, 2024

@stepankuzmin has this fix been deployed? I am still experiencing this bug on mapbox-gl v3.7.0 and mapbox-gl-draw on v.1.4.3, which I believe are the most up to date versions?

Edit: I see mapbox-gl-draw has not been released since this fix was implemented, is a release planned anytime soon?

@stepankuzmin
Copy link
Contributor

Hey @lukeMichalakisTK, thanks for the bump.

This still needs to be released.

@lukeMichalakisTK
Copy link

@stepankuzmin No worries! We found a workaround locally that can hold us over in the meantime and I'll keep my eyes peeled for any releases from you guys, thanks!

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.

Draw interferes dragPan.disable()

4 participants