Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MouseTracker - Pointer over/out event fixes #448

Merged
merged 10 commits into from
Aug 7, 2014
5 changes: 5 additions & 0 deletions src/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ $.Button = function( options ) {
this.tooltip;

this.element.style.position = "relative";
if ( this.element.style[ "touch-action" ] !== undefined ) {
this.element.style[ "touch-action" ] = "none";
} else if ( this.element.style[ "-ms-touch-action" ] !== undefined ) {
this.element.style[ "-ms-touch-action" ] = "none";
Copy link

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Daniel, I thought so too, and I thought I found that in the IE docs, but now I'm going to look again!

Copy link

Choose a reason for hiding this comment

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

👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Well I can't find the example of course :) So what's the proper way to do this? I'd much rather use the dot syntax over the key string syntax, which means I chose that way for a reason I wish I could remember. My only worry is cross-browser compatibility, and currently both ways work on the only two browsers that have touch-action implemented: IE 10/11 and Chrome (latest). Thanks!

Copy link

Choose a reason for hiding this comment

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

Can you try this.element.style.touchAction and this.element.style.msTouchAction? Then again, I’d recommend creating a helper function that auto-prefixes vendor specific CSS properties, e.g. https://github.com/peutetre/vendor-prefix.

Then again, if it works, maybe just leave it and sorry for the intrusion 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed :)

Copy link

Choose a reason for hiding this comment

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

Nice! Re: code snippet. Here’s another one I learned from our dear friend (and my former mentor) @iangilman: If you got three or more copies, consider extracting it 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

He may make me do it now, even though I slipped it through review before. Thanks. ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, before he even saw it :)

Copy link
Member

Choose a reason for hiding this comment

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

👍

}

this.imgGroup.style.position =
this.imgHover.style.position =
Expand Down
6 changes: 6 additions & 0 deletions src/buttongroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ $.ButtonGroup = function( options ) {
}
}

if ( this.element.style[ "touch-action" ] !== undefined ) {
this.element.style[ "touch-action" ] = "none";
} else if ( this.element.style[ "-ms-touch-action" ] !== undefined ) {
this.element.style[ "-ms-touch-action" ] = "none";
}

/**
* Tracks mouse/touch/key events accross the group of buttons.
* @member {OpenSeadragon.MouseTracker} tracker
Expand Down
10 changes: 5 additions & 5 deletions src/iiiftilesource.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ $.IIIFTileSource = function( options ){
}

if ( !options.maxLevel ) {
if ( !this.scale_factors ) {
options.maxLevel = Number( Math.ceil( Math.log( Math.max( this.width, this.height ), 2 ) ) );
} else {
if ( !this.scale_factors ) {
options.maxLevel = Number( Math.ceil( Math.log( Math.max( this.width, this.height ), 2 ) ) );
} else {
options.maxLevel = Math.floor( Math.pow( Math.max.apply(null, this.scale_factors), 0.5) );
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
return true;

// Version 1.0
} else if ( data.profile &&
} else if ( data.profile &&
data.profile.indexOf("http://library.stanford.edu/iiif/image-api/compliance.html") === 0) {
return true;
} else if ( data.identifier && data.width && data.height ) {
Expand Down Expand Up @@ -166,7 +166,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
configure: function( data, url ){
// Try to deduce our version and fake it upwards if needed
if ( !$.isPlainObject(data) ) {
var options = configureFromXml10( data );
var options = configureFromXml10( data );
options['@context'] = "http://iiif.io/api/image/1.0/context.json";
options['@id'] = url.replace('/info.xml', '');
return options;
Expand Down
Loading