summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/scenery/resize.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-02 17:22:05 -0400
committerJules Laplace <jules@okfoc.us>2014-10-02 17:22:05 -0400
commit1ca354257049dd9bf69a3542e2274c50e85ca788 (patch)
tree3583b1af1a7178eb448eab9640ef1546227200d7 /public/assets/javascripts/rectangles/engine/scenery/resize.js
parentb1556ef6f9854e08f5bb20907c57a9558005af95 (diff)
parente271f9d7c0b2cf3998d1d8921f1f830bd7bab3ef (diff)
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/scenery/resize.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/scenery/resize.js27
1 files changed, 12 insertions, 15 deletions
diff --git a/public/assets/javascripts/rectangles/engine/scenery/resize.js b/public/assets/javascripts/rectangles/engine/scenery/resize.js
index 2ba84a1..893237c 100644
--- a/public/assets/javascripts/rectangles/engine/scenery/resize.js
+++ b/public/assets/javascripts/rectangles/engine/scenery/resize.js
@@ -57,35 +57,32 @@ Scenery.resize = new function(){
// move all the dots to the object's current position
base.move_dots = function(){
- x = obj.mx.x + sin(rotationY) * dot_distance_from_picture
- y = obj.mx.y
- z = obj.mx.z - cos(rotationY) * dot_distance_from_picture
+ var x = obj.mx.x + sin(rotationY) * dot_distance_from_picture
+ var y = obj.mx.y
+ var z = obj.mx.z - cos(rotationY) * dot_distance_from_picture
dots.forEach(function(dot){
- base.move_dot(dot)
+ base.move_dot(dot, { x: x, y: y, z: z })
})
}
// move a dot .. to the initial position of the image
- base.move_dot = function(dot){
- dot.x = x
- dot.y = y
- dot.z = z
-
+ base.move_dot = function(dot, pos){
if (dot.side & TOP) {
- dot.y += obj.mx.height * obj.mx.scale / 2
+ pos.y += obj.dimensions.b / 2
}
if (dot.side & BOTTOM) {
- dot.y -= obj.mx.height * obj.mx.scale / 2
+ pos.y -= obj.dimensions.b / 2
}
if (dot.side & LEFT) {
- dot.x -= cos(rotationY) * (obj.mx.width * obj.mx.scale) / 2
- dot.z -= sin(rotationY) * (obj.mx.width * obj.mx.scale) / 2
+ pos.x -= cos(rotationY) * (obj.dimensions.a) / 2
+ pos.z -= sin(rotationY) * (obj.dimensions.a) / 2
}
if (dot.side & RIGHT) {
- dot.x += cos(rotationY) * (obj.mx.width * obj.mx.scale) / 2
- dot.z += sin(rotationY) * (obj.mx.width * obj.mx.scale) / 2
+ pos.x += cos(rotationY) * (obj.dimensions.a) / 2
+ pos.z += sin(rotationY) * (obj.dimensions.a) / 2
}
+ dot.move(pos)
}
// pick a new object to focus on and show the dots