@@ -9,9 +9,6 @@ var ndarray = require('ndarray')
9
9
var pool = require ( 'typedarray-pool' )
10
10
11
11
var SHADERS = require ( './lib/shaders' )
12
- function compareScale ( a , b ) {
13
- return b - a . pixelSize
14
- }
15
12
16
13
function GLLine2D (
17
14
plot ,
@@ -85,8 +82,6 @@ return function() {
85
82
var screenX = viewBox [ 2 ] - viewBox [ 0 ]
86
83
var screenY = viewBox [ 3 ] - viewBox [ 1 ]
87
84
88
- var pixelSize = Math . max ( dataX / screenX , dataY / screenY ) / pixelRatio
89
-
90
85
MATRIX [ 0 ] = 2.0 * boundX / dataX
91
86
MATRIX [ 4 ] = 2.0 * boundY / dataY
92
87
MATRIX [ 6 ] = 2.0 * ( bounds [ 0 ] - dataBox [ 0 ] ) / dataX - 1.0
@@ -199,21 +194,18 @@ proto.drawPick = (function() {
199
194
var bounds = this . bounds
200
195
var count = this . vertCount
201
196
202
-
203
197
var gl = plot . gl
204
198
var viewBox = plot . viewBox
205
199
var dataBox = plot . dataBox
206
- var pixelRatio = plot . pixelRatio
200
+ var pixelRatio = plot . pickPixelRatio
207
201
208
- var boundX = bounds [ 2 ] - bounds [ 0 ]
209
- var boundY = bounds [ 3 ] - bounds [ 1 ]
202
+ var boundX = bounds [ 2 ] - bounds [ 0 ]
203
+ var boundY = bounds [ 3 ] - bounds [ 1 ]
210
204
var dataX = dataBox [ 2 ] - dataBox [ 0 ]
211
205
var dataY = dataBox [ 3 ] - dataBox [ 1 ]
212
206
var screenX = viewBox [ 2 ] - viewBox [ 0 ]
213
207
var screenY = viewBox [ 3 ] - viewBox [ 1 ]
214
208
215
- var pixelSize = Math . max ( dataX / screenX , dataY / screenY ) / pixelRatio
216
-
217
209
this . pickOffset = pickOffset
218
210
219
211
MATRIX [ 0 ] = 2.0 * boundX / dataX
@@ -249,7 +241,7 @@ proto.drawPick = (function() {
249
241
250
242
gl . drawArrays ( gl . TRIANGLES , 0 , count )
251
243
252
- return pickOffset + numPoints
244
+ return pickOffset + numPoints
253
245
}
254
246
} ) ( )
255
247
@@ -333,6 +325,13 @@ proto.update = function(options) {
333
325
bounds [ 3 ] = Math . max ( bounds [ 3 ] , ay )
334
326
}
335
327
328
+ if ( bounds [ 0 ] === bounds [ 2 ] ) {
329
+ bounds [ 2 ] += 1
330
+ }
331
+ if ( bounds [ 3 ] === bounds [ 1 ] ) {
332
+ bounds [ 3 ] += 1
333
+ }
334
+
336
335
//Generate line data
337
336
var lineData = pool . mallocFloat32 ( 24 * ( numPoints - 1 ) )
338
337
var pickData = pool . mallocUint32 ( 12 * ( numPoints - 1 ) )
0 commit comments