Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

8/15 master -> stable #11

Merged
merged 4 commits into from
Aug 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pointergestures.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
document.write('<script src="' + basePath + '../PointerEvents/pointerevents.js"></script>');
}

if (!window.Loader) {
if (!window.PolymerLoader) {
var path = basePath + 'tools/loader/loader.js';
document.write('<script src="' + path + '"></script>');
}
document.write('<script>Loader.load("' + scopeName + '")</script>');
document.write('<script>PolymerLoader.load("' + scopeName + '")</script>');
})();
95 changes: 36 additions & 59 deletions samples/track/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,54 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Track sample</title>
<script src="../../pointergestures.js"></script>
<title>PointerGestures Delta Tracking</title>
<style>
body, html {
html, body {
height: 100%;
width: 100%;
margin: 0;
background: whitesmoke;
}
.container {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.container > * {
-webkit-box-flex: 1;
-webkit-flex: 1 auto;
-ms-flex: 1 auto;
flex: 1 auto;
#real {
background: black;
z-index: 1;
}
.row {
-webkit-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
#ghost {
background: gray;
pointer-events: none;
}
.column {
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
#ghostghost {
background: lightgray;
pointer-events: none;
}
#host {
height: 100%;
width: 100%;
div {
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
#upleft {
background: #4285f4;
}
#upright {
background: #db4437;
}
#downleft {
background: #f4b400;
}
#downright {
background: #0f9d58;
height: 100px;
width: 100px;
position: absolute;
-webkit-transform: translateZ(0);
transform: translateZ(0);
}
</style>
<script src="../../pointergestures.js"></script>
</head>
<body>
<div id="host" class="container column" touch-action="none">
<div id="up" class="container row">
<div id="upleft"></div>
<div id="upright"></div>
</div>
<div id="down" class="container row">
<div id="downleft"></div>
<div id="downright"></div>
</div>
</div>
<body touch-action="none">

<div id="real"></div>
<div id="ghost"></div>
<div id="ghostghost"></div>

<script>
function log(e) {
console.log(e.type, e);
}
var host = document.querySelector('#host');
host.addEventListener('trackstart', function(e){ e.trackInfo.foo = 1 });
[ 'trackstart', 'track', 'trackend' ].forEach(function(t) {
host.addEventListener(t, log);
function translate(el, x, y) {
x = Math.max(0, x - 50); y = Math.max(0, y - 50);
el.style.transfomrm = el.style.webkitTransform = 'translateX(' + x + 'px) translateY(' + y + 'px)';
}
real.addEventListener('track', function(e) {
requestAnimationFrame(function() {
translate(real, e.clientX, e.clientY);
translate(ghost, e.clientX - e.ddx, e.clientY - e.ddy);
translate(ghostghost, e.clientX - e.dx, e.clientY - e.dy);
});
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion tools