From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69602: 29.1; Image :map should adjust with :scale and :rotation Date: Thu, 07 Mar 2024 09:04:06 +0200 Message-ID: <86jzmejzfd.fsf@gnu.org> References: <87msramv72.fsf@breatheoutbreathe.in> Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27464"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69602@debbugs.gnu.org, stephen.berman@gmx.net, juri@linkov.net To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 07 08:05:09 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ri7oS-0006pz-NQ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Mar 2024 08:05:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ri7o1-0005n0-G9; Thu, 07 Mar 2024 02:04:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ri7ns-0005mT-Fu for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 02:04:34 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ri7nq-0000Qy-T6 for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 02:04:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ri7oL-0003dw-NH for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2024 02:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Mar 2024 07:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69602 X-GNU-PR-Package: emacs Original-Received: via spool by 69602-submit@debbugs.gnu.org id=B69602.170979508913983 (code B ref 69602); Thu, 07 Mar 2024 07:05:01 +0000 Original-Received: (at 69602) by debbugs.gnu.org; 7 Mar 2024 07:04:49 +0000 Original-Received: from localhost ([127.0.0.1]:52356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri7o9-0003dS-4B for submit@debbugs.gnu.org; Thu, 07 Mar 2024 02:04:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ri7o7-0003dF-2w for 69602@debbugs.gnu.org; Thu, 07 Mar 2024 02:04:48 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ri7nU-0000Ns-P2; Thu, 07 Mar 2024 02:04:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:Subject:In-Reply-To:To:From: Date; bh=uQxCLQTEz7Ssg4ccavf5IHZyg1DqxxQlFX2lvtAHGiU=; b=idVBkOSvbevV7hWye/hb wvIbG1jz29+3lNd3cwJmoOx2UmBxdHtXebLBeXAKe4FpztryXKrLFKtUEkZqp9ZeARlTGYEInxWRA KkeDfKlNuH/tUbjI+NAcnXkuKwzV/NFIuXLwFfJuUUtQuqcBuyuBPTqL92hh56/0ME2qq0Vi40qEr t2sIyw1BBIfL9C/Owex4mxRYLTyTH5+b5CqYwguTXtu6ML9c4XXp4HNRDQY1ApUyUNQDXnq+FuqyC jdlIA1vEb+iaS5SbZf3Hlkyt9lS1YKjllaJsITW4nAm87Sz+KpTvuYpRCcxKMwo/C+CThHU+roq4w B5ZAqD4u7Qy7kw==; In-Reply-To: <87msramv72.fsf@breatheoutbreathe.in> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281147 Archived-At: > Cc: Stephen Berman , Juri Linkov > Date: Wed, 06 Mar 2024 21:37:50 -0800 > From: Joseph Turner via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" >=20 > Currently, when running `image-increase-size' or `image-decrease-size' > on an image with a :map property, the image scales but the image map > does not. For example, run the following snippet: >=20 > (with-current-buffer (get-buffer-create "*image-properties-test*") > (let ((svg "\n\n\n\n= \n\norggraphview\n\n\n\na\n\n\nHover me!\n\n\n\n\n\n") > (map '(((circle (85 . 85) . 80) "1" (help-echo "Surprise!")))) > (inhibit-read-only t)) > (erase-buffer) > (insert-image (create-image svg 'svg t :map map)) > (goto-char (point-min)) > (pop-to-buffer (current-buffer)))) >=20 > Hovering the circle alters the pointer style and displays the tooltip. >=20 > Now run `M-x image-increase-size' or press "i +". While the image > becomes larger, the area which activates the tooltip remains the same. >=20 > See earlier discussion here: >=20 > https://yhetil.org/emacs-devel/87r0gng41l.fsf@ushin.org/T/#t >=20 > While a proper solution perhaps belongs on the C side, the following > workaround adds an :unscaled-map property to images and sets :map > according to :unscaled-map and :scale whenever :scale changes. The ELisp manual says about :map: Note that the map's coordinates should reflect the displayed image after all transforms have been done (rotation, scaling and so on), and also note that Emacs (by default) performs auto-scaling of images, so to make things match up, you should either specify =A1=AE:scale 1.0=A1=AF when creating the image, or use the result of =A1=AEimage-compute-scaling-factor=A1=AF to compute the elements of th= e map. Can this technique help?