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

Canvas renderer for large images #1319

Merged
merged 3 commits into from
Dec 22, 2022
Merged

Canvas renderer for large images #1319

merged 3 commits into from
Dec 22, 2022

Conversation

BryonLewis
Copy link
Collaborator

Swaps the geoJS renderer from Webgl to Canvas when the image size exceeds 8192 (8k) in any dimension.
WebGL has a maximum texture size and this will allow larger images to be displayed in the renderer.

Copy link
Member

@waxlamp waxlamp left a comment

Choose a reason for hiding this comment

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

I think I found a bug... and I have one style suggestion. Let me know what you think.

features: ['quad'],
autoshareRenderer: false,
});
renderer: 'canvas',
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this say webgl here?

If yes, then I'd also recommend creating a boolean value (bigImage or something like that) and using a ternary conditional expression right in the renderer entry definition. This would avoid defining a default and then mutating it on (slightly) complex logic -- I think that would make the code more legible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, by default it didn't have a renderer and would default to webGL. I added in the default value and forgot to remove it.

I've updated to your suggestion, the formatting is caused by the annoying line length limit.

Copy link
Member

@waxlamp waxlamp left a comment

Choose a reason for hiding this comment

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

The only other thing I notice now is that you don't need the params variable any longer--you can supply that object literal to geoViewer.value.createLayer() directly.

@BryonLewis BryonLewis merged commit 0a5cf15 into main Dec 22, 2022
@BryonLewis BryonLewis deleted the desktop-large branch December 22, 2022 18:20
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.

None yet

2 participants