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

UIDragger.onDrag() not triggering in Firefox and Safari #221

Open
leoxiong opened this issue Jun 22, 2024 · 0 comments
Open

UIDragger.onDrag() not triggering in Firefox and Safari #221

leoxiong opened this issue Jun 22, 2024 · 0 comments

Comments

@leoxiong
Copy link

leoxiong commented Jun 22, 2024

The ui.track demo does not seem to work on Firefox and Safari on macOS. Dragging on the red circles do not move them.

macOS Sonoma 14.5
Firefox 127.0.1
Safari 17.5

Another test script I wrote also doesn't log any messages.

    <div id="canvas"></div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pts/0.12.9/pts.min.js"></script>
    <script>
        Pts.namespace(this)

        const rects = []

        new CanvasSpace('#canvas').setup({bgcolor: 'transparent', retina: true}).add({
            start: (bound, space) => {
                const rect = UIDragger.fromRectangle([[100, 100], [0, 0]])
                rect.onDrag((target, pt) => {
                    console.log('ondrag')
                })
                rects.push(rect)
            },
            animate: (time, ftime, space) => {
                const form = space.getForm()

                form.fillOnly('#0c6')
                rects.forEach((rect) => {
                    rect.render(group => form.rect(group))
                })
            },
            action: (type, x, y, event) => {
                UI.track(rects, type, new Pt(x, y), event)
            },
        }).bindMouse().play()
    </script>

However using .on('drag', ...) does work.

const rect = UI.fromRectangle([[100, 100], [0, 0]])
rect.on('drag', (target, pt, type, event) => {
    console.log('drag')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant