Skip to content

Commit

Permalink
changed how friction works a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar Robinson committed Sep 19, 2014
1 parent 7545c13 commit 5615f28
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
13 changes: 4 additions & 9 deletions huddlecanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ var HuddleCanvas = (function() {
maxScale: 4,
minScale: 0.4,
friction: 0.05,
inertia: 100,
disableFlickPan: false
}

Expand Down Expand Up @@ -123,9 +122,6 @@ var HuddleCanvas = (function() {
if (settingsParam.minScale !== undefined) {
settings.minScale = settingsParam.minScale;
}
if (settingsParam.inertia !== undefined) {
settings.inertia = settingsParam.inertia;
}
if (settingsParam.friction !== undefined) {
settings.friction = settingsParam.friction;
}
Expand Down Expand Up @@ -836,15 +832,15 @@ var HuddleCanvas = (function() {
});
if (!settings.disableFlickPan) {
var angle = (currentDeviceAngle * Math.PI) / 180.0;
applyInertia(angle, velocityX, velocityY, sessionOffsetId, 0);
applyInertia(angle, velocityX, velocityY, sessionOffsetId);
}
}
prevTouch = ev;
});
}


function applyInertia(angle, velocityXHammer, velocityYHammer, sessionOffsetId, count) {
function applyInertia(angle, velocityXHammer, velocityYHammer, sessionOffsetId) {

var multiplier = 20;

Expand All @@ -861,10 +857,9 @@ var HuddleCanvas = (function() {
offsetY: -inertiaMovY
}
});
count++;
if (count < settings.inertia) {
if (!(inertiaMovX < 0.01 && inertiaMovY < 0.01)) {
setTimeout(function() {
applyInertia(angle, velocityXHammer / (1 + settings.friction), velocityYHammer / (1 + settings.friction), sessionOffsetId, count)
applyInertia(angle, velocityXHammer / (1 + settings.friction), velocityYHammer / (1 + settings.friction), sessionOffsetId)
}, 1);
} else {
return;
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Package.onUse(function(api) {

Package.describe({
summary: "Create explorable layers for use with Huddle",
version: "1.2.0",
version: "1.3.0",
name: "scarrobin:huddlecanvas",
git: 'https://github.com/scarrobin/HuddleCanvas.git'
});
2 changes: 1 addition & 1 deletion smart.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "allows easy use of the meteorite Huddle module to create explorable images and add layers of information",
"homepage": "https://github.com/scarrobin/HuddleCanvas",
"author": "Oscar Robinson, Jonny Manfield",
"version": "1.2.0",
"version": "1.3.0",
"git": "https://github.com/scarrobin/HuddleCanvas.git",
"packages": {
"huddle": {}
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
]
],
"pluginDependencies": [],
"toolVersion": "meteor-tool@1.0.30",
"toolVersion": "meteor-tool@1.0.31",
"format": "1.0"
}

0 comments on commit 5615f28

Please sign in to comment.