summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/engine/scenery/image/_image.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/rectangles/engine/scenery/image/_image.js')
-rw-r--r--assets/javascripts/rectangles/engine/scenery/image/_image.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/assets/javascripts/rectangles/engine/scenery/image/_image.js b/assets/javascripts/rectangles/engine/scenery/image/_image.js
new file mode 100644
index 0000000..ae6bea4
--- /dev/null
+++ b/assets/javascripts/rectangles/engine/scenery/image/_image.js
@@ -0,0 +1,46 @@
+Scenery.image = function (wall, img) {
+
+ var base = this
+
+ base.wall = wall
+ base.img = img
+ base.center = wall.center_for(img)
+ base.bounds = wall.bounds_for(img)
+
+ // should be proportional to distance from wall
+ var cursor_amp = 1.5
+
+ base.init = function(){
+ base.build()
+ base.bind()
+ }
+
+ base.build = function(){
+ base.mx_img = new MX.Image({
+ src: img.src,
+ x: base.center.a,
+ y: Rooms.list[wall.room].height/2 - img.height/2 - 20,
+ z: base.center.b,
+ scale: 300/img.naturalWidth,
+ rotationY: wall_rotation[ wall.side ],
+ backface: false,
+ })
+ scene.add( base.mx_img )
+ base.move = new Scenery.image.move (base)
+ base.resize = new Scenery.image.resize (base)
+ }
+
+ base.bind = function(){
+ base.move.bind()
+ base.resize.bind()
+ $(base.mx_img.el).bind({
+ mouseenter: function(e){
+ Scenery.mouse.mouseenter(e, base)
+ },
+ mouseleave: function(e){
+ }
+ })
+ }
+
+ return base
+}