Browse Source

fix(disableDefaultBahavior): fix disableDefaultBehavior for scroll

pull/2447/head
Yoshiya Hinosawa 6 years ago
parent
commit
8b409031c1
  1. 10
      src/zoom.js

10
src/zoom.js

@ -23,9 +23,7 @@ ChartInternal.prototype.initZoom = function () {
var e = d3.event.sourceEvent; var e = d3.event.sourceEvent;
if (e && e.type === "brush") { return; } if (e && e.type === "brush") { return; }
if (!config.zoom_disableDefaultBehavior) { $$.redrawForZoom();
$$.redrawForZoom.call($$);
}
config.zoom_onzoom.call($$.api, $$.x.orgDomain()); config.zoom_onzoom.call($$.api, $$.x.orgDomain());
}) })
@ -136,9 +134,14 @@ ChartInternal.prototype.redrawForZoom = function () {
zoom.update(); zoom.update();
if (config.zoom_disableDefaultBehavior) {
return;
}
if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) { if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) {
x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]); x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]);
} }
$$.redraw({ $$.redraw({
withTransition: false, withTransition: false,
withY: config.zoom_rescale, withY: config.zoom_rescale,
@ -146,6 +149,7 @@ ChartInternal.prototype.redrawForZoom = function () {
withEventRect: false, withEventRect: false,
withDimension: false withDimension: false
}); });
if (d3.event.sourceEvent && d3.event.sourceEvent.type === 'mousemove') { if (d3.event.sourceEvent && d3.event.sourceEvent.type === 'mousemove') {
$$.cancelClick = true; $$.cancelClick = true;
} }

Loading…
Cancel
Save