<tfoot id='FNMxO'></tfoot>

    <small id='FNMxO'></small><noframes id='FNMxO'>

      <bdo id='FNMxO'></bdo><ul id='FNMxO'></ul>
    <legend id='FNMxO'><style id='FNMxO'><dir id='FNMxO'><q id='FNMxO'></q></dir></style></legend>
      <i id='FNMxO'><tr id='FNMxO'><dt id='FNMxO'><q id='FNMxO'><span id='FNMxO'><b id='FNMxO'><form id='FNMxO'><ins id='FNMxO'></ins><ul id='FNMxO'></ul><sub id='FNMxO'></sub></form><legend id='FNMxO'></legend><bdo id='FNMxO'><pre id='FNMxO'><center id='FNMxO'></center></pre></bdo></b><th id='FNMxO'></th></span></q></dt></tr></i><div id='FNMxO'><tfoot id='FNMxO'></tfoot><dl id='FNMxO'><fieldset id='FNMxO'></fieldset></dl></div>

      1. 咖啡脚本类

        coffeescript Class(咖啡脚本类)
      2. <small id='lfbl6'></small><noframes id='lfbl6'>

              • <bdo id='lfbl6'></bdo><ul id='lfbl6'></ul>

                <i id='lfbl6'><tr id='lfbl6'><dt id='lfbl6'><q id='lfbl6'><span id='lfbl6'><b id='lfbl6'><form id='lfbl6'><ins id='lfbl6'></ins><ul id='lfbl6'></ul><sub id='lfbl6'></sub></form><legend id='lfbl6'></legend><bdo id='lfbl6'><pre id='lfbl6'><center id='lfbl6'></center></pre></bdo></b><th id='lfbl6'></th></span></q></dt></tr></i><div id='lfbl6'><tfoot id='lfbl6'></tfoot><dl id='lfbl6'><fieldset id='lfbl6'></fieldset></dl></div>
                <legend id='lfbl6'><style id='lfbl6'><dir id='lfbl6'><q id='lfbl6'></q></dir></style></legend>
                  <tbody id='lfbl6'></tbody>
                <tfoot id='lfbl6'></tfoot>
                1. 本文介绍了咖啡脚本类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我用新的 Kinetic.Stage 替换新的画廊时,代码可以正常工作当我使用驱动类时,它不起作用.

                  When I replace new Gallery with new Kinetic.Stage the code works properly When I work with the dirived class it does not work.

                  为什么从 Kinetic.Stage 派生的画廊类型是错误的?

                  Why is the kind of deriving Gallery from Kinetic.Stage wrong ?

                  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
                  

                  推荐答案

                  问题 - Kineticjs 对象与咖啡脚本类不兼容".

                  Problem - Kineticjs Objects are not "compatible" with coffeescript classes.

                  解决 - 你必须使用其他方式调用超级"

                  Solving - You have to use other way of calling "super"

                  class Gallery extends Kinetic.Stage
                      constructor : (config) ->
                          Kinetic.Stage.call(@, config)
                  

                  此处的示例:http://jsfiddle.net/lavrton/w2EQD/4/

                  UPD:我发现这个问题只存在于构造函数"方法中.其他人也可以:

                  UPD: I found that this problem exists only for "constructor" method. Ok for others:

                  class Gallery extends Kinetic.Stage
                    constructor: (config) -> 
                      Kinetic.Stage.call(@, config)
                    add : (item) ->
                      console.log(item)
                      super item
                  

                  这篇关于咖啡脚本类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                  How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
                  How to use coffeescript in developing web-sites?(如何在开发网站时使用coffeescript?)

                    <small id='ojLwy'></small><noframes id='ojLwy'>

                  1. <tfoot id='ojLwy'></tfoot>
                  2. <legend id='ojLwy'><style id='ojLwy'><dir id='ojLwy'><q id='ojLwy'></q></dir></style></legend>
                      <tbody id='ojLwy'></tbody>

                          <i id='ojLwy'><tr id='ojLwy'><dt id='ojLwy'><q id='ojLwy'><span id='ojLwy'><b id='ojLwy'><form id='ojLwy'><ins id='ojLwy'></ins><ul id='ojLwy'></ul><sub id='ojLwy'></sub></form><legend id='ojLwy'></legend><bdo id='ojLwy'><pre id='ojLwy'><center id='ojLwy'></center></pre></bdo></b><th id='ojLwy'></th></span></q></dt></tr></i><div id='ojLwy'><tfoot id='ojLwy'></tfoot><dl id='ojLwy'><fieldset id='ojLwy'></fieldset></dl></div>
                          • <bdo id='ojLwy'></bdo><ul id='ojLwy'></ul>