문제

I have an OSX widget written using Dashcode.

Currently any mouse drag event causes the entire widget to move on the desktop.

I wish to be able to click and drag within a canvas on that widget, but I don't seem to be able to prevent the OSX dashboard from moving the entire widget instead.

I'm already capturing mouse movements quite happily, but the click/drag combo is defeating me.

도움이 되었습니까?

해결책

I've apparently found the answer, here in the Apple Developer site.

Put a -apple-dashboard-region: style on the div that you want to have receive drag events instead of dragging the widget, e.g.:

#canvas {
    -apple-dashboard-region: dashboard-region(control rectangle 4px 4px 4px 4px);
}

EDIT - this works - I can now capture onMouseMove() events when when the mouse button is pressed.

One thing I can't (yet) do is the equivalent of IE's setCapture(), where mouse movement events continue to be passed to the application even when the drag extends beyond the area of the widget.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top