mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Add support of overlays rotation on IE9.
This commit is contained in:
parent
33bd943b7a
commit
ffbb8b2cfe
@ -1337,6 +1337,49 @@ if (typeof define === 'function' && define.amd) {
|
|||||||
return window.getComputedStyle( element, "" );
|
return window.getComputedStyle( element, "" );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the property with the correct vendor prefix appended.
|
||||||
|
* @param {String} property the property name
|
||||||
|
* @returns {String} the property with the correct prefix or null if not
|
||||||
|
* supported.
|
||||||
|
*/
|
||||||
|
getCssPropertyWithVendorPrefix: function(property) {
|
||||||
|
var memo = {};
|
||||||
|
|
||||||
|
$.getCssPropertyWithVendorPrefix = function(property) {
|
||||||
|
if (memo[property] !== undefined) {
|
||||||
|
return memo[property];
|
||||||
|
}
|
||||||
|
var style = document.createElement('div').style;
|
||||||
|
var result = null;
|
||||||
|
if (style[property] !== undefined) {
|
||||||
|
result = property;
|
||||||
|
} else {
|
||||||
|
var prefixes = ['Webkit', 'Moz', 'MS', 'O',
|
||||||
|
'webkit', 'moz', 'ms', 'o'];
|
||||||
|
var suffix = $.capitalizeFirstLetter(property);
|
||||||
|
for (var i = 0; i < prefixes.length; i++) {
|
||||||
|
var prop = prefixes[i] + suffix;
|
||||||
|
if (style[prop] !== undefined) {
|
||||||
|
result = prop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memo[property] = result;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
return $.getCssPropertyWithVendorPrefix(property);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capitalizes the first letter of a string
|
||||||
|
* @param {String} string
|
||||||
|
* @returns {String} The string with the first letter capitalized
|
||||||
|
*/
|
||||||
|
capitalizeFirstLetter: function(string) {
|
||||||
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if a point is within the bounding rectangle of the given element (hit-test).
|
* Determines if a point is within the bounding rectangle of the given element (hit-test).
|
||||||
|
@ -257,12 +257,18 @@
|
|||||||
style.height = size.y + "px";
|
style.height = size.y + "px";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rotate) {
|
var transformOriginProp = $.getCssPropertyWithVendorPrefix(
|
||||||
style.transformOrigin = this._getTransformOrigin();
|
'transformOrigin');
|
||||||
style.transform = "rotate(" + rotate + "deg)";
|
var transformProp = $.getCssPropertyWithVendorPrefix(
|
||||||
} else {
|
'transform');
|
||||||
style.transformOrigin = "";
|
if (transformOriginProp && transformProp) {
|
||||||
style.transform = "";
|
if (rotate) {
|
||||||
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
|
style[transformProp] = "rotate(" + rotate + "deg)";
|
||||||
|
} else {
|
||||||
|
style[transformOriginProp] = "";
|
||||||
|
style[transformProp] = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
style.position = "absolute";
|
style.position = "absolute";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user