Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix missing cursor for ternary plot
  • Loading branch information
Lexachoc authored Jul 20, 2024
commit 8835add69c73a15dc4291433e20775059044ff02
15 changes: 15 additions & 0 deletions src/plots/ternary/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

var d3 = require('@plotly/d3');

var Ternary = require('./ternary');

var getSubplotCalcData = require('../../plots/get_data').getSubplotCalcData;
Expand Down Expand Up @@ -75,3 +77,16 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
}
}
};

exports.updateFx = function(gd) {
var fullLayout = gd._fullLayout;
var dragmode = fullLayout.dragmode;
var toplevel = d3.select(gd).selectAll('g.toplevel');

// set proper cursor
if(dragmode === 'pan') {
toplevel.style('cursor', 'move');
} else {
toplevel.style('cursor', 'crosshair');
}
};
12 changes: 12 additions & 0 deletions src/plots/ternary/ternary.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ proto.plot = function(ternaryCalcData, fullLayout) {

_this.updateLayers(ternaryLayout);
_this.adjustLayout(ternaryLayout, graphSize);
_this.updateFx(fullLayout.dragmode);
Plots.generalUpdatePerTraceModule(_this.graphDiv, _this, ternaryCalcData, ternaryLayout);
_this.layers.plotbg.select('path').call(Color.fill, ternaryLayout.bgcolor);
};
Expand Down Expand Up @@ -97,6 +98,17 @@ proto.makeFramework = function(fullLayout) {
Drawing.setClipUrl(_this.layers.grids, clipId, gd);
};

proto.updateFx = function(dragmode) {
var toplevel = this.plotContainer.selectAll('g.toplevel');

// set proper cursor
if(dragmode === 'pan') {
toplevel.style('cursor', 'move');
} else {
toplevel.style('cursor', 'crosshair');
}
};

proto.updateLayers = function(ternaryLayout) {
var _this = this;
var layers = _this.layers;
Expand Down