impress.js: Add relative transformations.
The tag data-relative now signals that all transformations are releative to
the previous div (or to a tagged div if data-relative has a value). You may
build up relative steps (or refer to a prior relative step) but the mechanism
for building them assumes all references are in the past.
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
diff --git a/js/impress.js b/js/impress.js
index 3071cb0..25f1c33 100644
--- a/js/impress.js
+++ b/js/impress.js
@@ -320,7 +320,25 @@
}
stepsData["impress-" + el.id] = step;
-
+
+ // Do relative transforms before building css
+ // requires prior relatives to be defined, so cannot
+ // forward reference elements in data-absolute
+ if ( 'relative' in data) {
+ var pel = (data.relative === '') ? steps[idx - 1] : getStep(data.relative);
+ var pStep = stepsData["impress-" + pel.id];
+
+ step.translate.x += pStep.translate.x;
+ step.translate.y += pStep.translate.y;
+ step.translate.z += pStep.translate.z;
+
+ step.rotate.x += pStep.rotate.x;
+ step.rotate.y += pStep.rotate.y;
+ step.rotate.z += pStep.rotate.z;
+
+ step.scale *= pStep.scale;
+ }
+
css(el, {
position: "absolute",
transform: "translate(-50%,-50%)" +