Skip to content

Commit 3717cbe

Browse files
committed
Rename _isFrom(Z|Source) to _has(Z|Source)
1 parent 2960e55 commit 3717cbe

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/traces/image/calc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ var Buffer = require('buffer/').Buffer; // note: the trailing slash is importan
2020
module.exports = function calc(gd, trace) {
2121
var h;
2222
var w;
23-
if(trace._isFromZ) {
23+
if(trace._hasZ) {
2424
h = trace.z.length;
2525
w = maxRowLength(trace.z);
26-
} else if(trace._isFromSource) {
26+
} else if(trace._hasSource) {
2727
var size = getImageSize(trace.source);
2828
h = size.height;
2929
w = size.width;

src/traces/image/defaults.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ module.exports = function supplyDefaults(traceIn, traceOut) {
2020
coerce('source');
2121
// sanitize source to only allow for data URI representing images
2222
if(traceOut.source && !traceOut.source.match(dataUri)) delete traceOut.source;
23-
traceOut._isFromSource = !!traceOut.source;
23+
traceOut._hasSource = !!traceOut.source;
2424

2525
var z = coerce('z');
26-
traceOut._isFromZ = !(z === undefined || !z.length || !z[0] || !z[0].length);
27-
if(!traceOut._isFromZ && !traceOut._isFromSource) {
26+
traceOut._hasZ = !(z === undefined || !z.length || !z[0] || !z[0].length);
27+
if(!traceOut._hasZ && !traceOut._hasSource) {
2828
traceOut.visible = false;
2929
return;
3030
}
@@ -34,11 +34,11 @@ module.exports = function supplyDefaults(traceIn, traceOut) {
3434
coerce('dx');
3535
coerce('dy');
3636

37-
if(traceOut._isFromZ) {
37+
if(traceOut._hasZ) {
3838
coerce('colormodel');
3939
coerce('zmin', constants.colormodel[traceOut.colormodel].min);
4040
coerce('zmax', constants.colormodel[traceOut.colormodel].max);
41-
} else if(traceOut._isFromSource) {
41+
} else if(traceOut._hasSource) {
4242
traceOut.colormodel = 'rgba';
4343
traceOut.zmin = constants.colormodel[traceOut.colormodel].min;
4444
traceOut.zmax = constants.colormodel[traceOut.colormodel].max;

src/traces/image/hover.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module.exports = function hoverPoints(pointData, xval, yval) {
2929
var ny = Math.floor(Math.abs(yval - cd0.y0) / trace.dy);
3030

3131
var pixel;
32-
if(trace._isFromZ) {
32+
if(trace._hasZ) {
3333
pixel = cd0.z[ny][nx];
34-
} else if(trace._isFromSource) {
34+
} else if(trace._hasSource) {
3535
pixel = trace._canvas.el.getContext('2d').getImageData(nx, ny, 1, 1).data;
3636
}
3737

src/traces/image/plot.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) {
3131
var plotGroup = d3.select(this);
3232
var cd0 = cd[0];
3333
var trace = cd0.trace;
34-
var fastImage = supportsPixelatedImage && trace._isFromSource && compatibleAxis(xa) && compatibleAxis(ya);
34+
var fastImage = supportsPixelatedImage && trace._hasSource && compatibleAxis(xa) && compatibleAxis(ya);
3535
trace._fastImage = fastImage;
3636

3737
var z = cd0.z;
@@ -147,9 +147,9 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) {
147147
.attr('style', 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;');
148148

149149
var p = new Promise(function(resolve) {
150-
if(trace._isFromZ) {
150+
if(trace._hasZ) {
151151
resolve();
152-
} else if(trace._isFromSource) {
152+
} else if(trace._hasSource) {
153153
// Check if canvas already exists and has the right data
154154
if(
155155
trace._canvas &&
@@ -185,9 +185,9 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) {
185185
href = trace.source;
186186
} else {
187187
var canvas;
188-
if(trace._isFromZ) {
188+
if(trace._hasZ) {
189189
canvas = drawMagnifiedPixelsOnCanvas(function(i, j) {return z[j][i];});
190-
} else if(trace._isFromSource) {
190+
} else if(trace._hasSource) {
191191
var context = trace._canvas.el.getContext('2d');
192192
var data = context.getImageData(0, 0, w, h).data;
193193
canvas = drawMagnifiedPixelsOnCanvas(function(i, j) {

0 commit comments

Comments
 (0)