Browse Source

Merge branch 'michalkop93-zoom'

pull/631/head
Masayuki Tanaka 10 years ago
parent
commit
f8a2fef09e
  1. 6
      c3.js
  2. 6
      c3.min.js
  3. 2
      src/config.js
  4. 4
      src/zoom.js

6
c3.js

@ -890,6 +890,8 @@
zoom_extent: undefined,
zoom_privileged: false,
zoom_onzoom: function () {},
zoom_onzoomstart: function () {},
zoom_onzoomend: function () {},
interaction_enabled: true,
onmouseover: function () {},
onmouseout: function () {},
@ -5025,6 +5027,7 @@
$$.zoom = d3.behavior.zoom()
.on("zoomstart", function () {
$$.zoom.altDomain = d3.event.sourceEvent.altKey ? $$.x.orgDomain() : null;
config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent);
})
.on("zoom", function () {
// prevZoomTranslate is needed for the fix of unexpected zoom.translate after remaining zoom
@ -5034,6 +5037,9 @@
$$.redrawForZoom.call($$);
prevZoomTranslate = $$.zoom.translate();
wheeled = d3.event.sourceEvent.type === 'wheel';
})
.on('zoomend', function () {
config.zoom_onzoomend.call($$.api, $$.x.orgDomain());
});
$$.zoom.scale = function (scale) {
return config.axis_rotated ? this.y(scale) : this.x(scale);

6
c3.min.js vendored

File diff suppressed because one or more lines are too long

2
src/config.js

@ -11,6 +11,8 @@ c3_chart_internal_fn.getDefaultConfig = function () {
zoom_extent: undefined,
zoom_privileged: false,
zoom_onzoom: function () {},
zoom_onzoomstart: function () {},
zoom_onzoomend: function () {},
interaction_enabled: true,
onmouseover: function () {},
onmouseout: function () {},

4
src/zoom.js

@ -4,6 +4,7 @@ c3_chart_internal_fn.initZoom = function () {
$$.zoom = d3.behavior.zoom()
.on("zoomstart", function () {
$$.zoom.altDomain = d3.event.sourceEvent.altKey ? $$.x.orgDomain() : null;
config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent);
})
.on("zoom", function () {
// prevZoomTranslate is needed for the fix of unexpected zoom.translate after remaining zoom
@ -13,6 +14,9 @@ c3_chart_internal_fn.initZoom = function () {
$$.redrawForZoom.call($$);
prevZoomTranslate = $$.zoom.translate();
wheeled = d3.event.sourceEvent.type === 'wheel';
})
.on('zoomend', function () {
config.zoom_onzoomend.call($$.api, $$.x.orgDomain());
});
$$.zoom.scale = function (scale) {
return config.axis_rotated ? this.y(scale) : this.x(scale);

Loading…
Cancel
Save