Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8835add

Browse files
authored
fix missing cursor for ternary plot
1 parent 7b8e80c commit 8835add

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/plots/ternary/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
var d3 = require('@plotly/d3');
4+
35
var Ternary = require('./ternary');
46

57
var getSubplotCalcData = require('../../plots/get_data').getSubplotCalcData;
@@ -75,3 +77,16 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
7577
}
7678
}
7779
};
80+
81+
exports.updateFx = function(gd) {
82+
var fullLayout = gd._fullLayout;
83+
var dragmode = fullLayout.dragmode;
84+
var toplevel = d3.select(gd).selectAll('g.toplevel');
85+
86+
// set proper cursor
87+
if(dragmode === 'pan') {
88+
toplevel.style('cursor', 'move');
89+
} else {
90+
toplevel.style('cursor', 'crosshair');
91+
}
92+
};

src/plots/ternary/ternary.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ proto.plot = function(ternaryCalcData, fullLayout) {
6767

6868
_this.updateLayers(ternaryLayout);
6969
_this.adjustLayout(ternaryLayout, graphSize);
70+
_this.updateFx(fullLayout.dragmode);
7071
Plots.generalUpdatePerTraceModule(_this.graphDiv, _this, ternaryCalcData, ternaryLayout);
7172
_this.layers.plotbg.select('path').call(Color.fill, ternaryLayout.bgcolor);
7273
};
@@ -97,6 +98,17 @@ proto.makeFramework = function(fullLayout) {
9798
Drawing.setClipUrl(_this.layers.grids, clipId, gd);
9899
};
99100

101+
proto.updateFx = function(dragmode) {
102+
var toplevel = this.plotContainer.selectAll('g.toplevel');
103+
104+
// set proper cursor
105+
if(dragmode === 'pan') {
106+
toplevel.style('cursor', 'move');
107+
} else {
108+
toplevel.style('cursor', 'crosshair');
109+
}
110+
};
111+
100112
proto.updateLayers = function(ternaryLayout) {
101113
var _this = this;
102114
var layers = _this.layers;

0 commit comments

Comments
 (0)