simon-git: puzzles (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Mon Feb 20 19:25:53 GMT 2023


TL;DR:
  5c85825 Fix error about setCapture not existing.

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2023-02-20 19:25:53

commit 5c858253f9456b970be5d5ef3e7df727d39e3da7
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5c858253f9456b970be5d5ef3e7df727d39e3da7;hp=bbe866a3819c6a754a5b1d8c5bc5d0701796acfb
Author: Simon Tatham <anakin at pobox.com>
Date:   Mon Feb 20 19:16:35 2023 +0000

    Fix error about setCapture not existing.
    
    element.setCapture only seems to exist in Firefox. On most other
    browsers, our attempt to call it must have been generating a whinge in
    the console log all along. But Ben's commit bb16b5a70ddf77d turned
    that into a prominent alert box, triggered on every mouse click in the
    puzzle canvas.
    
    Worked around by wrapping both calls to setCapture in a local
    subroutine which checks if it's there before calling it.
    
    Also, setCapture turns out to be deprecated in any case, according to
    https://developer.mozilla.org/en-US/docs/Web/API/Element/setCapture .
    It looks as if the non-deprecated version is element.setPointerCapture:
    https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
    But it also looks as if that needs the 'pointerId' field that's only
    found in 'onpointerdown' events and not 'onmousedown' ones. So
    including that as an alternative will be a bigger job.

 emccpre.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)



More information about the tartarus-commits mailing list