Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Memory fault -- core...uh...um...core... Oh dammit, I forget!


devel / comp.lang.javascript / Re: Click on Non-transparent Part of an Image

SubjectAuthor
* Click on Non-transparent Part of an ImageAndrew Poulos
+- Re: Click on Non-transparent Part of an ImageJJ
`* Re: Click on Non-transparent Part of an ImageMichael Haufe (TNO)
 `* Re: Click on Non-transparent Part of an ImageAndrew Poulos
  `- Re: Click on Non-transparent Part of an ImageArno Welzel

1
Click on Non-transparent Part of an Image

<f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18085&group=comp.lang.javascript#18085

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ad4:4b25:0:b0:56c:1704:b11c with SMTP id s5-20020ad44b25000000b0056c1704b11cmr1592983qvw.7.1679870588189;
Sun, 26 Mar 2023 15:43:08 -0700 (PDT)
X-Received: by 2002:a9d:7c83:0:b0:69f:5701:de09 with SMTP id
q3-20020a9d7c83000000b0069f5701de09mr3106510otn.6.1679870587927; Sun, 26 Mar
2023 15:43:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Sun, 26 Mar 2023 15:43:07 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=210.185.107.70; posting-account=XP9MJQoAAADAmF-apG2TV85bd63biw4S
NNTP-Posting-Host: 210.185.107.70
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>
Subject: Click on Non-transparent Part of an Image
From: approg@gmail.com (Andrew Poulos)
Injection-Date: Sun, 26 Mar 2023 22:43:08 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1234
 by: Andrew Poulos - Sun, 26 Mar 2023 22:43 UTC

Is there a way to detect a click only on the non-transparent part of an image?

That is, a click on a transparent part works as if pointer-events is set to none and a click on a non-transparent part works as if pointer-events is set to auto.

Re: Click on Non-transparent Part of an Image

<14ndtbnnthbsa$.vkq0qcd507ev.dlg@40tude.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18086&group=comp.lang.javascript#18086

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: jj4public@outlook.com (JJ)
Newsgroups: comp.lang.javascript
Subject: Re: Click on Non-transparent Part of an Image
Date: Mon, 27 Mar 2023 20:24:57 +0700
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <14ndtbnnthbsa$.vkq0qcd507ev.dlg@40tude.net>
References: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="bbbe53bf6d889f437071c18941d717d9";
logging-data="3407037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/M3QFGhxEr7/GPmLSc/LmtAzqA6O8Fo0="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:EDAgjhB1OpL+aR6tCSfQ0yoD33s=
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
 by: JJ - Mon, 27 Mar 2023 13:24 UTC

On Sun, 26 Mar 2023 15:43:07 -0700 (PDT), Andrew Poulos wrote:
> Is there a way to detect a click only on the non-transparent part of an
> image?

Keep the image on a hidden CANVAS of the same size. Use the IMG click
coordinate to retrieve the pixel value from the CANVAS. Check the alpha
channel value of the pixel.

> That is, a click on a transparent part works as if pointer-events is set
> to none and a click on a non-transparent part works as if pointer-events
> is set to auto.

That may not work as expected, depending on how the IMG element and its
container elements are styled. The click coordinate may not be same as the
IMG element's bounding area.

As long as an element (e.g. the IMG) has `pointer-events:none` style, it
will not trigger a click event. Only its container elements will trigger the
event - assuming that they're not also styled with `pointer-events:none`.

Re: Click on Non-transparent Part of an Image

<f7ddb082-a6c8-4105-8fb9-bf1beb4dfacen@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18088&group=comp.lang.javascript#18088

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a05:622a:180d:b0:3df:4392:1aff with SMTP id t13-20020a05622a180d00b003df43921affmr7699675qtc.6.1680108029449;
Wed, 29 Mar 2023 09:40:29 -0700 (PDT)
X-Received: by 2002:a05:6871:4d93:b0:17e:f024:b914 with SMTP id
uh19-20020a0568714d9300b0017ef024b914mr5606380oab.8.1680108029139; Wed, 29
Mar 2023 09:40:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Wed, 29 Mar 2023 09:40:28 -0700 (PDT)
In-Reply-To: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6000:8900:6915:d90e:8808:75:6cc1;
posting-account=hYRygAoAAABkmvJVmPilz9Q1TOjgPQAq
NNTP-Posting-Host: 2603:6000:8900:6915:d90e:8808:75:6cc1
References: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f7ddb082-a6c8-4105-8fb9-bf1beb4dfacen@googlegroups.com>
Subject: Re: Click on Non-transparent Part of an Image
From: tno@thenewobjective.com (Michael Haufe (TNO))
Injection-Date: Wed, 29 Mar 2023 16:40:29 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1882
 by: Michael Haufe (TNO) - Wed, 29 Mar 2023 16:40 UTC

On Sunday, March 26, 2023 at 5:43:12 PM UTC-5, Andrew Poulos wrote:
> Is there a way to detect a click only on the non-transparent part of an image?
>
> That is, a click on a transparent part works as if pointer-events is set to none and a click on a non-transparent part works as if pointer-events is set to auto.

You can use css clip-path to define clickable areas.

<https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path>

Example usage:

<https://codepen.io/mlhaufe/pen/YzOMOGv?editors=1100>

clicking on the clipped areas will not trigger an alert but the visible portions will

Re: Click on Non-transparent Part of an Image

<a704d822-b62b-4df8-8628-c7ad55769d0an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18090&group=comp.lang.javascript#18090

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:5905:0:b0:3e1:5755:7bbf with SMTP id 5-20020ac85905000000b003e157557bbfmr12102718qty.5.1680391005825;
Sat, 01 Apr 2023 16:16:45 -0700 (PDT)
X-Received: by 2002:a05:6830:119:b0:69f:15f4:aa8 with SMTP id
i25-20020a056830011900b0069f15f40aa8mr4601476otp.0.1680391005510; Sat, 01 Apr
2023 16:16:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Sat, 1 Apr 2023 16:16:45 -0700 (PDT)
In-Reply-To: <f7ddb082-a6c8-4105-8fb9-bf1beb4dfacen@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=210.185.107.70; posting-account=XP9MJQoAAADAmF-apG2TV85bd63biw4S
NNTP-Posting-Host: 210.185.107.70
References: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com> <f7ddb082-a6c8-4105-8fb9-bf1beb4dfacen@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a704d822-b62b-4df8-8628-c7ad55769d0an@googlegroups.com>
Subject: Re: Click on Non-transparent Part of an Image
From: approg@gmail.com (Andrew Poulos)
Injection-Date: Sat, 01 Apr 2023 23:16:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2291
 by: Andrew Poulos - Sat, 1 Apr 2023 23:16 UTC

On Thursday, 30 March 2023 at 03:40:33 UTC+11, Michael Haufe (TNO) wrote:
> On Sunday, March 26, 2023 at 5:43:12 PM UTC-5, Andrew Poulos wrote:
> > Is there a way to detect a click only on the non-transparent part of an image?
> >
> > That is, a click on a transparent part works as if pointer-events is set to none and a click on a non-transparent part works as if pointer-events is set to auto.
> You can use css clip-path to define clickable areas.
>
> <https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path>
>
> Example usage:
>
> <https://codepen.io/mlhaufe/pen/YzOMOGv?editors=1100>
>
> clicking on the clipped areas will not trigger an alert but the visible portions will

Thanks for the replies. Alas the image doesn't have regular shaped transparent parts and using a secondary canvas won't work as well as I'd like.

I need to wait till something like point-events: painted works on images other than SVG. Maybe I'll look at embedding an image in an SVG?

Re: Click on Non-transparent Part of an Image

<k8t2g1F8p01U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18091&group=comp.lang.javascript#18091

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.javascript
Subject: Re: Click on Non-transparent Part of an Image
Date: Sun, 2 Apr 2023 12:08:02 +0200
Lines: 40
Message-ID: <k8t2g1F8p01U1@mid.individual.net>
References: <f9289988-25e5-4e02-bc92-cf39c69be08dn@googlegroups.com>
<f7ddb082-a6c8-4105-8fb9-bf1beb4dfacen@googlegroups.com>
<a704d822-b62b-4df8-8628-c7ad55769d0an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net /HhM0eAjDamPq6UDu2Mi1wNHLxD/NZ9+dytx4PBmSaxauspO44
Cancel-Lock: sha1:Jq5I+djYO7yLSvojUqUEM1OeghY=
Content-Language: de-DE
In-Reply-To: <a704d822-b62b-4df8-8628-c7ad55769d0an@googlegroups.com>
 by: Arno Welzel - Sun, 2 Apr 2023 10:08 UTC

Andrew Poulos, 2023-04-02 01:16:

> On Thursday, 30 March 2023 at 03:40:33 UTC+11, Michael Haufe (TNO)
> wrote:
>> On Sunday, March 26, 2023 at 5:43:12 PM UTC-5, Andrew Poulos wrote:
>>
>>> Is there a way to detect a click only on the non-transparent part
>>> of an image?
>>>
>>> That is, a click on a transparent part works as if pointer-events
>>> is set to none and a click on a non-transparent part works as if
>>> pointer-events is set to auto.
>> You can use css clip-path to define clickable areas.
>>
>> <https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path>
>>
>> Example usage:
>>
>> <https://codepen.io/mlhaufe/pen/YzOMOGv?editors=1100>
>>
>> clicking on the clipped areas will not trigger an alert but the
>> visible portions will
>
> Thanks for the replies. Alas the image doesn't have regular shaped
> transparent parts and using a secondary canvas won't work as well as
> I'd like.

clip-path can also be a complex path:

For example:

clip-path: path('M 0 200 L 0,75 A 5,5 0,0,1 150,75 L 200 200 z');

Also see <https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path>

--
Arno Welzel
https://arnowelzel.de

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor