@@ -13,6 +13,7 @@ var createRegl = require('regl');
1313var Registry = require ( '../../registry' ) ;
1414var getModuleCalcData = require ( '../../plots/get_data' ) . getModuleCalcData ;
1515var Cartesian = require ( '../../plots/cartesian' ) ;
16+ var AxisIDs = require ( '../../plots/cartesian/axis_ids' ) ;
1617
1718var SPLOM = 'splom' ;
1819
@@ -45,6 +46,30 @@ function plot(gd) {
4546 _module . plot ( gd , { } , splomCalcData ) ;
4647}
4748
49+ function drag ( gd ) {
50+ var cd = gd . calcdata ;
51+
52+ for ( var i = 0 ; i < cd . length ; i ++ ) {
53+ var cd0 = cd [ i ] [ 0 ] ;
54+ var trace = cd0 . trace ;
55+ var scene = cd0 . t . _scene ;
56+
57+ if ( trace . type === 'splom' && scene && scene . matrix ) {
58+ var dimLength = trace . dimensions . length ;
59+ var ranges = new Array ( dimLength ) ;
60+
61+ for ( var j = 0 ; j < dimLength ; j ++ ) {
62+ var xrng = AxisIDs . getFromId ( gd , trace . xaxes [ j ] ) . range ;
63+ var yrng = AxisIDs . getFromId ( gd , trace . yaxes [ j ] ) . range ;
64+ ranges [ j ] = [ xrng [ 0 ] , yrng [ 0 ] , xrng [ 1 ] , yrng [ 1 ] ] ;
65+ }
66+
67+ scene . matrix . update ( { ranges : ranges } ) ;
68+ scene . matrix . draw ( ) ;
69+ }
70+ }
71+ }
72+
4873function clean ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
4974 // TODO clear regl-splom instances
5075 // TODO clear regl-line2d grid instance!
@@ -59,6 +84,7 @@ module.exports = {
5984 supplyLayoutDefaults : Cartesian . supplyLayoutDefaults ,
6085 drawFramework : Cartesian . drawFramework ,
6186 plot : plot ,
87+ drag : drag ,
6288 clean : clean ,
6389 toSVG : Cartesian . toSVG
6490} ;
0 commit comments