Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

vertical scroll when zoomKey isn't triggered #2197

Merged
merged 6 commits into from
Oct 21, 2016

Conversation

yotamberk
Copy link
Contributor

@yotamberk yotamberk commented Oct 20, 2016

No description provided.

Verified

This commit was signed with the committer’s verified signature.
CasperWA Casper Welzel Andersen

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@yotamberk yotamberk changed the base branch from master to develop October 20, 2016 16:48
@yotamberk yotamberk changed the title vertical scroll when zoomKey isn't triggered [ closes #2193 ] vertical scroll when zoomKey isn't triggered [ fixes #2193 ] Oct 20, 2016
@yotamberk yotamberk changed the title vertical scroll when zoomKey isn't triggered [ fixes #2193 ] vertical scroll when zoomKey isn't triggered Oct 20, 2016
Copy link
Member

@mojoaxel mojoaxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see source comments

@@ -222,7 +251,7 @@ Core.prototype.setOptions = function (options) {
var fields = [
'width', 'height', 'minHeight', 'maxHeight', 'autoResize',
'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates',
'locale', 'locales', 'moment', 'rtl'
'locale', 'locales', 'moment', 'rtl', 'zoomKey'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zoomKey looks like a new option. I think we need some documentation for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not new, it's simply not exposed in the core.js file so we need to expose it like this.

@@ -161,6 +161,35 @@ Core.prototype._create = function (container) {
this.dom.root.addEventListener('mousewheel', onMouseWheel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use the chance an change the existing mousewheel handler to something more generic:

if (this.dom.root.addEventListener) {
    // IE9, Chrome, Safari, Opera
    this.dom.root.addEventListener("mousewheel", MouseWheelHandler, false);
    // Firefox
    this.dom.root.addEventListener("DOMMouseScroll", MouseWheelHandler, false);
} else {
    // IE 6/7/8
    this.dom.root.attachEvent("onmousewheel", MouseWheelHandler);
}

event.preventDefault();
}

this.dom.center.addEventListener('mousewheel', onMouseWheelCenter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a mousewheel handler on the root element. For performance-reasons we should only attach it once and reuse the onMouseWheel function.

@yotamberk
Copy link
Contributor Author

Fixed comments! On to the next PR

@mojoaxel mojoaxel merged commit ea4d56c into almende:develop Oct 21, 2016
@yotamberk yotamberk deleted the center-scroll-2 branch October 28, 2016 09:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants