Skip to content

Commit

Permalink
fixes #19033, Remove fix that breaks rtl indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
maier49 authored and dylans committed Aug 10, 2017
1 parent 6c8f1b2 commit 1d4bf81
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions charting/action2d/_IndicatorElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,6 @@ define(["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "../plot2d/
break;
}
}
// BIDI Support for RTL languages
if(has("dojo-bidi")){
// In RTL language like Arabic, data need to be flipped, do this by substracting it from the data length
i = l - i;
r = data[i];

if(cd[attr] > 1){
// Add mouse width (1) to use the X position of the mouse left side
cd[attr] = l - cd[attr] + 1;
if(cd[attr] > l)
cd[attr] = l-0.1;
}
}

var x, y, px, py;
if(typeof r == "number"){
Expand Down Expand Up @@ -295,12 +282,20 @@ define(["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "../plot2d/
if(has("dojo-bidi")){
_IndicatorElement.extend({
_checkXCoords: function(cp1, cp2){
if(this.chart.isRightToLeft()){
if(this.chart.isRightToLeft() && this.isDirty()){
var offset = this.chart.node.offsetLeft;
function transform(plot, cp) {
var x = cp.x - offset;
var shift = (plot.chart.offsets.l - plot.chart.offsets.r);
var transformed_x = plot.chart.dim.width + shift - x;

return transformed_x + offset;
}
if(cp1){
cp1.x = this.chart.dim.width + (this.chart.offsets.l - this.chart.offsets.r) - cp1.x;
cp1.x = transform(this, cp1);
}
if(cp2){
cp2.x = this.chart.dim.width + (this.chart.offsets.l - this.chart.offsets.r) - cp2.x;
cp2.x = transform(this, cp2);
}
}
}
Expand Down

0 comments on commit 1d4bf81

Please sign in to comment.