File tree 2 files changed +6
-31
lines changed 2 files changed +6
-31
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const flatten = require('flatten-vertex-data')
13
13
const ie = require ( 'is-iexplorer' )
14
14
const { float32, fract32} = require ( 'to-float32' )
15
15
const arrayRange = require ( 'array-range' )
16
+ const parseRect = require ( 'parse-rect' )
16
17
17
18
module . exports = Scatter
18
19
@@ -639,37 +640,10 @@ function Scatter (regl, options) {
639
640
} ,
640
641
641
642
viewport : vp => {
642
- let viewport
643
-
644
- if ( Array . isArray ( vp ) ) {
645
- viewport = {
646
- x : vp [ 0 ] ,
647
- y : vp [ 1 ] ,
648
- width : vp [ 2 ] - vp [ 0 ] ,
649
- height : vp [ 3 ] - vp [ 1 ]
650
- }
651
- }
652
- else if ( vp ) {
653
- viewport = {
654
- x : vp . x || vp . left || 0 ,
655
- y : vp . y || vp . top || 0
656
- }
657
-
658
- if ( vp . right ) viewport . width = vp . right - viewport . x
659
- else viewport . width = vp . w || vp . width || 0
660
-
661
- if ( vp . bottom ) viewport . height = vp . bottom - viewport . y
662
- else viewport . height = vp . h || vp . height || 0
663
- }
664
- else {
665
- viewport = {
666
- x : 0 , y : 0 ,
667
- width : gl . drawingBufferWidth ,
668
- height : gl . drawingBufferHeight
669
- }
670
- }
671
-
672
- return viewport
643
+ return parseRect ( vp || [
644
+ gl . drawingBufferWidth ,
645
+ gl . drawingBufferHeight
646
+ ] )
673
647
}
674
648
} ] )
675
649
Original file line number Diff line number Diff line change 38
38
"glslify" : " ^6.1.0" ,
39
39
"is-iexplorer" : " ^1.0.0" ,
40
40
"object-assign" : " ^4.1.1" ,
41
+ "parse-rect" : " ^1.1.0" ,
41
42
"pick-by-alias" : " ^1.0.0" ,
42
43
"snap-points-2d" : " ^3.2.0" ,
43
44
"to-float32" : " ^1.0.0" ,
You can’t perform that action at this time.
0 commit comments