Commit 35ac9dd9 authored by Mike Bostock's avatar Mike Bostock
Browse files

Merge branch '3.0.6'

parents 183060d4 a7164684
......@@ -27,10 +27,10 @@ all: \
src/end.js
d3.core.js: \
src/core/core.js \
src/core/format-$(LOCALE).js \
src/compat/date.js \
src/compat/style.js \
src/core/core.js \
src/core/class.js \
src/core/array.js \
src/core/map.js \
......
{
"name": "d3",
"version": "3.0.5",
"version": "3.0.6",
"main": "./d3.js"
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
var document = global.document = require("jsdom").jsdom("<html><head></head><body></body></html>"),
window = global.window = document.createWindow(),
navigator = global.navigator = window.navigator,
getComputedStyle = global.getComputedStyle = window.getComputedStyle,
CSSStyleDeclaration = global.CSSStyleDeclaration = window.CSSStyleDeclaration;
window = global.window = document.createWindow();
// https://github.com/chad3814/CSSStyleDeclaration/issues/3
var CSSStyleDeclaration_setProperty = CSSStyleDeclaration.prototype.setProperty;
CSSStyleDeclaration.prototype.setProperty = function(name, value, priority) {
var CSSStyleDeclaration_prototype = window.CSSStyleDeclaration.prototype,
CSSStyleDeclaration_setProperty = CSSStyleDeclaration_prototype.setProperty;
CSSStyleDeclaration_prototype.setProperty = function(name, value, priority) {
return CSSStyleDeclaration_setProperty.call(this, name + "", value == null ? null : value + "", priority == null ? null : priority + "");
};
var globals = ["document", "window", "navigator", "CSSStyleDeclaration", "getComputedStyle", "d3"],
var globals = ["document", "window", "d3"],
globalValues = {};
globals.forEach(function(g) {
......
{
"name": "d3",
"version": "3.0.5",
"version": "3.0.6",
"description": "A small, free JavaScript library for manipulating documents based on data.",
"keywords": [
"dom",
......
......@@ -16,7 +16,7 @@ d3.behavior.drag = function() {
origin_ = point(),
moved = 0;
var w = d3.select(window)
var w = d3.select(d3_window)
.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove)
.on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
......
......@@ -12,11 +12,9 @@ d3.behavior.zoom = function() {
touchtime; // time of last touchstart (to detect double-tap)
function zoom() {
this
.on("mousedown.zoom", mousedown)
.on("mousewheel.zoom", mousewheel)
this.on("mousedown.zoom", mousedown)
.on("mousemove.zoom", mousemove)
.on("DOMMouseScroll.zoom", mousewheel)
.on(d3_behavior_zoomWheel + ".zoom", mousewheel)
.on("dblclick.zoom", dblclick)
.on("touchstart.zoom", touchstart)
.on("touchmove.zoom", touchmove)
......@@ -95,10 +93,10 @@ d3.behavior.zoom = function() {
event_ = event.of(target, arguments),
eventTarget = d3.event.target,
moved = 0,
w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup),
w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup),
l = location(d3.mouse(target));
window.focus();
d3_window.focus();
d3_eventCancel();
function mousemove() {
......@@ -175,34 +173,10 @@ d3.behavior.zoom = function() {
return d3.rebind(zoom, event, "on");
};
var d3_behavior_zoomDiv, // for interpreting mousewheel events
d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent
function d3_behavior_zoomDelta() {
// mousewheel events are totally broken!
// https://bugs.webkit.org/show_bug.cgi?id=40441
// not only that, but Chrome and Safari differ in re. to acceleration!
if (!d3_behavior_zoomDiv) {
d3_behavior_zoomDiv = d3.select("body").append("div")
.style("visibility", "hidden")
.style("top", 0)
.style("height", 0)
.style("width", 0)
.style("overflow-y", "scroll")
.append("div")
.style("height", "2000px")
.node().parentNode;
}
var e = d3.event, delta;
try {
d3_behavior_zoomDiv.scrollTop = 1000;
d3_behavior_zoomDiv.dispatchEvent(e);
delta = 1000 - d3_behavior_zoomDiv.scrollTop;
} catch (error) {
delta = e.wheelDelta || (-e.detail * 5);
}
var d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent
return delta;
}
// https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/wheel
var d3_behavior_zoomDelta, d3_behavior_zoomWheel
= "onwheel" in document ? (d3_behavior_zoomDelta = function() { return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); }, "wheel")
: "onmousewheel" in document ? (d3_behavior_zoomDelta = function() { return d3.event.wheelDelta; }, "mousewheel")
: (d3_behavior_zoomDelta = function() { return -d3.event.detail; }, "MozMousePixelScroll");
try {
document.createElement("div").style.setProperty("opacity", 0, "");
d3_document.createElement("div").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_style_prototype = CSSStyleDeclaration.prototype,
var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype,
d3_style_setProperty = d3_style_prototype.setProperty;
d3_style_prototype.setProperty = function(name, value, priority) {
d3_style_setProperty.call(this, name, value + "", priority);
......
require("./core/core");
var d3 = require("../index");
require("util").puts(JSON.stringify({
console.log(JSON.stringify({
"name": "d3",
"version": d3.version,
"main": "./d3.js"
......
......@@ -11,7 +11,7 @@ function d3_arraySlice(pseudoarray) {
}
try {
d3_array(document.documentElement.childNodes)[0].nodeType;
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
} catch(e) {
d3_array = d3_arrayCopy;
}
......
d3 = {version: "3.0.5"}; // semver
var π = Math.PI,
ε = 1e-6,
d3 = {version: "3.0.6"}, // semver
d3_radians = π / 180,
d3_degrees = 180 / π;
d3_degrees = 180 / π,
d3_document = document,
d3_window = window;
function d3_target(d) {
return d.target;
......
......@@ -95,11 +95,11 @@ var d3_format_types = d3.map({
g: function(x, p) { return x.toPrecision(p); },
e: function(x, p) { return x.toExponential(p); },
f: function(x, p) { return x.toFixed(p); },
r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
r: function(x, p) { return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); }
});
function d3_format_precision(x, p) {
return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
}
function d3_format_typeDefault(x) {
......
var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
var d3_formatPrefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
d3.formatPrefix = function(value, precision) {
var i = 0;
......
......@@ -3,7 +3,7 @@ d3.html = function(url, callback) {
};
function d3_html(request) {
var range = document.createRange();
range.selectNode(document.body);
var range = d3_document.createRange();
range.selectNode(d3_document.body);
return range.createContextualFragment(request.responseText);
}
......@@ -3,15 +3,14 @@ d3.mouse = function(container) {
};
// https://bugs.webkit.org/show_bug.cgi?id=44083
var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
function d3_mousePoint(container, e) {
var svg = container.ownerSVGElement || container;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
svg = d3.select(document.body)
.append("svg")
if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
svg = d3.select(d3_document.body).append("svg")
.style("position", "absolute")
.style("top", 0)
.style("left", 0);
......
......@@ -13,13 +13,10 @@ d3.random = {
return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
logNormal: function(µ, σ) {
var n = arguments.length;
if (n < 2) σ = 1;
if (n < 1) µ = 0;
var random = d3.random.normal();
logNormal: function() {
var random = d3.random.normal.apply(d3, arguments);
return function() {
return Math.exp(µ + σ * random());
return Math.exp(random());
};
},
irwinHall: function(m) {
......
......@@ -4,11 +4,11 @@ d3_selectionPrototype.append = function(name) {
name = d3.ns.qualify(name);
function append() {
return this.appendChild(document.createElementNS(this.namespaceURI, name));
return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
}
function appendNS() {
return this.appendChild(document.createElementNS(name.space, name.local));
return this.appendChild(d3_document.createElementNS(name.space, name.local));
}
return this.select(name.local ? appendNS : append);
......
......@@ -6,13 +6,13 @@ d3_selectionPrototype.insert = function(name, before) {
function insert() {
return this.insertBefore(
document.createElementNS(this.namespaceURI, name),
d3_document.createElementNS(this.namespaceURI, name),
d3_select(before, this));
}
function insertNS() {
return this.insertBefore(
document.createElementNS(name.space, name.local),
d3_document.createElementNS(name.space, name.local),
d3_select(before, this));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment