简体   繁体   中英

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. 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. 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/ ):

$("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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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