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

Highlight mouseover elements (WIP) #75

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

trafficonese
Copy link
Contributor

This is a follow-up from #53 and includes #74 .

Although everything seems to work fine, I am seeing Problems in Visual Studio:

Property 'glify' does not exist on type 'typeof import("c:/../Leaflet.glify/node_modules/@types/leaflet/index")'

I also had to include import L from 'leaflet'; for lines/shapes/points, as otherwise I would have had 3 additional problems.

I am not sure why this happens or how it is done correctly. I tried different approaches without success.
Using new Lines instead of L.glify.lines fixes the problem in VS but it doesn't work and throws several webGL warnings and an error in the console:

Uncaught Error: shader variable color not found

I hope someone can shed some light on these problems.

Copy link
Owner

@robertleeplummerjr robertleeplummerjr 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 fantastic, just a little cleanup.

delete map["highlightPoints"];
}

map["highlightPoints"] = L.glify.points({

Choose a reason for hiding this comment

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

Can you just use points here, otherwise the implementer cannot overload leaflet, which is a need in some cases.

Choose a reason for hiding this comment

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

Also, can we use a different means of saving the instance of the points on the highlighted map? Otherwise, we're modifying something we don't own. My suggestion would be potentially to store it as a static value within the points class.

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 could only use glify.points when exporting glify from index.ts and using import { glify } from './index'; in points.ts.

I managed to store the highlighted points in instance.settings.highlightedPoints, but after some heavy hovering I am getting the following errors:

Exceeded 300 live WebGL contexts for this principal, losing the least recently used one. glify-browser.js:12:656
WebGL context was lost. glify-browser.js:12:656

and sometimes this one:

Uncaught TypeError: t is null
_redraw glify-browser.js:10:2040

Everything seems to still work fine in Firefox, but Chrome removes all layers from the map as soon as the WebGL error occurs. Do you have any suggestions?

Choose a reason for hiding this comment

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

It seems new instances of webgl are being created? Perhaps caching them and reusing them would fix this?

var data = Object.assign({"type":"FeatureCollection",
"features": [feature]});

map["highlightPolygon"] = L.glify.shapes({

Choose a reason for hiding this comment

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

Same idea here with using shapes, we should be able to use this more directly.

@robertleeplummerjr
Copy link
Owner

Conflicts.

@robertleeplummerjr
Copy link
Owner

Can you look at these conflicts when you get a chance?

@robertleeplummerjr
Copy link
Owner

Part of this just went into master. Still looking to add highlight.

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.

2 participants