d3_rails 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGE5ZWQ3NjdjZjg5Yzk1OTg0MDg1YTI3NDcwZDYyY2YwNWU1OThiOQ==
4
+ NTA3YWM5ZjVjY2FlYmRmYWQ1NzZmMzg5YTZkYzJjNDBmNGJjZjA2MA==
5
5
  data.tar.gz: !binary |-
6
- YmM4NjY2YzhjYjJmNTQ4NWYxYWVhM2RlNzAyMmZkODJiZjk5YWJiNg==
6
+ ZTA1N2JmN2E3YzkyM2U5ZDNkMzFjNmUwZTJmMjk5M2I4ZGI4MDE4ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzJkNmYzZWJmNDYzZDk5MDA4MTUzMjA5OGNiN2M4OWMwNGNkMjIxNDA5ZGZh
10
- YTBjMWM2NWQ1MTg1OTdmNjBhMjgyOGU1YjE2MDhkMjhlZDM4YjY1YWQyMzlj
11
- ZGNhZGNkMmM3YjY1MDgxYTU2Y2UwNDdhZjRhMjY2M2Y3MWRkY2I=
9
+ N2NjMzA5ZTY2NDNjY2FhMDJjMzkzMzhmNmQ1YTE5NmQxYWVhOWRkYjU0Mjk3
10
+ ZjFiNDlkYmYyNTY4MmVlN2NlMzkwOGYwNzlmMGQ4ZjRmNmU0ODAwNzVhMjg0
11
+ NWRjNzEzNmEwMDEwNTJiYjk1OTZiMzI4NWZkM2VhZTQ4OTdiMGI=
12
12
  data.tar.gz: !binary |-
