Framer.js - 拖动事件的“图层”参数未定义

时间:2016-11-14 19:46:32

标签: coffeescript event-handling drag framerjs

我在用coffeescript编写的framer.js中创建了一个包含可拖动列表项的列表。

数组“图层”包含单个列表项。

class mycompany_report_inventory  {

   function GetData($category_collection){   

   $this->fnListHierarchy();

   }
   ...

    function fnListHierarchy()  {

      // this works:    
      $_categories = Mage::helper('catalog/category')->getStoreCategories();

      // var_dump this to see an associative array of all categories
      $categories = getChildCategories($_categories, true);

      // Run this to echo out a DOM
      renderCategoriesTree($_categories, true);
    }
}   

当我现在在列表项上调用事件监听器时,“layer”参数未定义

for i in [0..3]
    layer = new Layer width:listWidth, height:listHeight, y:i*yDistance, clip:false,
    borderRadius: 4, superLayer:canvas

    layer.listIndex = i

    layer.draggable.enabled = true
    layer.draggable.speedX = 0
    layer.draggable.speedY = 1

    Layers.push(layer)

我需要事件函数中的layer元素来操作它。哪里出错了?

1 个答案:

答案 0 :(得分:0)

删除Autofac.Extras.DynamicProxy声明:

draggable

或者,使用layer.on Events.DragMove, (event, layer) -> print layer 关键字:

this

使用您的代码:

layer.on Events.DragMove, (event, layer) ->
    print this