Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38830

Re: Stop the mouse listener

Newsgroups comp.lang.javascript
Date 2020-09-23 00:31 -0700
References <a9143f95-5e0b-404f-b734-776ce6a3feb9o@googlegroups.com>
Message-ID <d6e82db2-9337-4609-a55a-e0819014f240o@googlegroups.com> (permalink)
Subject Re: Stop the mouse listener
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den onsdag 23 september 2020 kl. 09:16:55 UTC+2 skrev Jonas Thörnvall:
> I want to stop the mouse listener while player scroll thru moves previous "board locked for moves". But i do not manage to turn listener off. I can see the alert but the listener still run so board never lockdown?
> 
> function stop_listeners() {
> 	alert("test");
>     c.removeEventListener('mouseup', start_listener);
>     c.removeEventListener('mousedown', start_listener);
>     c.removeEventListener('mousemove', start_listener);
> 	
> }
> 
> // Start listener
> function start_listener() {
>     mousePos = [0, 0];
>     mouseDown = [0, 0];
>     mouseUp = [0, 0];
>     c.addEventListener("mouseup", function(evt) {
>         mouseUp = getPosition(ctm, evt);
>         message = 'Mouse up: ' + mouseUp.x + ',' + mouseUp.y;
>     }, false);
>     c.addEventListener("mousedown", function(evt) {
>         mouseDown = getPosition(ctm, evt);
>         message = 'Mouse down: ' + mouseDown.x + ',' + mouseDown.y;
>         mousedown_logic();
>     }, false);
>     c.addEventListener('mousemove', function(evt) {
>        mousePos = getPosition(ctm, evt);
>        message = 'Mouse position: ' + mousePos.x + ',' + mousePos.y;
>     }, false);
> }
> 
> // Get X, Y cordinates mouse position
> function getPosition(ctm, evt) {
>     var rect = c.getBoundingClientRect();
>     return {
>         x: evt.clientX - rect.left,
>         y: evt.clientY - rect.top
>     };
> 	
> }

I will add a button that basicly strips array from unwanted/superfluos moves so you can jump right in anywhere.

I can scroll thru back and forth now but it introduce some bug, and i do not take care off pawn promotion and castling.

But first i must fix so i can lockdown board.
https://jonasth.github.io/chess/chess.html

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 00:16 -0700
  Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 00:31 -0700
  Re: Stop the mouse listener JJ <jj4public@gmail.com> - 2020-09-23 18:49 +0700
    Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 05:42 -0700
      Re: Stop the mouse listener Silvio <silvio@internet.com> - 2020-09-23 20:25 +0200
        Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 15:22 -0700
        Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-23 15:31 -0700
      Re: Stop the mouse listener Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 10:14 +0200
        Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:38 -0700
          Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:45 -0700
          Re: Stop the mouse listener Arno Welzel <usenet@arnowelzel.de> - 2020-09-24 19:43 +0200
        Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:42 -0700
        Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 02:52 -0700
          Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 08:32 -0700
            Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 08:59 -0700
              Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 09:08 -0700
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 09:25 -0700
              Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 09:09 -0700
                Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-24 09:53 -0700
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 10:00 -0700
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 10:02 -0700
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-24 13:10 -0700
                Re: Stop the mouse listener "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-25 13:43 +0200
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-25 08:44 -0700
            Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-24 11:28 -0700
              Re: Stop the mouse listener Silvio <silvio@internet.com> - 2020-09-24 23:19 +0200
                Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-24 14:51 -0700
              Re: Stop the mouse listener John G Harris <niam@jghnorth.org.uk.invalid> - 2020-09-25 11:15 +0100
                Re: Stop the mouse listener "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-25 13:31 +0200
              Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-25 11:01 -0700
                Re: Stop the mouse listener Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-09-25 11:06 -0700
                Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-25 11:15 -0700
                Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:41 -0700
                Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:46 -0700
                Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 04:33 -0700
                Re: Stop the mouse listener luserdroog <luser.droog@gmail.com> - 2020-09-26 09:32 -0700
                Re: Stop the mouse listener Julio Di Egidio <julio@diegidio.name> - 2020-09-26 11:05 -0700

csiph-web