简体   繁体   English

HTML 5 Canvas jCanvas / KineticJS,当图像可拖动时,画布/舞台对iPad上的点击/触摸无响应

[英]HTML 5 Canvas jCanvas/KineticJS when image is draggable, canvas/stage is unresponsive for clicks/touch on an iPad

I've tried this with both jCanvas and KineticJS. 我已经使用jCanvas和KineticJS进行了尝试。 When an added image is made draggable: 使添加的图像可拖动时:

var image = new Kinetic.Image({
  image: imageObj,
  id: imageName,
  x: parseInt(CoordX),
  y: parseInt(CoordY),
  draggable: true
});

The canvas/stage become unresponsive for clicks on an iPad. 画布/舞台对于在iPad上的点击无响应。 The only place where it recognises click/tap is on the border. 边框上唯一可以识别单击/轻击的地方。

Has anyone faced similar issue and how did you resolve this? 有没有人遇到过类似的问题,您如何解决呢?

UPDATE: @user1950497, for jCanvas, the key to making an image draggable is to make sure to set the layer property to true ( http://jsfiddle.net/dksmiffs/YdPpy/ ): 更新: @ user1950497,对于jCanvas,使图像可拖动的关键是确保将layer属性设置为truehttp://jsfiddle.net/dksmiffs/YdPpy/ ):

$("canvas").drawImage({
  source: "http://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Gadsden_flag.svg/320px-Gadsden_flag.svg.png",
  x: 200, y: 150,
  layer: true,
  draggable: true
});

Thanks to @Caleb531 who guided me to the answer in jCanvas issue #74 . 感谢@ Caleb531,他指导了我在jCanvas 第74期中的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM