-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
regl-scatter2d #1869
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
regl-scatter2d #1869
Changes from 50 commits
bb939a4
f054bc6
eb3b122
5738dd9
5cdb90b
76f1d07
a0d1e52
18127d7
f8a4c3f
08b854e
eb1b1c0
34de32d
033f9b6
4c4df5e
c245aa5
f8f8af4
9d73b00
4c7e321
f85e8b5
a9e314c
c30c1b4
79022cd
125cca1
41c294d
6290a83
63af430
943a743
7858201
4d17a53
314dfdc
aefdab1
58ff5a3
dd82961
8915392
368fe44
4710c12
6ebd70c
8546576
7ed4484
c399fd9
0454d64
9b73d70
dbc23e5
fc36ed8
03f79dc
97a6a58
701ea44
6ec58d3
7105b44
45a0247
e3af57f
5266429
176d260
f66894a
6b0acab
3b29829
1da9062
753b3f0
bd667be
791211c
56949e6
deefccd
9039439
14063c9
7fec259
c7bf83c
26998d7
f6480ad
e7416cd
8ae1d94
fce4cff
f0c42e0
5ce9afc
ea3eb4e
2a59bbf
dbafeb3
cb1b553
c22d688
2309d8e
748cff8
c63d09e
2db2e1f
3d4a3f1
b9d6538
b870e7b
ef6cfc4
e62ebb5
6525be1
ebb0cac
fbaed64
ef279e2
8e1beb7
8b81ba1
ae6ebd3
f02f0ee
30bb703
3126005
530efee
f219206
ea123a6
cc0fd0a
e36b0a1
fb37ffc
be571af
fe9935d
b5c09c3
88e2014
78d3372
76c9fa9
78dcde9
289e2c9
5a9adf5
cb355dd
bedcdfa
3e826eb
18b9337
3d924b1
218cb83
40e72f3
97ff741
b915f4d
3c894fe
4156d83
4d478e5
e50b4a4
0f71572
5425531
a91530c
328af5f
41be06f
a399671
a573fdf
a053c26
160871e
850595e
02fac50
25fd2e4
3b7bbc2
9039ca3
7197b1f
8aaed6c
4d7c4ce
a0917c7
70e4427
9763096
8b9652e
9457ac5
fd6db00
689f262
c556a85
23b364c
9cfe84a
8334e7d
ffe3720
3dd25c7
79955f6
ba75823
a02ed20
9bd0e94
7183ba0
90ce575
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright 2012-2017, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = require('../src/traces/scatterregl'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ | |
"width": 1500 | ||
}, | ||
"search": [ | ||
"tooltip_basic" | ||
"tooltip_basic" | ||
] | ||
}, | ||
{ | ||
|
@@ -1513,4 +1513,4 @@ | |
"src": "fontawesome" | ||
} | ||
] | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noise. Please undo formatting changes like this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @etpinard not me, sublime text fixes absence of new line at the end for me. It is going to be tricky to look up for such bits There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you just commit files that you modified on-purpose? This will make my life a lot easier. Thank you. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,6 +194,30 @@ Plotly.plot = function(gd, data, layout, config) { | |
} | ||
} | ||
|
||
fullLayout._glcanvas = fullLayout._glcontainer.selectAll('.gl-canvas').data(fullLayout._hasCategory('gl') ? [{ | ||
key: 'contextLayer' | ||
}, { | ||
key: 'focusLayer' | ||
}, { | ||
key: 'pickLayer' | ||
}] : []); | ||
|
||
fullLayout._glcanvas.enter().append('canvas') | ||
.attr('class', function(d) { | ||
return 'gl-canvas gl-canvas-' + d.key.replace('Layer', ''); | ||
}) | ||
.style('position', 'absolute') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be better as: .style({
position: 'absolute',
top: 0,
left: 0,
// ... and so on
}) |
||
.style('top', 0) | ||
.style('left', 0) | ||
.style('width', '100%') | ||
.style('height', '100%') | ||
.style('pointer-events', 'none') | ||
.style('overflow', 'visible') | ||
.attr('width', fullLayout.width) | ||
.attr('height', fullLayout.height); | ||
|
||
fullLayout._glcanvas.exit().remove(); | ||
|
||
return Lib.syncOrAsync([ | ||
subroutines.layoutStyles | ||
], gd); | ||
|
@@ -3027,10 +3051,14 @@ function makePlotFramework(gd) { | |
// TODO: sort out all the ordering so we don't have to | ||
// explicitly delete anything | ||
fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container') | ||
.data([0]); | ||
.data([{}]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We reuse this object later in parcoord as container for data. |
||
|
||
fullLayout._glcontainer.enter().append('div') | ||
.classed('gl-container', true); | ||
|
||
// That is initialized in drawFramework if there are `gl` traces | ||
fullLayout._glcanvas = null; | ||
|
||
fullLayout._paperdiv.selectAll('.main-svg').remove(); | ||
|
||
fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,7 @@ proto.makeFramework = function() { | |
this.gl = STATIC_CONTEXT; | ||
} | ||
else { | ||
var liveCanvas = document.createElement('canvas'); | ||
var liveCanvas = this.container.querySelector('.gl-canvas-focus'); | ||
|
||
var gl = getContext({ | ||
canvas: liveCanvas, | ||
|
@@ -139,7 +139,7 @@ proto.makeFramework = function() { | |
// disabling user select on the canvas | ||
// sanitizes double-clicks interactions | ||
// ref: https://github.com/plotly/plotly.js/issues/744 | ||
canvas.className += 'user-select-none'; | ||
canvas.className += ' user-select-none'; | ||
|
||
// create SVG container for hover text | ||
var svgContainer = this.svgContainer = document.createElementNS( | ||
|
@@ -158,7 +158,6 @@ proto.makeFramework = function() { | |
|
||
// append canvas, hover svg and mouse div to container | ||
var container = this.container; | ||
container.appendChild(canvas); | ||
container.appendChild(svgContainer); | ||
container.appendChild(mouseContainer); | ||
|
||
|
@@ -369,7 +368,6 @@ proto.destroy = function() { | |
|
||
this.glplot.dispose(); | ||
|
||
if(!this.staticPlot) this.container.removeChild(this.canvas); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you 🔪 this? |
||
this.container.removeChild(this.svgContainer); | ||
this.container.removeChild(this.mouseContainer); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -458,6 +458,7 @@ plots.supplyDefaults = function(gd) { | |
|
||
// attach helper method to check whether a plot type is present on graph | ||
newFullLayout._has = plots._hasPlotType.bind(newFullLayout); | ||
newFullLayout._hasCategory = plots._hasCategory.bind(newFullLayout); | ||
|
||
// special cases that introduce interactions between traces | ||
var _modules = newFullLayout._modules; | ||
|
@@ -576,6 +577,21 @@ plots._hasPlotType = function(category) { | |
return false; | ||
}; | ||
|
||
// check whether trace has a category | ||
plots._hasCategory = function(category) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should merge this with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Although there are possibly some side-effects, needs checking. |
||
var modules = this._modules || []; | ||
|
||
// create canvases only in case if there is at least one regl component | ||
for(var i = 0; i < modules.length; i++) { | ||
var _ = modules[i]; | ||
if(_.categories && _.categories.indexOf(category) >= 0) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
}; | ||
|
||
plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { | ||
var i, j; | ||
|
||
|
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.
regl-line2d
anddprop
are missing.