Browse Source

fixed label disappearing bug for large axis values in graph3d (#2348)

* fixed label disappearing bug for large axis values in Graph3d
* only fixed label disappearing bug for large axis values in Graph3d
* very only fixed label disappearing bug for large axis values in Graph3d
codeClimate
Kentaro Goto 8 years ago
committed by Alexander Wunschik
parent
commit
b0c5659383
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      lib/graph3d/Graph3d.js

+ 3
- 3
lib/graph3d/Graph3d.js View File

@ -1394,7 +1394,7 @@ Graph3d.prototype._redrawAxis = function() {
var xLabel = this.xLabel; var xLabel = this.xLabel;
if (xLabel.length > 0) { if (xLabel.length > 0) {
yOffset = 0.1 / this.scale.y; yOffset = 0.1 / this.scale.y;
xText = xRange.center() / 2;
xText = (xRange.max + 3*xRange.min)/4;
yText = (armVector.x > 0) ? yRange.min - yOffset: yRange.max + yOffset; yText = (armVector.x > 0) ? yRange.min - yOffset: yRange.max + yOffset;
text = new Point3d(xText, yText, zRange.min); text = new Point3d(xText, yText, zRange.min);
this.drawAxisLabelX(ctx, text, xLabel, armAngle); this.drawAxisLabelX(ctx, text, xLabel, armAngle);
@ -1405,7 +1405,7 @@ Graph3d.prototype._redrawAxis = function() {
if (yLabel.length > 0) { if (yLabel.length > 0) {
xOffset = 0.1 / this.scale.x; xOffset = 0.1 / this.scale.x;
xText = (armVector.y > 0) ? xRange.min - xOffset : xRange.max + xOffset; xText = (armVector.y > 0) ? xRange.min - xOffset : xRange.max + xOffset;
yText = yRange.center() / 2;
yText = (yRange.max + 3*yRange.min)/4;
text = new Point3d(xText, yText, zRange.min); text = new Point3d(xText, yText, zRange.min);
this.drawAxisLabelY(ctx, text, yLabel, armAngle); this.drawAxisLabelY(ctx, text, yLabel, armAngle);
@ -1417,7 +1417,7 @@ Graph3d.prototype._redrawAxis = function() {
offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis?
xText = (armVector.x > 0) ? xRange.min : xRange.max; xText = (armVector.x > 0) ? xRange.min : xRange.max;
yText = (armVector.y < 0) ? yRange.min : yRange.max; yText = (armVector.y < 0) ? yRange.min : yRange.max;
zText = zRange.center() / 2;
zText = (zRange.max + 3*zRange.min)/4;
text = new Point3d(xText, yText, zText); text = new Point3d(xText, yText, zText);
this.drawAxisLabelZ(ctx, text, zLabel, offset); this.drawAxisLabelZ(ctx, text, zLabel, offset);

Loading…
Cancel
Save