summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/scenery/resize.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-02 16:30:53 -0400
committerJules Laplace <jules@okfoc.us>2014-10-02 16:30:53 -0400
commitc996ec3c93316b7a28b6707c9f7f595488d05cb9 (patch)
tree859d22deafeea626381bdfd3ab80bffed5655859 /public/assets/javascripts/rectangles/engine/scenery/resize.js
parent0a060fc9c9c3b4f93a79e7ee350cbaeac14ba589 (diff)
fix dot positioning
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