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

Skip to content

Commit 2470532

Browse files
committed
Use strTranslate for cleaner code
1 parent 0f0ca1f commit 2470532

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/traces/image/plot.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
var d3 = require('d3');
1212
var Lib = require('../../lib');
13+
var strTranslate = Lib.strTranslate;
1314
var xmlnsNamespaces = require('../../constants/xmlns_namespaces');
1415
var constants = require('./constants');
1516

@@ -185,9 +186,9 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) {
185186
// Flip the SVG image as needed (around the proper center location)
186187
var axisScale = [(xa.range[0] < xa.range[1]) ? 1 : -1, (ya.range[0] < ya.range[1]) ? -1 : 1];
187188
var trans = '';
188-
trans += 'translate(' + (left + imageWidth / 2) + 'px,' + (top + imageHeight / 2) + 'px)';
189+
trans += strTranslate(left + imageWidth / 2 + 'px', top + imageHeight / 2 + 'px');
189190
trans += 'scale(' + axisScale[0] + ',' + axisScale[1] + ')';
190-
trans += 'translate(' + (-left - imageWidth / 2) + 'px,' + (-top - imageHeight / 2) + 'px)';
191+
trans += strTranslate(-left - imageWidth / 2 + 'px', -top - imageHeight / 2 + 'px');
191192
localStyle += 'transform:' + trans + ';';
192193
} else {
193194
var context = trace._canvas.el.getContext('2d');

0 commit comments

Comments
 (0)