From 194ae3bb62e8e621771c68d025d3ab7889aa712a Mon Sep 17 00:00:00 2001 From: Henrik Ingo Date: Tue, 8 May 2018 20:01:11 +0300 Subject: [PATCH] Fixes to data-rel-to Fixes 80ffff0e8f603a82d9abb6eb51647732c2c8563e --- examples/classic-slides/index.html | 6 +++--- examples/index.html | 1 + js/impress.js | 12 ++++++------ src/plugins/rel/rel.js | 12 ++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/examples/classic-slides/index.html b/examples/classic-slides/index.html index 3de0c928e..2534ecf78 100644 --- a/examples/classic-slides/index.html +++ b/examples/classic-slides/index.html @@ -101,7 +101,7 @@ powerpoint slide show. The "slide" class is entirely optional and indeed you wouldn't use it for your cooler impress.js presentations. --> -
+

Example Presentation:
Classic Slides

Henrik Ingo

@@ -114,7 +114,7 @@

2015

-
+

Table of Contents

-
+

Bullet points

  • A slide with bullet points. This is the first point.
  • diff --git a/examples/index.html b/examples/index.html index 1e5924b3f..945c7f180 100644 --- a/examples/index.html +++ b/examples/index.html @@ -6,6 +6,7 @@

    • 2D-navigation
    • 3D-rotations
    • +
    • 692
    • classic-slides
    • cube
    • markdown
    • diff --git a/js/impress.js b/js/impress.js index b36a7504c..bb99522d6 100644 --- a/js/impress.js +++ b/js/impress.js @@ -3566,7 +3566,7 @@ } }; - var computeRelativePositions = function( el, prev, root ) { + var computeRelativePositions = function( el, prev ) { var data = el.dataset; if ( !prev ) { @@ -3577,14 +3577,14 @@ if ( data.relTo ) { - var ref = root.getElementById( data.relTo ); + var ref = document.getElementById( data.relTo ); if ( ref ) { // Test, if it is a previous step that already has some assigned position data if ( el.compareDocumentPosition( ref ) & Node.DOCUMENT_POSITION_PRECEDING ) { - prev.x = ref.getAttribute( "data-x" ); - prev.y = ref.getAttribute( "data-y" ); - prev.z = ref.getAttribute( "data-z" ); + prev.x = toNumber( ref.getAttribute( "data-x" ) ); + prev.y = toNumber( ref.getAttribute( "data-y" ) ); + prev.z = toNumber( ref.getAttribute( "data-z" ) ); prev.relative = {}; } else { window.console.error( @@ -3650,7 +3650,7 @@ y: el.getAttribute( "data-y" ), z: el.getAttribute( "data-z" ) } ); - var step = computeRelativePositions( el, prev, root ); + var step = computeRelativePositions( el, prev ); // Apply relative position (if non-zero) el.setAttribute( "data-x", step.x ); diff --git a/src/plugins/rel/rel.js b/src/plugins/rel/rel.js index cd9b3e8d3..b3f1b4552 100644 --- a/src/plugins/rel/rel.js +++ b/src/plugins/rel/rel.js @@ -77,7 +77,7 @@ } }; - var computeRelativePositions = function( el, prev, root ) { + var computeRelativePositions = function( el, prev ) { var data = el.dataset; if ( !prev ) { @@ -88,14 +88,14 @@ if ( data.relTo ) { - var ref = root.getElementById( data.relTo ); + var ref = document.getElementById( data.relTo ); if ( ref ) { // Test, if it is a previous step that already has some assigned position data if ( el.compareDocumentPosition( ref ) & Node.DOCUMENT_POSITION_PRECEDING ) { - prev.x = ref.getAttribute( "data-x" ); - prev.y = ref.getAttribute( "data-y" ); - prev.z = ref.getAttribute( "data-z" ); + prev.x = toNumber( ref.getAttribute( "data-x" ) ); + prev.y = toNumber( ref.getAttribute( "data-y" ) ); + prev.z = toNumber( ref.getAttribute( "data-z" ) ); prev.relative = {}; } else { window.console.error( @@ -161,7 +161,7 @@ y: el.getAttribute( "data-y" ), z: el.getAttribute( "data-z" ) } ); - var step = computeRelativePositions( el, prev, root ); + var step = computeRelativePositions( el, prev ); // Apply relative position (if non-zero) el.setAttribute( "data-x", step.x );