Skip to content

Commit 750f6de

Browse files
authored
Merge pull request #4 from gl-vis/gate-pick
Add pick gate
2 parents 455fb1c + 8243ea8 commit 750f6de

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

example/example.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ var options = {
3737
labels: ['x', 'y'],
3838
pixelRatio: +window.devicePixelRatio,
3939
tickMarkWidth: [2,2,2,2],
40-
tickMarkLength: [6,6,6,6]
40+
tickMarkLength: [6,6,6,6],
41+
// static: true
4142
}
4243

4344
var plot = createPlot(options)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"binary-search-bounds": "^2.0.3",
1616
"gl-buffer": "^2.1.2",
1717
"gl-select-static": "^2.0.2",
18-
"gl-shader": "^4.0.5",
18+
"gl-shader": "^4.2.1",
1919
"glsl-inverse": "^1.0.0",
2020
"glslify": "^2.2.1",
2121
"text-cache": "^4.0.0"

plot.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ function GLPlot2D(gl, pickBuffer) {
7676

7777
this._tickBounds = [Infinity, Infinity, -Infinity, -Infinity]
7878

79+
this.static = false
80+
7981
this.dirty = false
8082
this.pickDirty = false
8183
this.pickDelay = 120
@@ -290,6 +292,8 @@ return function() {
290292
proto.drawPick = (function() {
291293

292294
return function() {
295+
if (this.static) return;
296+
293297
var pickBuffer = this.pickBuffer
294298
var gl = this.gl
295299

@@ -308,6 +312,8 @@ return function() {
308312

309313
proto.pick = (function() {
310314
return function(x, y) {
315+
if (this.static) return;
316+
311317
var pixelRatio = this.pixelRatio
312318
var pickPixelRatio = this.pickPixelRatio
313319
var viewBox = this.viewBox
@@ -501,6 +507,8 @@ proto.update = function(options) {
501507
titleFont: options.titleFont || 'sans-serif'
502508
})
503509

510+
this.static = !!options.static;
511+
504512
this.setDirty()
505513
}
506514

0 commit comments

Comments
 (0)