Breakout perspective for better IE11 support. (#594)
This commit is contained in:
committed by
GitHub
parent
20fe5189fb
commit
1bf05799a0
@@ -133,11 +133,6 @@
|
|||||||
return " scale(" + s + ") ";
|
return " scale(" + s + ") ";
|
||||||
};
|
};
|
||||||
|
|
||||||
// `perspective` builds a perspective transform string for given data.
|
|
||||||
var perspective = function( p ) {
|
|
||||||
return " perspective(" + p + "px) ";
|
|
||||||
};
|
|
||||||
|
|
||||||
// `getElementFromHash` returns an element located by id from hash part of
|
// `getElementFromHash` returns an element located by id from hash part of
|
||||||
// window location.
|
// window location.
|
||||||
var getElementFromHash = function() {
|
var getElementFromHash = function() {
|
||||||
@@ -384,7 +379,8 @@
|
|||||||
css( root, {
|
css( root, {
|
||||||
top: "50%",
|
top: "50%",
|
||||||
left: "50%",
|
left: "50%",
|
||||||
transform: perspective( config.perspective / windowScale ) + scale( windowScale )
|
perspective: ( config.perspective / windowScale ) + "px",
|
||||||
|
transform: scale( windowScale )
|
||||||
} );
|
} );
|
||||||
css( canvas, rootStyles );
|
css( canvas, rootStyles );
|
||||||
|
|
||||||
@@ -504,9 +500,13 @@
|
|||||||
// that both of them are finished.
|
// that both of them are finished.
|
||||||
css( root, {
|
css( root, {
|
||||||
|
|
||||||
|
// For IE 11 support we must specify perspective independent
|
||||||
|
// of transform.
|
||||||
|
perspective: ( config.perspective / targetScale ) + "px",
|
||||||
|
|
||||||
// To keep the perspective look similar for different scales
|
// To keep the perspective look similar for different scales
|
||||||
// we need to 'scale' the perspective, too
|
// we need to 'scale' the perspective, too
|
||||||
transform: perspective( config.perspective / targetScale ) + scale( targetScale ),
|
transform: scale( targetScale ),
|
||||||
transitionDuration: duration + "ms",
|
transitionDuration: duration + "ms",
|
||||||
transitionDelay: ( zoomin ? delay : 0 ) + "ms"
|
transitionDelay: ( zoomin ? delay : 0 ) + "ms"
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -37,9 +37,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test( "Attributes", function( assert ) {
|
QUnit.test( "Attributes", function( assert ) {
|
||||||
assert.expect( 9 );
|
assert.expect( 10 );
|
||||||
|
|
||||||
var actual, expected;
|
var actual, expected;
|
||||||
|
var root = document.querySelector( "#impress" );
|
||||||
var canvas = document.querySelector( "div#impress > div" );
|
var canvas = document.querySelector( "div#impress > div" );
|
||||||
|
|
||||||
var canvasIsNotAStep = !canvas.classList.contains("step") && canvas.id === "";
|
var canvasIsNotAStep = !canvas.classList.contains("step") && canvas.id === "";
|
||||||
@@ -78,6 +79,10 @@
|
|||||||
expected = "ease-in-out";
|
expected = "ease-in-out";
|
||||||
assert.strictEqual( actual, expected, "canvas.style.transitionTimingFunction initialized correctly" );
|
assert.strictEqual( actual, expected, "canvas.style.transitionTimingFunction initialized correctly" );
|
||||||
|
|
||||||
|
actual = root.style.perspective;
|
||||||
|
expected = "";
|
||||||
|
assert.notStrictEqual( actual, expected, "root.style.perspective should be set explicitly for IE 11" );
|
||||||
|
|
||||||
actual = document.documentElement.style.height;
|
actual = document.documentElement.style.height;
|
||||||
expected = "100%";
|
expected = "100%";
|
||||||
assert.strictEqual( actual, expected, "documentElement.style.height is 100%" );
|
assert.strictEqual( actual, expected, "documentElement.style.height is 100%" );
|
||||||
|
|||||||
Reference in New Issue
Block a user