Repository navigation
Conversation
Each graph with a regl trace created two WebGL contexts. In scattergl and splom graphs, the focus layer shows only the selected points. Most graphs never select, but the browser counts the second context against its limit of about 16 for each page. prepareRegl now creates the context of the focus layer on request, or if the graph has parcoords. scattergl sends the request when a selection drag mode starts, or when the first selection draw comes. The selected points appear on the focus layer as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A graph with
scatterglorsplomtraces now creates one WebGL context instead of two. The second context appears when a selection starts: a selection drag mode, or selected points. The change is not opt-in, and the pixels stay the same.Closes #
Related: plotly#6365 and plotly#2333, where pages with many graphs reach the context limit of the browser.
Live WebGL contexts of one graph with two
scattergltraces,mainagainst this branch, in headless Chromium.Each graph with a regl trace creates a context for the context layer and a context for the focus layer. In these graphs, the focus layer shows only the selected points. Most graphs never select, but the browser counts the second context. Chrome permits about 16 live contexts for each page.
Now
prepareReglcreates the context of the focus layer only on request, or if the graph has parcoords.scatterglsends the request when a selection drag mode starts or a selection draw comes. The selected points appear on the focus layer as before.AnnZarro shows many plotly.js panels on one page and needs this. Related: [umbrella issue link]. Overview: [combined draft PR link].
Changes
src/lib/prepare_regl.js: new argumentneedsFocusLayersrc/traces/scattergl/plot.js: request the focus layer for a selection drag mode or a selection drawtest/jasmine/tests/gl2d_plot_interact_test.js: 3 updated specs, 1 new specTesting
gl2d_plot_interact: 17 specs pass, andmainhas 16scattergl_select,parcoords,splom,scatterglandscatterpolarglpassmain, with drawn selectionsNotes
gd._fullLayout._glcanvas.data()[1]holds noreglpropertyplotly.min.jsgrows by 143 bytesI can reshape or withdraw this pull request. Thank you for your time.
Checklist
ready-for-prlabel, and it has no assignee or lists me as an assigneemainin my forkdist/package-lock.jsononly for a dependency changedraftlogs/as draftlogs/README.md describes, or I will add one after the pull request opens