Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
willemmulder committed May 7, 2012
1 parent 3d19ce7 commit 07a77fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
SyntaxHighlighter.defaults.toolbar = false;
SyntaxHighlighter.all();
</script>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-258109-13']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</head>
<body>
<div class="container">
Expand Down
13 changes: 8 additions & 5 deletions js/presenteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,20 @@ function Presenteer(canvas, elements, options) {
// If canvas is smaller than its container, then center the canvas in its parent
if (options.centerVertically && (outerScrollHeight(canvas, options.showOriginalMargins) * canvasZoomFactor) < viewportHeight) {
// This does not work on Webkit for some reason. $(canvas).outerHeight() seems to always return 0
if (!$.browser.webkit) {
if (!$.browser.webkit && !$.browser.opera) {
newTop = (viewportHeight - (outerScrollHeight(canvas, options.showOriginalMargins) * canvasZoomFactor)) / 2;
}
}
if (options.centerHorizontally && (outerScrollWidth(canvas, options.showOriginalMargins) * canvasZoomFactor) < viewportWidth) {
newLeft = (viewportWidth - (outerScrollWidth(canvas, options.showOriginalMargins) * canvasZoomFactor)) / 2;
// This does not work on Webkit for some reason. $(canvas).outerWidth() seems to always return 0
if (!$.browser.webkit && !$.browser.opera) {
//newLeft = (viewportWidth - (outerScrollWidth(canvas, options.showOriginalMargins) * canvasZoomFactor)) / 2;
}
}

// Calculate new transform Origin
var transformOriginLeft = (baseLeft * 1 + (e.outerWidth() / 2)) + "px";
var transformOriginTop = (baseTop * 1 + (e.outerHeight() / 2)) + "px";
var transformOriginLeft = (Math.round((baseLeft * 1 + (e.outerWidth() / 2))*10000)/10000) + "px";
var transformOriginTop = (Math.round((baseTop * 1 + (e.outerHeight() / 2))*10000)/10000) + "px";

// Set transformations back to how they were
setTransformation(canvas, transformationBackup);
Expand All @@ -169,7 +172,7 @@ function Presenteer(canvas, elements, options) {
setTransitions(e, transitionsElmBackup);
// Set canvas transformations to correct values
var inverseMatrix = (options.followElementTransforms ? processElementTransforms(e) : "");
var transform = ' translate('+newLeft+'px,'+newTop+'px) scale('+canvasZoomFactor+') ' + inverseMatrix;
var transform = ' translate('+(Math.round(newLeft*10000)/10000)+'px,'+(Math.round(newTop*10000)/10000)+'px) scale('+(Math.round(canvasZoomFactor*10000)/10000)+') ' + inverseMatrix;
setTransformOrigin(canvas, transformOriginLeft, transformOriginTop);
setTransformation(canvas,transform);
}, 1);
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Presenteer.js
============

Presenteer.js is a flexible HTML5 presentation tool that uses CSS3 transforms and transitions to make smooth HTML presentations.
Works on Chrome, Firefox, Opera, Android, iPhone and IE9.
See http://willemmulder.github.com/Presenteer.js/ for demos and documentation.

License
Expand All @@ -22,4 +23,4 @@ Trunk
1.0
+ Center vertically or horizontally in viewport
+ Presentation follows element transforms
+ Works on Chrome, Firefox, Opera, Android, iPhone and IE9
+ Work on Chrome, Firefox, Opera, Android, iPhone and IE9

0 comments on commit 07a77fe

Please sign in to comment.