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


Groups > comp.lang.javascript > #24314 > unrolled thread

Is it possible to trap the right mouse click in a <canvas>?

Started bybit-naughty@hotmail.com
First post2014-05-21 07:34 -0700
Last post2014-05-21 18:49 -0700
Articles 8 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Is it possible to trap the right mouse click in a <canvas>? bit-naughty@hotmail.com - 2014-05-21 07:34 -0700
    Re: Is it possible to trap the right mouse click in a <canvas>? Ed Jay <edMbj@aes-intl.com> - 2014-05-21 11:56 -0700
      Re: Is it possible to trap the right mouse click in a <canvas>? bit-naughty@hotmail.com - 2014-05-22 06:22 -0700
        Re: Is it possible to trap the right mouse click in a <canvas>? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-05-22 16:42 +0200
        Re: Is it possible to trap the right mouse click in a <canvas>? Ed Jay <edMbj@aes-intl.com> - 2014-05-22 08:55 -0700
    Re: Is it possible to trap the right mouse click in a <canvas>? rescattered@gmail.com - 2014-05-21 13:08 -0700
      Re: Is it possible to trap the right mouse click in a <canvas>? Ed Jay <edMbj@aes-intl.com> - 2014-05-21 16:35 -0700
        Re: Is it possible to trap the right mouse click in a <canvas>? John C <rescattered@gmail.com> - 2014-05-21 18:49 -0700

#24314 — Is it possible to trap the right mouse click in a <canvas>?

Frombit-naughty@hotmail.com
Date2014-05-21 07:34 -0700
SubjectIs it possible to trap the right mouse click in a <canvas>?
Message-ID<34b73d82-8a02-46e2-8462-9e24a568609d@googlegroups.com>
....in JS? And have it interact WITH the page, ie. show a menu with options on it that might change the page in some way....? (either the rest of the page OR inside the canvas).


Thanks.

[toc] | [next] | [standalone]


#24326

FromEd Jay <edMbj@aes-intl.com>
Date2014-05-21 11:56 -0700
Message-ID<vhtpn9hkbcgn4gukvedr4a4on42ekc6l5v@4ax.com>
In reply to#24314
bit-naughty@hotmail.com wrote:

>....in JS? And have it interact WITH the page, ie. show a menu with options on it that might change the page in some way....? (either the rest of the page OR inside the canvas).
>
canvas.addEventListener("mousedown", getMouseClick, false);

function getMouseClick(event) {
if (event.which == 3) {
//do your thing//
}
}

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info

[toc] | [prev] | [next] | [standalone]


#24342

Frombit-naughty@hotmail.com
Date2014-05-22 06:22 -0700
Message-ID<33226af2-793a-416c-9314-59ba8b60d2b1@googlegroups.com>
In reply to#24326
On Thursday, May 22, 2014 12:26:24 AM UTC+5:30, Ed Jay wrote:

> 
> canvas.addEventListener("mousedown", getMouseClick, false);
> 
> 
> 
> function getMouseClick(event) {
> 
> if (event.which == 3) {
> 
> //do your thing//
> 
> }
> 
> }
> 
> 
> 
> -- 
> 
> Ed Jay (remove 'M' to reply by email)
> 


Thanks Ed! :)


What does "which" mean?

[toc] | [prev] | [next] | [standalone]


#24344

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2014-05-22 16:42 +0200
Message-ID<859a2$537e0cde$6def49ce$31406@nntpswitch.blueworldhosting.com>
In reply to#24342
2014-05-22 15:22, bit-naughty@hotmail.com wrote:
> On Thursday, May 22, 2014 12:26:24 AM UTC+5:30, Ed Jay wrote:
[...]
>> function getMouseClick(event) {
>>
>> if (event.which == 3) {
[...]

> What does "which" mean?

https://developer.mozilla.org/en-US/docs/Web/API/event.which

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#24345

FromEd Jay <edMbj@aes-intl.com>
Date2014-05-22 08:55 -0700
Message-ID<0e7sn9135aooge27ke7o5msbel5fa68k3v@4ax.com>
In reply to#24342
bit-naughty@hotmail.com wrote:

>On Thursday, May 22, 2014 12:26:24 AM UTC+5:30, Ed Jay wrote:
>
>> 
>> canvas.addEventListener("mousedown", getMouseClick, false);
>> 
>> 
>> 
>> function getMouseClick(event) {
>> 
>> if (event.which == 3) {
>> 
>> //do your thing//
>> 
>> }
>> 
>> }
>>
>Thanks Ed! :)
>
>What does "which" mean?
>
Which mouse button is pressed.
1 = left
2 = middle
3 = right

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info

[toc] | [prev] | [next] | [standalone]


#24327

Fromrescattered@gmail.com
Date2014-05-21 13:08 -0700
Message-ID<1270b7cc-591e-48cf-a285-16b97beec7d9@googlegroups.com>
In reply to#24314
On Wednesday, May 21, 2014 10:34:12 AM UTC-4, bit-n...@hotmail.com wrote:
> ....in JS? And have it interact WITH the page, ie. show a menu with options on it that might change the page in some way....? (either the rest of the page OR inside the canvas).
> 
> 
> 
> 
> 
> Thanks.

Here is a very nice example of the sort of things that you can do with
javascript and canvas. Note how the code is triggered by the mousemove event:

http://codepen.io/soulwire/pen/Ffvlo

[toc] | [prev] | [next] | [standalone]


#24330

FromEd Jay <edMbj@aes-intl.com>
Date2014-05-21 16:35 -0700
Message-ID<o0eqn9tof6qdgebrro3vfvi8mfqnho6mdb@4ax.com>
In reply to#24327
rescattered@gmail.com wrote:

>On Wednesday, May 21, 2014 10:34:12 AM UTC-4, bit-n...@hotmail.com wrote:
>> ....in JS? And have it interact WITH the page, ie. show a menu with options on it that might change the page in some way....? (either the rest of the page OR inside the canvas).
>
>Here is a very nice example of the sort of things that you can do with
>javascript and canvas. Note how the code is triggered by the mousemove event:
>
>http://codepen.io/soulwire/pen/Ffvlo

Cool! Good job.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info

[toc] | [prev] | [next] | [standalone]


#24334

FromJohn C <rescattered@gmail.com>
Date2014-05-21 18:49 -0700
Message-ID<c1aebb32-6b6b-4226-8f7d-3db1480f52df@googlegroups.com>
In reply to#24330
On Wednesday, May 21, 2014 7:35:30 PM UTC-4, Ed Jay wrote:
> rescattered@gmail.com wrote:
> 
> 
> 
> >On Wednesday, May 21, 2014 10:34:12 AM UTC-4, bit-n...@hotmail.com wrote:
> 
> >> ....in JS? And have it interact WITH the page, ie. show a menu with options on it that might change the page in some way....? (either the rest of the page OR inside the canvas).
> 
> >
> 
> >Here is a very nice example of the sort of things that you can do with
> 
> >javascript and canvas. Note how the code is triggered by the mousemove event:
> 
> >
> 
> >http://codepen.io/soulwire/pen/Ffvlo
> 
> 
> 
> Cool! Good job.
> 
> 
> 
> -- 
> 
> Ed Jay (remove 'M' to reply by email)
> 
> 
> 
> Win the War Against Breast Cancer.
> 
> Knowing the facts could save your life. 
> 
> http://www.breastthermography.info

I was blown-away when I first saw that. I am amazed at how *fast* javascript
has become in modern browsers and how slick the canvas element is. 

I came across this particle animation through the following site:

http://davidwalsh.name/canvas-demos

enjoy 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web