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

Fix/map zoom #6835

Merged
merged 14 commits into from
May 27, 2016
Merged

Fix/map zoom #6835

merged 14 commits into from
May 27, 2016

Conversation

panda01
Copy link
Contributor

@panda01 panda01 commented Apr 8, 2016

This fixes map zoom persistence issues.

Couples more the uiState with the vis.
Adds uiState persistence values for mapZoom, and mapCenter.

In short makes it so you can save maps that load already at a specific location, and so that when you reload a map it stays at the same place.

Closes #1442.

mapMoveEnd: function (event) {
mapMoveEnd: function (event, uiState) {
const mapPrecision = zoomPrecision[event.zoom];
uiState.set('vis.params.mapCenter', event.center);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why vis.params? these can just be 'mapCenter', 'mapZoom', and 'mapPrecision' I think. Otherwise it's confusing.

},
deserialize: getPrecision,
write: function (aggConfig, output) {
output.params.precision = getPrecision(aggConfig.params.precision);
let currZoom = aggConfig.vis.params.mapZoom;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a fan of this function. I have to figure out whether the aggConfig, vis, or uiState has the proper zoom, to base the precision off of. This happens differently whether you load up the dashboard with the same vis, refresh on the vis page, or set it by zooming or panning on the map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the proper solution is to fix the dashboard and ensure the vis gets it uiState on the dashboard.

@rashidkpc
Copy link
Contributor

@panda01 related to #6914?

@panda01
Copy link
Contributor Author

panda01 commented Apr 15, 2016

@rashidkpc gave me a bit of help along the way. Not a fan of all the extra stuff in that pull though.

write: function (aggConfig, output) {
output.params.precision = getPrecision(aggConfig.params.precision);
let currZoom = null;
if (aggConfig.params.mapZoom || aggConfig.vis.hasUiState()) { // First iteration
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a fan of all of this aggconfig.params business, this IMO be removable

@panda01 panda01 changed the title Fix/map zoom[WIP] Fix/map zoom Apr 25, 2016
@panda01 panda01 added the review label Apr 25, 2016
@panda01 panda01 self-assigned this Apr 25, 2016
@panda01 panda01 force-pushed the fix/map-zoom branch 4 times, most recently from 0700a49 to bd4b5c6 Compare April 25, 2016 23:18
@panda01 panda01 assigned spalger and unassigned panda01 Apr 26, 2016
@spalger spalger removed their assignment Apr 28, 2016
@panda01
Copy link
Contributor Author

panda01 commented May 12, 2016

I have addressed the aforementioned issues, and simplified this a bit.

@w33ble
Copy link
Contributor

w33ble commented May 16, 2016

Looks good functionally, and I believe the edge case issues have all been corrected. LGTM.

@panda01 panda01 assigned panda01 and ycombinator and unassigned w33ble and panda01 May 17, 2016
@epixa epixa added v5.0.0 and removed v5.0.0-beta1 labels May 18, 2016
}
mapMoveEnd: function (event, uiState) {
uiState.set('mapCenter', event.center);
uiState.set('mapZoom', event.zoom);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure its necessary to set the mapZoom here. Just setting the mapCenter should be sufficient when moving the map, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it was because during the auto fit it didn't call the zoom function, but after testing it seems I'm mistaken. I'll take it out.

@ycombinator ycombinator assigned panda01 and unassigned ycombinator May 26, 2016
@ycombinator
Copy link
Contributor

Looks good functionally. Just left one minor comment on the code: https://github.com/elastic/kibana/pull/6835/files#r64831202.

@panda01
Copy link
Contributor Author

panda01 commented May 27, 2016

@ycombinator I addressed your concerns. If you could give me the final acronym of approval I'll go ahead and merge.

@panda01 panda01 assigned ycombinator and unassigned panda01 May 27, 2016
@ycombinator
Copy link
Contributor

LGTM.

@ycombinator ycombinator assigned panda01 and unassigned ycombinator May 27, 2016
@panda01 panda01 merged commit 00d01cf into elastic:master May 27, 2016
@epixa epixa added v5.0.0 and removed v5.0.0 labels Jun 28, 2016
Bargs added a commit to Bargs/kibana that referenced this pull request Jul 21, 2016
The ability to create filters by clicking on visualizations was broken
between 5.0 alpha3 and alpha4. The root cause was the addition of a new
parameter being sent to all visualization event handlers, which was
added to support persistence of tilemap position and zoom level. The
filter_bar_click_handler (which enables the vis filtering behavior)
already expected a different kind of second parameter, so the addition
of this new parameter threw off the click handler's internal logic.

It turns out that the new parameter is unnecessary, because the object
it's passing is already available on the event object. So to fix this,
I removed the new parameter from the emitter and updated the tilemap
handlers to grab the object off of the event.

Fixes: elastic#7501
Related: elastic#6835 (added the new
param)
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
The ability to create filters by clicking on visualizations was broken
between 5.0 alpha3 and alpha4. The root cause was the addition of a new
parameter being sent to all visualization event handlers, which was
added to support persistence of tilemap position and zoom level. The
filter_bar_click_handler (which enables the vis filtering behavior)
already expected a different kind of second parameter, so the addition
of this new parameter threw off the click handler's internal logic.

It turns out that the new parameter is unnecessary, because the object
it's passing is already available on the event object. So to fix this,
I removed the new parameter from the emitter and updated the tilemap
handlers to grab the object off of the event.

Fixes: elastic#7501
Related: elastic#6835 (added the new
param)

Former-commit-id: 20cb910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map zoom persistance
7 participants