13
- NDdhMTI4NTIyMjQxZGU3MjZhMzVjZjk0NTgxNGRiZGI5MmUzYWEzZjU5ZmMz
14
- YmE4NjA0NDNlNzZlODg5MGFlM2NmNTEwMTY0YTgwNDIxMzA1OTExZWEzYjdm
15
- MzFhODlkN2I2YWUzOTZlN2FiYzFmY2VlZDkyZTg5ZDYwNWU3YzU=
13
+ YWMwODEzNTU0MTE0MjY2ZjBjMGM1NmNmNzViMGE0YWQwMTkwNzE4ODE2ZjAw
14
+ YWZkODA0ZWM3ZDJjMGVkMjgxYmZjNzdjMDRmNTAwMTkwYTg1ZWU0ZjVmMjZk
15
+ MGRlYTNlYzYwN2Y2ZDJlZTJlMTkyNGViYThhM2I2OGQ5ZGZmYzc=
data/.gitignore CHANGED
@@ -2,4 +2,5 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
- .DS_Store
5
+ .DS_Store
6
+ lib/tasks/*.thor
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # D3_Rails
2
- ## Version 3.2.0 (of d3 in most current gem)
2
+ ## Version 3.2.1 (of d3 in most current gem)
3
3
 
4
4
  **D3_Rails** is a small, lightweight gem which allows you to include any
5
5
  and all of D3 Javascripts into your 3.1 Rails application, merely by
data/d3_rails.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "railties", ">= 3.1.0"
22
22
  s.add_development_dependency "bundler", '>= 1.0.0'
23
23
  s.add_development_dependency "rails", "~> 3.1"
24
+ s.add_development_dependency "pry"
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module D3Rails
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  d3 = function() {
2
2
  var d3 = {
3
- version: "3.2.1"
3
+ version: "3.2.2"
4
4
  };
5
5
  if (!Date.now) Date.now = function() {
6
6
  return +new Date();
@@ -357,6 +357,35 @@ d3 = function() {
357
357
  return value === source ? target : value;
358
358
  };
359
359
  }
360
+ function d3_vendorSymbol(object, name) {
361
+ if (name in object) return name;
362
+ name = name.charAt(0).toUpperCase() + name.substring(1);
363
+ for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
364
+ var prefixName = d3_vendorPrefixes[i] + name;
365
+ if (prefixName in object) return prefixName;
366
+ }
367
+ }
368
+ var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];
369
+ var d3_array = d3_arraySlice;
370
+ function d3_arrayCopy(pseudoarray) {
371
+ var i = -1, n = pseudoarray.length, array = [];
372
+ while (++i < n) array.push(pseudoarray[i]);
373
+ return array;
374
+ }
375
+ function d3_arraySlice(pseudoarray) {
376
+ return Array.prototype.slice.call(pseudoarray);
377
+ }
378
+ try {
379
+ d3_array(d3_documentElement.childNodes)[0].nodeType;
380
+ } catch (e) {
381
+ d3_array = d3_arrayCopy;
382
+ }
383
+ var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
384
+ array.__proto__ = prototype;
385
+ } : function(array, prototype) {
386
+ for (var property in prototype) array[property] = prototype[property];
387
+ };
388
+ function d3_noop() {}
360
389
  d3.dispatch = function() {
361
390
  var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
362
391
  while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
@@ -400,8 +429,7 @@ d3 = function() {
400
429
  return event;
401
430
  }
402
431
  d3.event = null;
403
- function d3_eventCancel() {
404
- d3.event.stopPropagation();
432
+ function d3_eventPreventDefault() {
405
433
  d3.event.preventDefault();
406
434
  }
407
435
  function d3_eventSource() {
@@ -409,16 +437,6 @@ d3 = function() {
409
437
  while (s = e.sourceEvent) e = s;
410
438
  return e;
411
439
  }
412
- function d3_eventSuppress(target, type) {
413
- function off() {
414
- target.on(type, null);
415
- }
416
- target.on(type, function() {
417
- d3_eventCancel();
418
- off();
419
- }, true);
420
- setTimeout(off, 0);
421
- }
422
440
  function d3_eventDispatch(target) {
423
441
  var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
424
442
  while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
@@ -436,144 +454,10 @@ d3 = function() {
436
454
  };
437
455
  return dispatch;
438
456
  }
439
- d3.mouse = function(container) {
440
- return d3_mousePoint(container, d3_eventSource());
441
- };
442
- var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
443
- function d3_mousePoint(container, e) {
444
- var svg = container.ownerSVGElement || container;
445
- if (svg.createSVGPoint) {
446
- var point = svg.createSVGPoint();
447
- if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
448
- svg = d3.select("body").append("svg").style({
449
- position: "absolute",
450
- top: 0,
451
- left: 0,
452
- margin: 0,
453
- padding: 0,
454
- border: "none"
455
- }, "important");
456
- var ctm = svg[0][0].getScreenCTM();
457
- d3_mouse_bug44083 = !(ctm.f || ctm.e);
458
- svg.remove();
459
- }
460
- if (d3_mouse_bug44083) {
461
- point.x = e.pageX;
462
- point.y = e.pageY;
463
- } else {
464
- point.x = e.clientX;
465
- point.y = e.clientY;
466
- }
467
- point = point.matrixTransform(container.getScreenCTM().inverse());
468
- return [ point.x, point.y ];
469
- }
470
- var rect = container.getBoundingClientRect();
471
- return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
472
- }
473
- var d3_array = d3_arraySlice;
474
- function d3_arrayCopy(pseudoarray) {
475
- var i = -1, n = pseudoarray.length, array = [];
476
- while (++i < n) array.push(pseudoarray[i]);
477
- return array;
478
- }
479
- function d3_arraySlice(pseudoarray) {
480
- return Array.prototype.slice.call(pseudoarray);
481
- }
482
- try {
483
- d3_array(d3_documentElement.childNodes)[0].nodeType;
484
- } catch (e) {
485
- d3_array = d3_arrayCopy;
486
- }
487
- var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
488
- array.__proto__ = prototype;
489
- } : function(array, prototype) {
490
- for (var property in prototype) array[property] = prototype[property];
491
- };
492
- d3.touches = function(container, touches) {
493
- if (arguments.length < 2) touches = d3_eventSource().touches;
494
- return touches ? d3_array(touches).map(function(touch) {
495
- var point = d3_mousePoint(container, touch);
496
- point.identifier = touch.identifier;
497
- return point;
498
- }) : [];
499
- };
500
- function d3_vendorSymbol(object, name) {
501
- if (name in object) return name;
502
- name = name.charAt(0).toUpperCase() + name.substring(1);
503
- for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
504
- var prefixName = d3_vendorPrefixes[i] + name;
505
- if (prefixName in object) return prefixName;
506
- }
507
- }
508
- var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];
509
- var d3_event_userSelectProperty = d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_userSelectSuppress = d3_event_userSelectProperty ? function() {
510
- var style = d3_documentElement.style, select = style[d3_event_userSelectProperty];
511
- style[d3_event_userSelectProperty] = "none";
512
- return function() {
513
- style[d3_event_userSelectProperty] = select;
514
- };
515
- } : function(type) {
516
- var w = d3.select(d3_window).on("selectstart." + type, d3_eventCancel);
517
- return function() {
518
- w.on("selectstart." + type, null);
519
- };
520
- };
521
- d3.behavior.drag = function() {
522
- var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
523
- function drag() {
524
- this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
525
- }
526
- function mousedown() {
527
- var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0, selectEnable = d3_event_userSelectSuppress(touchId != null ? "drag-" + touchId : "drag");
528
- 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);
529
- if (origin) {
530
- offset = origin.apply(target, arguments);
531
- offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
532
- } else {
533
- offset = [ 0, 0 ];
534
- }
535
- event_({
536
- type: "dragstart"
537
- });
538
- function point() {
539
- var p = target.parentNode;
540
- return touchId != null ? d3.touches(p).filter(function(p) {
541
- return p.identifier === touchId;
542
- })[0] : d3.mouse(p);
543
- }
544
- function dragmove() {
545
- if (!target.parentNode) return dragend();
546
- var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
547
- moved |= dx | dy;
548
- origin_ = p;
549
- d3_eventCancel();
550
- event_({
551
- type: "drag",
552
- x: p[0] + offset[0],
553
- y: p[1] + offset[1],
554
- dx: dx,
555
- dy: dy
556
- });
557
- }
558
- function dragend() {
559
- event_({
560
- type: "dragend"
561
- });
562
- if (moved) {
563
- d3_eventCancel();
564
- if (d3.event.target === eventTarget) d3_eventSuppress(w, "click");
565
- }
566
- w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
567
- selectEnable();
568
- }
569
- }
570
- drag.origin = function(x) {
571
- if (!arguments.length) return origin;
572
- origin = x;
573
- return drag;
574
- };
575
- return d3.rebind(drag, event, "on");
457
+ d3.requote = function(s) {
458
+ return s.replace(d3_requote_re, "\\$&");
576
459
  };
460
+ var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
577
461
  function d3_selection(groups) {
578
462
  d3_arraySubclass(groups, d3_selectionPrototype);
579
463
  return groups;
@@ -698,10 +582,6 @@ d3 = function() {
698
582
  function d3_collapse(s) {
699
583
  return s.trim().replace(/\s+/g, " ");
700
584
  }
701
- d3.requote = function(s) {
702
- return s.replace(d3_requote_re, "\\$&");
703
- };
704
- var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
705
585
  d3_selectionPrototype.classed = function(name, value) {
706
586
  if (arguments.length < 2) {
707
587
  if (typeof name === "string") {
@@ -973,78 +853,6 @@ d3 = function() {
973
853
  return !a - !b || comparator(a.__data__, b.__data__);
974
854
  };
975
855
  }
976
- function d3_noop() {}
977
- d3_selectionPrototype.on = function(type, listener, capture) {
978
- var n = arguments.length;
979
- if (n < 3) {
980
- if (typeof type !== "string") {
981
- if (n < 2) listener = false;
982
- for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
983
- return this;
984
- }
985
- if (n < 2) return (n = this.node()["__on" + type]) && n._;
986
- capture = false;
987
- }
988
- return this.each(d3_selection_on(type, listener, capture));
989
- };
990
- function d3_selection_on(type, listener, capture) {
991
- var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
992
- if (i > 0) type = type.substring(0, i);
993
- var filter = d3_selection_onFilters.get(type);
994
- if (filter) type = filter, wrap = d3_selection_onFilter;
995
- function onRemove() {
996
- var l = this[name];
997
- if (l) {
998
- this.removeEventListener(type, l, l.$);
999
- delete this[name];
1000
- }
1001
- }
1002
- function onAdd() {
1003
- var l = wrap(listener, d3_array(arguments));
1004
- onRemove.call(this);
1005
- this.addEventListener(type, this[name] = l, l.$ = capture);
1006
- l._ = listener;
1007
- }
1008
- function removeAll() {
1009
- var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
1010
- for (var name in this) {
1011
- if (match = name.match(re)) {
1012
- var l = this[name];
1013
- this.removeEventListener(match[1], l, l.$);
1014
- delete this[name];
1015
- }
1016
- }
1017
- }
1018
- return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
1019
- }
1020
- var d3_selection_onFilters = d3.map({
1021
- mouseenter: "mouseover",
1022
- mouseleave: "mouseout"
1023
- });
1024
- d3_selection_onFilters.forEach(function(k) {
1025
- if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
1026
- });
1027
- function d3_selection_onListener(listener, argumentz) {
1028
- return function(e) {
1029
- var o = d3.event;
1030
- d3.event = e;
1031
- argumentz[0] = this.__data__;
1032
- try {
1033
- listener.apply(this, argumentz);
1034
- } finally {
1035
- d3.event = o;
1036
- }
1037
- };
1038
- }
1039
- function d3_selection_onFilter(listener, argumentz) {
1040
- var l = d3_selection_onListener(listener, argumentz);
1041
- return function(e) {
1042
- var target = this, related = e.relatedTarget;
1043
- if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
1044
- l.call(target, e);
1045
- }
1046
- };
1047
- }
1048
856
  d3_selectionPrototype.each = function(callback) {
1049
857
  return d3_selection_each(this, function(node, i, j) {
1050
858
  callback.call(node, node.__data__, i, j);
@@ -1135,6 +943,189 @@ d3 = function() {
1135
943
  return d3_selection([ group ]);
1136
944
  };
1137
945
  var d3_selectionRoot = d3.select(d3_documentElement);
946
+ d3_selectionPrototype.on = function(type, listener, capture) {
947
+ var n = arguments.length;
948
+ if (n < 3) {
949
+ if (typeof type !== "string") {
950
+ if (n < 2) listener = false;
951
+ for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
952
+ return this;
953
+ }
954
+ if (n < 2) return (n = this.node()["__on" + type]) && n._;
955
+ capture = false;
956
+ }
957
+ return this.each(d3_selection_on(type, listener, capture));
958
+ };
959
+ function d3_selection_on(type, listener, capture) {
960
+ var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
961
+ if (i > 0) type = type.substring(0, i);
962
+ var filter = d3_selection_onFilters.get(type);
963
+ if (filter) type = filter, wrap = d3_selection_onFilter;
964
+ function onRemove() {
965
+ var l = this[name];
966
+ if (l) {
967
+ this.removeEventListener(type, l, l.$);
968
+ delete this[name];
969
+ }
970
+ }
971
+ function onAdd() {
972
+ var l = wrap(listener, d3_array(arguments));
973
+ onRemove.call(this);
974
+ this.addEventListener(type, this[name] = l, l.$ = capture);
975
+ l._ = listener;
976
+ }
977
+ function removeAll() {
978
+ var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
979
+ for (var name in this) {
980
+ if (match = name.match(re)) {
981
+ var l = this[name];
982
+ this.removeEventListener(match[1], l, l.$);
983
+ delete this[name];
984
+ }
985
+ }
986
+ }
987
+ return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
988
+ }
989
+ var d3_selection_onFilters = d3.map({
990
+ mouseenter: "mouseover",
991
+ mouseleave: "mouseout"
992
+ });
993
+ d3_selection_onFilters.forEach(function(k) {
994
+ if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
995
+ });
996
+ function d3_selection_onListener(listener, argumentz) {
997
+ return function(e) {
998
+ var o = d3.event;
999
+ d3.event = e;
1000
+ argumentz[0] = this.__data__;
1001
+ try {
1002
+ listener.apply(this, argumentz);
1003
+ } finally {
1004
+ d3.event = o;
1005
+ }
1006
+ };
1007
+ }
1008
+ function d3_selection_onFilter(listener, argumentz) {
1009
+ var l = d3_selection_onListener(listener, argumentz);
1010
+ return function(e) {
1011
+ var target = this, related = e.relatedTarget;
1012
+ if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
1013
+ l.call(target, e);
1014
+ }
1015
+ };
1016
+ }
1017
+ var d3_event_dragSelect = d3_vendorSymbol(d3_documentElement.style, "userSelect");
1018
+ function d3_event_dragSuppress(type) {
1019
+ var selectstart = "selectstart." + type, dragstart = "dragstart." + type, click = "click." + type, w = d3.select(d3_window).on(selectstart, d3_eventPreventDefault).on(dragstart, d3_eventPreventDefault), style = d3_documentElement.style, select = style[d3_event_dragSelect];
1020
+ style[d3_event_dragSelect] = "none";
1021
+ return function(suppressClick) {
1022
+ w.on(selectstart, null).on(dragstart, null);
1023
+ style[d3_event_dragSelect] = select;
1024
+ if (suppressClick) {
1025
+ function off() {
1026
+ w.on(click, null);
1027
+ }
1028
+ w.on(click, function() {
1029
+ d3_eventPreventDefault();
1030
+ off();
1031
+ }, true);
1032
+ setTimeout(off, 0);
1033
+ }
1034
+ };
1035
+ }
1036
+ d3.mouse = function(container) {
1037
+ return d3_mousePoint(container, d3_eventSource());
1038
+ };
1039
+ var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
1040
+ function d3_mousePoint(container, e) {
1041
+ var svg = container.ownerSVGElement || container;
1042
+ if (svg.createSVGPoint) {
1043
+ var point = svg.createSVGPoint();
1044
+ if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
1045
+ svg = d3.select("body").append("svg").style({
1046
+ position: "absolute",
1047
+ top: 0,
1048
+ left: 0,
1049
+ margin: 0,
1050
+ padding: 0,
1051
+ border: "none"
1052
+ }, "important");
1053
+ var ctm = svg[0][0].getScreenCTM();
1054
+ d3_mouse_bug44083 = !(ctm.f || ctm.e);
1055
+ svg.remove();
1056
+ }
1057
+ if (d3_mouse_bug44083) {
1058
+ point.x = e.pageX;
1059
+ point.y = e.pageY;
1060
+ } else {
1061
+ point.x = e.clientX;
1062
+ point.y = e.clientY;
1063
+ }
1064
+ point = point.matrixTransform(container.getScreenCTM().inverse());
1065
+ return [ point.x, point.y ];
1066
+ }
1067
+ var rect = container.getBoundingClientRect();
1068
+ return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
1069
+ }
1070
+ d3.touches = function(container, touches) {
1071
+ if (arguments.length < 2) touches = d3_eventSource().touches;
1072
+ return touches ? d3_array(touches).map(function(touch) {
1073
+ var point = d3_mousePoint(container, touch);
1074
+ point.identifier = touch.identifier;
1075
+ return point;
1076
+ }) : [];
1077
+ };
1078
+ d3.behavior.drag = function() {
1079
+ var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
1080
+ function drag() {
1081
+ this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
1082
+ }
1083
+ function mousedown() {
1084
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0, dragRestore = d3_event_dragSuppress(touchId != null ? "drag-" + touchId : "drag");
1085
+ 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);
1086
+ if (origin) {
1087
+ offset = origin.apply(target, arguments);
1088
+ offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
1089
+ } else {
1090
+ offset = [ 0, 0 ];
1091
+ }
1092
+ event_({
1093
+ type: "dragstart"
1094
+ });
1095
+ function point() {
1096
+ var p = target.parentNode;
1097
+ return touchId != null ? d3.touches(p).filter(function(p) {
1098
+ return p.identifier === touchId;
1099
+ })[0] : d3.mouse(p);
1100
+ }
1101
+ function dragmove() {
1102
+ if (!target.parentNode) return dragend();
1103
+ var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
1104
+ moved |= dx | dy;
1105
+ origin_ = p;
1106
+ event_({
1107
+ type: "drag",
1108
+ x: p[0] + offset[0],
1109
+ y: p[1] + offset[1],
1110
+ dx: dx,
1111
+ dy: dy
1112
+ });
1113
+ }
1114
+ function dragend() {
1115
+ w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
1116
+ dragRestore(moved && d3.event.target === eventTarget);
1117
+ event_({
1118
+ type: "dragend"
1119
+ });
1120
+ }
1121
+ }
1122
+ drag.origin = function(x) {
1123
+ if (!arguments.length) return origin;
1124
+ origin = x;
1125
+ return drag;
1126
+ };
1127
+ return d3.rebind(drag, event, "on");
1128
+ };
1138
1129
  d3.behavior.zoom = function() {
1139
1130
  var translate = [ 0, 0 ], translate0, scale = 1, distance0, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
1140
1131
  function zoom() {
@@ -1205,17 +1196,15 @@ d3 = function() {
1205
1196
  });
1206
1197
  }
1207
1198
  function mousedown() {
1208
- var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)), selectEnable = d3_event_userSelectSuppress("zoom");
1199
+ var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target)), dragRestore = d3_event_dragSuppress("zoom");
1209
1200
  function mousemove() {
1210
1201
  moved = 1;
1211
1202
  translateTo(d3.mouse(target), l);
1212
1203
  dispatch(event_);
1213
1204
  }
1214
1205
  function mouseup() {
1215
- if (moved) d3_eventCancel();
1216
1206
  w.on("mousemove.zoom", null).on("mouseup.zoom", null);
1217
- selectEnable();
1218
- if (moved && d3.event.target === eventTarget) d3_eventSuppress(w, "click.zoom");
1207
+ dragRestore(moved && d3.event.target === eventTarget);
1219
1208
  }
1220
1209
  }
1221
1210
  function mousewheel() {
@@ -3306,7 +3295,7 @@ d3 = function() {
3306
3295
  return stream;
3307
3296
  }
3308
3297
  function d3_geo_resample(project) {
3309
- var δ2 = .5, maxDepth = 16;
3298
+ var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;
3310
3299
  function resample(stream) {
3311
3300
  var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
3312
3301
  var resample = {
@@ -3332,9 +3321,8 @@ d3 = function() {
3332
3321
  stream.lineStart();
3333
3322
  }
3334
3323
  function linePoint(λ, φ) {
3335
- var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ), buffer = [];
3336
- resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, buffer);
3337
- streamLine(buffer, stream);
3324
+ var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
3325
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
3338
3326
  stream.point(x0, y0);
3339
3327
  }
3340
3328
  function lineEnd() {
@@ -3351,28 +3339,20 @@ d3 = function() {
3351
3339
  resample.point = linePoint;
3352
3340
  }
3353
3341
  function ringEnd() {
3354
- var buffer = [];
3355
- resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, buffer);
3356
- streamLine(buffer, stream);
3342
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
3357
3343
  resample.lineEnd = lineEnd;
3358
3344
  lineEnd();
3359
3345
  }
3360
- function streamLine(line, stream) {
3361
- for (var i = 0, n = line.length, point; i < n; ++i) {
3362
- stream.point((point = line[i])[0], point[1]);
3363
- }
3364
- }
3365
3346
  return resample;
3366
3347
  }
3367
- function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, buffer) {
3348
+ function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
3368
3349
  var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
3369
3350
  if (d2 > 4 * δ2 && depth--) {
3370
- var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2, tooFar = false;
3371
- if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || (tooFar = dx2 * dx2 + dy2 * dy2 > 256 * δ2)) {
3372
- var s0 = resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, buffer);
3373
- buffer.push(p);
3374
- var s1 = resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, buffer);
3375
- return !tooFar || s0 || s1 || (buffer.pop(), false);
3351
+ var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
3352
+ if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
3353
+ resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
3354
+ stream.point(x2, y2);
3355
+ resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
3376
3356
  }
3377
3357
  }
3378
3358
  }
@@ -7451,6 +7431,7 @@ d3 = function() {
7451
7431
  d3_transitionPrototype.call = d3_selectionPrototype.call;
7452
7432
  d3_transitionPrototype.empty = d3_selectionPrototype.empty;
7453
7433
  d3_transitionPrototype.node = d3_selectionPrototype.node;
7434
+ d3_transitionPrototype.size = d3_selectionPrototype.size;
7454
7435
  d3.transition = function(selection) {
7455
7436
  return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
7456
7437
  };
@@ -7935,8 +7916,13 @@ d3 = function() {
7935
7916
  g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
7936
7917
  }
7937
7918
  function brushstart() {
7938
- var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
7939
- var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
7919
+ var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress("brush"), center, origin = mouse(), offset;
7920
+ var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup);
7921
+ if (d3.event.changedTouches) {
7922
+ w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
7923
+ } else {
7924
+ w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
7925
+ }
7940
7926
  if (dragging) {
7941
7927
  origin[0] = extent[0][0] - origin[0];
7942
7928
  origin[1] = extent[0][1] - origin[1];
@@ -7952,7 +7938,6 @@ d3 = function() {
7952
7938
  type: "brushstart"
7953
7939
  });
7954
7940
  brushmove();
7955
- d3_eventCancel();
7956
7941
  function mouse() {
7957
7942
  var touches = d3.event.changedTouches;
7958
7943
  return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
@@ -7965,7 +7950,7 @@ d3 = function() {
7965
7950
  origin[1] -= extent[1][1];
7966
7951
  dragging = 2;
7967
7952
  }
7968
- d3_eventCancel();
7953
+ d3_eventPreventDefault();
7969
7954
  }
7970
7955
  }
7971
7956
  function keyup() {
@@ -7973,7 +7958,7 @@ d3 = function() {
7973
7958
  origin[0] += extent[1][0];
7974
7959
  origin[1] += extent[1][1];
7975
7960
  dragging = 0;
7976
- d3_eventCancel();
7961
+ d3_eventPreventDefault();
7977
7962
  }
7978
7963
  }
7979
7964
  function brushmove() {
@@ -8035,10 +8020,10 @@ d3 = function() {
8035
8020
  g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
8036
8021
  d3.select("body").style("cursor", null);
8037
8022
  w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
8023
+ dragRestore();
8038
8024
  event_({
8039
8025
  type: "brushend"
8040
8026
  });
8041
- d3_eventCancel();
8042
8027
  }
8043
8028
  }
8044
8029
  brush.x = function(z) {