-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add WIP map view #536
base: add-map-view
Are you sure you want to change the base?
Add WIP map view #536
Conversation
…to add-map-view Merging latest taxonium master branch into add-map-view
…to add-map-view
for more information, see https://pre-commit.ci
Someone is attempting to deploy a commit to a Personal Account owned by @theosanderson on Vercel. @theosanderson first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
taxonium_web_client/package.json
Outdated
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 file didn't previously exist - looks like a merge issue and any changes should go to taxonium_component?
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.
Looks like it, I'll go ahead and remove the taxonium_web_client
folder from this PR.
Thank you for opening this! Adding comments piecemeal |
package-lock.json
Outdated
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.
We use yarn for taxonium - I think that means we can lose this file but let me know if there's a reason it's useful, I'm no expert
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.
Will remove! I'm used to NPM based projects, so this was just a force of habit.
taxonium_component/src/Deck.jsx
Outdated
<View id="map"> | ||
<div | ||
id="map-div" | ||
key={crypto.randomUUID()} |
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.
Is this unique key each time important? (I assume so but just checking)
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.
Usually I err on the side of including an id
so that React can more efficiently calculate rerenders. I believe this specific case was added because a warning in the console, so it seems like React was struggling to update Views
.
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.
Ah, the re-render thing was my concern here. My model for what will happen for the code here is that every render the key will be different and so React will not be able to see that there is a (potentially) unchanging element here. I would be happy with key="map-div-key"
or similar. Again, I don't claim to be an expert and may be misunderstanding.
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're totally right here, so I just swapped out the crypto.uuid
with the "map-div-key"
string. Thanks!
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.
We seem to have ended up with the zoom controls repeated 2x, once on the map and once on the tree. (I'd say they are better just on the tree).
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.
Is there a usecase where zooming into the map would be helpful? I was assuming that users may want to zoom into part of the map to view pie charts in only certain regions (eventually), but maybe you had a different idea here. Would the map view be fully zoomed out by default if we remove the zoom functionality?
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.
Yes, there might be use cases where zooming would be useful - but atm the buttons on the map affect the tree so this is not achieved. I don't see a strong need for zoom buttons for the map -- as opposed to panning and scrolling -- we need them for the tree due to separate X and Y zooms.
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.
When I click and drag on the minimap a the top right of the tree (regardless of geo-map enabled or not) the preview crashes with Cannot read properties of undefined (reading 'zoom')
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 I have an idea of a fix here, but may take a few days. Will update!
@@ -540,6 +545,49 @@ const useLayers = ({ | |||
layers.push(minimap_line_horiz, minimap_line_vert, minimap_scatter); | |||
layers.push(minimap_bound_polygon); | |||
|
|||
let countryCounts = {}; |
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.
It's not clear to me that we will end up using much of this logic other than the layers.push bit. E.g. the max
and min
aren't used at present. I would probably suggest removing the color piece as it may never be used and leaving all countries coloured the same for now.
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.
Removed the color code for now.
@@ -566,6 +615,7 @@ const useLayers = ({ | |||
return new ScatterplotLayer(layer); | |||
} | |||
if (layer.layerType === "LineLayer") { | |||
console.log('processed ', layer); |
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.
to remove in due course
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.
Removed
@theosanderson Sorry for the delay here! Been a busy few months :) I've looked more deeply into the minimap issues and I believe it has to do with the refactor I did for getting different views to update using The above seems to have fixed the crash when dragging on the minimap. However, I believe the dragging behavior is still a little buggy, and I wanted to know if you had any input on the changes I made to fix the crash. I think we might be pretty close to a working minimap again, but I'm getting stumped by the current zoom code (mostly the role of Again, really appreciate your help here! |
Thanks for all your efforts @simonbukin. It's great that the crashing is fixed, but you're right that the behaviour is still buggy as compared to the intended behaviour. The intended behaviour, as currently on Cov2Tree is:
I acknowledge that the view code is hard work to understand (for me). There has been a lot of trial and error to get it to behave in the intended way.
When
But we want to manually call
specialMinimap which basically overrides the disabling in the case of mouseDownIsMinimap and manually call it with specialMinimap . The scale stuff is fundamentally about the fact that DeckGL doesn't support zooming in a single axis in a good way, and has been adjusted by trial and error to compensate for that.
|
(while we're on the minimap - I think it needs to either be overlaid over the tree rather than the map when the map is open, or just disabled in that case) |
Also, if I enable treenome browser mode (not map) and zoom in on the tree, the preview crashes with https://legacy.reactjs.org/docs/error-decoder.html/?invariant=185 |
(closing/opening was just a hit-wrong-button thing!) |
Thanks for the detail here! I'll take a crack at making it work to spec. I think emulating the empty I'll take a look at the Treenome crashing issue; I have a feeling I know what's breaking it. I'm going to go ahead and disable the minimap when the map is open as a fix for now, but I believe it can be added back later and overlaid on the tree. Thanks again! |
This is a PR to add the WIP map view to Taxonium.
Next steps: