提交 5bf0bdb7 编写于 作者: C Catouse

* finish task #001 and fix bug #028.

上级 5e5075ea
......@@ -468,8 +468,16 @@
var isWindows = window.navigator.userAgent.match(/Win/i);
if (isWindows) mouseWheelFactor *= 20;
$container.on('mousewheel', function(event) {
that.scroll(that.layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor), that.layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor));
event.preventDefault();
// check whether need scroll
var layout = that.layout;
var scrollLeft = layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor);
var scrollTop = layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor);
scrollLeft = Math.max(0, Math.min(scrollLeft, layout.width - layout.containerWidth));
scrollTop = Math.max(0, Math.min(scrollTop, layout.height - layout.containerHeight));
if (scrollLeft !== layout.scrollLeft || scrollTop !== layout.scrollTop) {
that.scroll(scrollLeft, scrollTop);
event.preventDefault();
}
});
that.$container = $container;
......
......@@ -239,8 +239,16 @@
var isWindows = window.navigator.userAgent.match(/Win/i);
if (isWindows) mouseWheelFactor *= 20;
$container.on('mousewheel', function(event) {
that.scroll(that.layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor), that.layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor));
event.preventDefault();
// check whether need scroll
var layout = that.layout;
var scrollLeft = layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor);
var scrollTop = layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor);
scrollLeft = Math.max(0, Math.min(scrollLeft, layout.width - layout.containerWidth));
scrollTop = Math.max(0, Math.min(scrollTop, layout.height - layout.containerHeight));
if (scrollLeft !== layout.scrollLeft || scrollTop !== layout.scrollTop) {
that.scroll(scrollLeft, scrollTop);
event.preventDefault();
}
});
that.$container = $container;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册