【问题标题】:KineticJS How to listen to image drop from file explorer ?KineticJS 如何从文件资源管理器中收听图像丢弃?
【发布时间】:2013-05-08 11:50:48
【问题描述】:

我正在使用 kineticjs v4.5.1

我正在寻找一种从系统拖放将图像添加到画布的方法。

我尝试向我的容器添加事件侦听器:

jQuery('#container').on('drop',Actions.dropImage);

但是事件没有被触发,也没有:

App.canvas = document.getElementById('container');
App.canvas.addEventListener('drop',Actions.dropImage);

注意:这些代码示例正在使用“常规”画布,我在这里尝试将其与 kineticJS 一起使用

注意 2:我已经看到了这个问题:kineticjs drag and drop image from dom into canvas,但我想从文件资源管理器中拖放来完成它

我是不是做错了什么?

干杯

【问题讨论】:

  • 无法回答我自己的问题,但我终于找到了问题,我错过了防​​止拖动事件:` jQuery('#wydiwyg').on('dragover',function(event ){event.preventDefault();}); jQuery('#wydiwyg').on('drop',Actions.dropImage);

标签: image drag-and-drop kineticjs


【解决方案1】:

我终于找到问题了,为了防止dragover事件我错过了:

jQuery('#wydiwyg').on('dragover',function(event){event.preventDefault();}); 
jQuery('#wydiwyg').on('drop',Actions.dropImage);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-11
    • 1970-01-01
    • 2012-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多