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

Optimize CustomMarkerClass draw Method #281

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

radiantstatic
Copy link

Context on the issue: #90 and #162

Changes:

Forced redraw is a result of the following causing significant lag while zooming:

const height = this.element.offsetHeight;
const width = this.element.offsetWidth;

Instead of getting the width and height of a given element, we can use CSS transforms to position marker based on its already calculated width. When using position: absolute; top: x, left: x - we can also assume that the item is being positioned in the bottom right corner of a given marker (thus making repositioning easier).

If we want to continue to use the offsetX and offsetY optional configuration, just add it to point.x and point.y instead.

Result:
I've only been able to test locally, but I more or less have completely removed the lag associated with zooming on 500+ CustomMarkers. Looking for someone to help me validate.

@radiantstatic radiantstatic force-pushed the update-custom-draw branch 2 times, most recently from 44cbc07 to 8b513ba Compare September 10, 2024 17:56
@radiantstatic
Copy link
Author

@HusamElbashir - Is this something you could take a look at? I know a lot of consumers of this would benefit greatly. Thanks!

@HusamElbashir
Copy link
Collaborator

Hey @radiantstatic thanks for the contribution. This definitely looks useful. Apologies though I just have so much going on at work and in my personal life atm that I didn't get a chance to look at it. Hoping to get to it soon though

@radiantstatic
Copy link
Author

@HusamElbashir - Just wanted to follow up, trying to make a decision as to whether or not to fork this project. If you have some time to review over the next few days, let me know!

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