Use vendor detection for requestAnimationFrame
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
* full text of the license.
|
* full text of the license.
|
||||||
*
|
*
|
||||||
* @requires OpenLayers/SingleFile.js
|
* @requires OpenLayers/SingleFile.js
|
||||||
|
* @requires OpenLayers/Vendor.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
|
|||||||
* Property: isNative
|
* Property: isNative
|
||||||
* {Boolean} true if a native requestAnimationFrame function is available
|
* {Boolean} true if a native requestAnimationFrame function is available
|
||||||
*/
|
*/
|
||||||
var isNative = !!(window.requestAnimationFrame ||
|
var requestAnimationFrame = OpenLayers.Vendor.jsPrefix(window, "requestAnimationFrame");
|
||||||
window.webkitRequestAnimationFrame ||
|
var isNative = !!(requestAnimationFrame);
|
||||||
window.mozRequestAnimationFrame ||
|
|
||||||
window.oRequestAnimationFrame ||
|
|
||||||
window.msRequestAnimationFrame);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: requestFrame
|
* Function: requestFrame
|
||||||
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
|
|||||||
* element - {DOMElement} Optional element that visually bounds the animation.
|
* element - {DOMElement} Optional element that visually bounds the animation.
|
||||||
*/
|
*/
|
||||||
var requestFrame = (function() {
|
var requestFrame = (function() {
|
||||||
var request = window.requestAnimationFrame ||
|
var request = window[requestAnimationFrame] ||
|
||||||
window.webkitRequestAnimationFrame ||
|
|
||||||
window.mozRequestAnimationFrame ||
|
|
||||||
window.oRequestAnimationFrame ||
|
|
||||||
window.msRequestAnimationFrame ||
|
|
||||||
function(callback, element) {
|
function(callback, element) {
|
||||||
window.setTimeout(callback, 16);
|
window.setTimeout(callback, 16);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
// dependencies for tests
|
// dependencies for tests
|
||||||
var OpenLayers = [
|
var OpenLayers = [
|
||||||
|
"OpenLayers/Vendor.js",
|
||||||
"OpenLayers/Animation.js"
|
"OpenLayers/Animation.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user