Skip to content
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

Improve setting widget position. #796

Merged
merged 1 commit into from
Mar 21, 2018
Merged

Improve setting widget position. #796

merged 1 commit into from
Mar 21, 2018

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Mar 16, 2018

The widget position can be any css-style position, or an x, y coordinate for the map. If you change the position using the same attributes as were used previously, it behaved as expected. However, if different attributes were specified, surprising results could occur.

For instance widget.position({left: 10, top: 10}) followed by widget.position({right: 20, top: 10}), instead of switching the css from using left to right, combined them, so that functionally, the widget was specifying {left: 10, right: 20, top: 10}. Although this could be avoided by explicitly calling widget.position({left: null, right: 20, top: 10}) and could change just one coordinate via call like widget.position({top: 11}), this is surprising behavior.

With this change, setting a widget's position clears the old position attributes if they are not explicitly set.

The widget position can be any css-style position, or an x, y coordinate
for the map.  If you change the position using the same attributes as
were used previously, it behaved as expected.  However, if different
attributes were specified, surprising results could occur.

For instance `widget.position({left: 10, top: 10})` followed by
`widget.position({right: 20, top: 10})`, instead of switching the css
from using `left` to `right`, combined them, so that functionally, the
widget was specifying `{left: 10, right: 20, top: 10}`.  Although this
could be avoided by explicitly calling `widget.position({left: null,
right: 20, top: 10})` and could change just one coordinate via call like
`widget.position({top: 11})`, this is surprising behavior.

With this change, setting a widget's position clears the old position
attributes if they are not explicitly set.
Copy link

@matthewma7 matthewma7 left a comment

Choose a reason for hiding this comment

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

This looks good to me. 👍

@manthey manthey merged commit b40f845 into widget-tests Mar 21, 2018
@manthey manthey deleted the widget-position branch March 21, 2018 17:42
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.

3 participants