Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

fix: iOS touch in segmentation brush mode #802

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

madhavajay
Copy link

This PR attempts to fix the touch input issues on label studio when using iPad Apple Pencil and brush / segmentation mode.

It isn't 100% perfect but ImageView.js is complex and I don't pretend to know all the edge cases.

There are some videos here showing the issue and it working afterwards.
https://imgur.com/a/fY4LsSf

It seems like @lavrton suggestion of mapping the events directly isnt enough: konvajs/konva#1361 (comment)

From what I can tell, the MouseEvent's have .offsetX and .offsetY however the TouchEvent's don't have these, but do have some similar values such as .layerX and .layerY. 🤷‍♀️.

Additionally, there is the need to pinch and zoom, but without e.preventDefault() doing things is particularly challenging.

My guess is that something like this would be optimal in the long term:
https://github.com/shuding/apple-pencil-safari-api-test

I know theres a lot of people using computers to label, but honestly, for brush style annotations, surely iPad support should be a #1 priority.

I am happy to help get this ready for merge if someone can help me understand what would be next to do.

- added e.preventDefault on touch canvas
- added fallback to e.layerX, e.layerY when e.offsetX, e.offsetY missing
@makseq
Copy link
Member

makseq commented Aug 9, 2022

Thank you for your amazing contribution!

@makseq makseq requested review from bmartel and hlomzik August 9, 2022 00:09
@makseq makseq changed the title Fix iOS touch in segmentation brush mode fix: iOS touch in segmentation brush mode Aug 12, 2022
@makseq
Copy link
Member

makseq commented Feb 28, 2023

@hogepodge please take a look at this PR

@github-actions github-actions bot added the fix label Sep 23, 2023
@hlomzik
Copy link
Collaborator

hlomzik commented Oct 2, 2023

/git merge master

Error: Merge conflict detected, please resolve it using the git command line.

Workflow run

@farioas
Copy link
Member

farioas commented Oct 10, 2023

/git merge master

Error: Merge conflict detected, please resolve it using the git command line.

Workflow run

@lackray
Copy link

lackray commented Jan 3, 2024

This PR attempts to fix the touch input issues on label studio when using iPad Apple Pencil and brush / segmentation mode.

It isn't 100% perfect but ImageView.js is complex and I don't pretend to know all the edge cases.

There are some videos here showing the issue and it working afterwards. https://imgur.com/a/fY4LsSf

It seems like @lavrton suggestion of mapping the events directly isnt enough: konvajs/konva#1361 (comment)

From what I can tell, the MouseEvent's have .offsetX and .offsetY however the TouchEvent's don't have these, but do have some similar values such as .layerX and .layerY. 🤷‍♀️.

Additionally, there is the need to pinch and zoom, but without e.preventDefault() doing things is particularly challenging.

My guess is that something like this would be optimal in the long term: https://github.com/shuding/apple-pencil-safari-api-test

I know theres a lot of people using computers to label, but honestly, for brush style annotations, surely iPad support should be a #1 priority.

I am happy to help get this ready for merge if someone can help me understand what would be next to do.

sadly,when the image become large,like 1M+, the touch draw region saved nothing after submit or update

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

Successfully merging this pull request may close these issues.

6 participants