当我与新Kinetic.Stage更换新画廊的代码工作正常。当我与dirived类这是行不通的工作。
为什么是那种从Kinetic.Stage错误的推导画廊?
width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0
height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0
class Gallery extends Kinetic.Stage
constructor: (config) ->
super(config)
window.onload = ->
list_of_photos = jQuery('#_image img')
x_pos = width/4
y_pos = height/4
stage = new Gallery
container: "gallery_container"
width: width
height: height
images_layer = new Kinetic.Layer()
for image in list_of_photos
imageObj = new Image()
imageObj.src = image.src
x_pos = x_pos + 100
y_pos = y_pos + 10
ori = new Kinetic.Image
x: x_pos
y: y_pos
image: imageObj
draggable: true
width: 200
height: 200
images_layer.add ori
stage.add images_layer