vega
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "vega", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Vega Runtime", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -413,5 +413,5 @@ vg.canvas.marks = (function() { | ||
var items = scene.items, subscene, group, hit, dx, dy, | ||
handler = this; | ||
handler = this, i, j; | ||
for (var i=0, len=items.length; i<len; ++i) { | ||
for (i=items.length; --i>=0;) { | ||
group = items[i]; | ||
@@ -423,3 +423,3 @@ dx = group.x || 0; | ||
g.translate(dx, dy); | ||
for (var j=0, llen=group.items.length; j<llen; ++j) { | ||
for (j=group.items.length; --j >= 0;) { | ||
subscene = group.items[j]; | ||
@@ -426,0 +426,0 @@ if (subscene.interactive === false) continue; |
@@ -193,3 +193,3 @@ vg.canvas.Renderer = (function() { | ||
scene = renderer._scene, | ||
image = null; | ||
image = null, url; | ||
@@ -207,4 +207,5 @@ renderer._imgload += 1; | ||
image = new Image(); | ||
url = vg.config.baseURL + uri; | ||
image.onload = function() { | ||
vg.log("LOAD IMAGE: "+uri); | ||
vg.log("LOAD IMAGE: "+url); | ||
image.loaded = true; | ||
@@ -214,3 +215,3 @@ renderer._imgload -= 1; | ||
}; | ||
image.src = uri; | ||
image.src = url; | ||
} | ||
@@ -217,0 +218,0 @@ |
vg = (function(d3, topojson) { // take d3 & topojson as imports | ||
var vg = { | ||
version: "1.3.1", // semantic versioning | ||
version: "1.3.2", // semantic versioning | ||
d3: d3, // stash d3 for use in property functions | ||
topojson: topojson // stash topojson similarly | ||
}; |
vg.data.load = function(uri, callback) { | ||
var url = vg_load_hasProtocol(uri) ? uri : vg.config.baseURL + uri; | ||
if (vg.config.isNode) { | ||
// in node.js, consult base url and select file or http | ||
var url = vg_load_hasProtocol(uri) ? uri : vg.config.baseURL + uri, | ||
get = vg_load_isFile(url) ? vg_load_file : vg_load_http; | ||
// in node.js, consult url and select file or http | ||
var get = vg_load_isFile(url) ? vg_load_file : vg_load_http; | ||
get(url, callback); | ||
} else { | ||
// in browser, use xhr | ||
vg_load_xhr(uri, callback); | ||
vg_load_xhr(url, callback); | ||
} | ||
@@ -11,0 +11,0 @@ }; |
@@ -17,2 +17,5 @@ vg.data.stack = function() { | ||
var series = stacks(data); | ||
if (series.length === 0) return data; | ||
layout.out(function(d, y0, y) { | ||
@@ -24,3 +27,3 @@ if (d.datum) { | ||
} | ||
})(stacks(data)); | ||
})(series); | ||
@@ -35,2 +38,5 @@ return data; | ||
// exit early if no data | ||
if (values.length === 0) return series; | ||
// collect and sort data points | ||
@@ -37,0 +43,0 @@ for (i=0, n=values.length; i<n; ++i) { |
@@ -16,19 +16,19 @@ vg.parse.properties = (function() { | ||
if (vars.x2 && !(vars.width && vars.x)) { | ||
if (vars.width) { | ||
code += "\n o.x = (o.x2 - o.width);"; | ||
} else if (vars.x) { | ||
if (vars.x2) { | ||
if (vars.x) { | ||
code += "\n if (o.x > o.x2) { " | ||
+ "var t = o.x; o.x = o.x2; o.x2 = t; };"; | ||
code += "\n o.width = (o.x2 - o.x);"; | ||
} | ||
} else if (vars.width && !vars.x1) { | ||
code += "\n o.x = (o.x2 - o.width);"; | ||
} | ||
} | ||
if (vars.y2 && !(vars.height && vars.y)) { | ||
if (vars.height) { | ||
code += "\n o.y = (o.y2 - o.height);"; | ||
} else if (vars.y) { | ||
if (vars.y2) { | ||
if (vars.y) { | ||
code += "\n if (o.y > o.y2) { " | ||
+ "var t = o.y; o.y = o.y2; o.y2 = t; };"; | ||
code += "\n o.height = (o.y2 - o.y);"; | ||
} else if (vars.height && !vars.y1) { | ||
code += "\n o.y = (o.y2 - o.height);"; | ||
} | ||
@@ -35,0 +35,0 @@ } |
@@ -103,4 +103,4 @@ vg.scene.bounds = (function() { | ||
var angles = [sa, ea], | ||
s = sa - (sa%halfpi) + halfpi; | ||
for (var i=0; i<4 && s<ea; ++i, s+=halfpi) { | ||
s = sa - (sa%halfpi); | ||
for (i=0; i<4 && s<ea; ++i, s+=halfpi) { | ||
angles.push(s); | ||
@@ -107,0 +107,0 @@ } |
@@ -121,5 +121,6 @@ vg.svg.marks = (function() { | ||
y = o.y - (o.baseline === "middle" | ||
? h/2 : (o.baseline === "bottom" ? h : 0)); | ||
? h/2 : (o.baseline === "bottom" ? h : 0)), | ||
url = vg.config.baseURL + o.url; | ||
this.setAttributeNS("http://www.w3.org/1999/xlink", "href", o.url); | ||
this.setAttributeNS("http://www.w3.org/1999/xlink", "href", url); | ||
this.setAttribute("x", x); | ||
@@ -126,0 +127,0 @@ this.setAttribute("y", y); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
495265
12441