Are you sure beginPath() returns something persistent?
No, I'm not, I'm just guessing where it would make sense to return a path (or subpath, see below).
For example, if you are using this beginPath(), it returns nothing:
void QQuickContext2D::beginPath()
As usual for Qt, the documentation sucks. https://doc.qt.io/qt-5/qml-qtquick-context2d.html#beginPath-method clearly documents beginPath() to return an object. Not what kind of object, or what to expect from it, just an object.
In the very same document, there are several links to http://www.w3.org/TR/2dcontext/, which unfortunately just redirects to a big mess of HTML "living standard". https://html.spec.whatwg.org/multipage/canvas.html#2dcontext seems to be the desired content.
But you do get some value in p1, p2. This may be the current path, previous paths not persisting.
Yes, that matches the behaviour.
Looking again at https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-ispointinpath, the example shows a click handler that (partially) draws each clickable object, then invokes isPointInPath() to check if that clickable object contains the mouse coordinates, and finally issues a redraw command, probably to clean up the mess that those checks made.
That does not look very sane and efficient to me. I'll try that.
Alexander
In reply to Re^2: [OT] QML Canvas Context2D and mouse input
by afoken
in thread [OT] QML Canvas Context2D and mouse input
by afoken
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |