Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android drag image duplicates #481

Closed
tevasaolvidar opened this issue Jun 1, 2013 · 11 comments
Closed

Android drag image duplicates #481

tevasaolvidar opened this issue Jun 1, 2013 · 11 comments
Labels

Comments

@tevasaolvidar
Copy link

On Android when dragging an image the image duplicates.
I tried every possible solution but doesn't work.

Screenshot here:
http://d.pr/i/aieA

@atomictag
Copy link

Probably related to #469

@ericdrowell
Copy link
Owner

will look at this as soon as I get another Android device :)

@bernardofd
Copy link

I can vouch for this issue as well. I have a non-interactive application over KineticJS and all my tweens in a scene duplicate objects with a little offset in the Y axis (even if the tween is over the X axis). I'm attaching a screenshot taken on a Samsung Galaxy Tab 2 7.0 running Jelly Bean (4.1.1) on the Android Browser.
screenshot_2013-06-28-12-15-56

@sebastianovide
Copy link

this is what I see in my device... after dragging a rectangle

screenshot from 2013-08-27 23 52 33

@scheng2013
Copy link

Hi everyone,

Was this resolved? Now I am also in this hole. Does anyone have a proper solution to fix it?

@ghost
Copy link

ghost commented Feb 8, 2014

Hey folks,

I worked around this by first adding a "shim" layer with a big white rectangle (my background is white). My canvas size is 800x600, so you should adjust for your canvas size. Next, I added a separate layer for my draggable items.

Hope this helps some poor soul. I wrestled with it for quite a while.

  var layerShim = new Kinetic.Layer({
        id: 'layerShim',
        name: 'layerShimName',
        clearBeforeDraw: false
  });      

  var layerDraggableStuff = new Kinetic.Layer({
        id: 'layerDraggableStuff',
        name: 'layerDraggableStuff',
        clearBeforeDraw: true
  });      

  var rect = new Kinetic.Rect({
    x: 0,
    y: 0,
    width: 800,
    height: 600,
    fill: 'white',
    stroke: 'white',
    strokeWidth: 4
  });
  layerShim.add(rect);
  layerShim.draw();

  // Add shim layer
  stage.add(layerShim);

  // Add nodes to draggables layer here... 

  // Add draggables layer
  stage.add(layerDraggables);

@ericdrowell
Copy link
Owner

I was able to replicate this - I'm shocked that more people weren't complaining about this. Looking into it.

@ericdrowell
Copy link
Owner

Which version of android? This appears to be an Android bug. Stuff drawn on the canvas element isn't able to be cleared after the first draw:

http://www.html5gamedevs.com/topic/114-canvasclearrect-bug-in-android-stock-browser/

@ericdrowell
Copy link
Owner

okay, the work around here (for Android 4.1.1 and 4.1.2) is to not immediately draw onto the canvas. set a small timeout (50ms works for me) before adding layers to the stage. I believe that this is no longer an issue with recent versions of Android.

@ghost
Copy link

ghost commented Feb 26, 2014

I'm running Android 4.3, so it looks like the Android bug is still lingering. Thanks for the workaround, @ericdrowell. Much cleaner than my elaborate hack.

@dbelay22
Copy link

Hi people,
I had the same issue dragging a group with an image and a couple of shapes inside. The timeout workaround didn't work for me and I only was able to solve it moving the draggable layer to the top on the contentTouchMove event:

this.stage.on('contentTouchmove', function(evt) { selectedGroup.getLayer().moveToTop(); }

I'll keep searching for a better solution as this may kill performance.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants