[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69602: 29.1; Image :map should adjust with :scale and :rotation
From: |
Eli Zaretskii |
Subject: |
bug#69602: 29.1; Image :map should adjust with :scale and :rotation |
Date: |
Thu, 07 Mar 2024 09:04:06 +0200 |
> Cc: Stephen Berman <stephen.berman@gmx.net>, Juri Linkov <juri@linkov.net>
> 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" <bug-gnu-emacs@gnu.org>
>
> 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:
>
> (with-current-buffer (get-buffer-create "*image-properties-test*")
> (let ((svg "<?xml version=\"1.0\" encoding=\"UTF-8\"
> standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n
> \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by
> graphviz version 2.43.0 (0)\n -->\n<!-- Title: orggraphview Pages: 1
> -->\n<svg width=\"128pt\" height=\"128pt\"\n viewBox=\"0.00 0.00 127.59
> 127.59\" xmlns=\"http://www.w3.org/2000/svg\"
> xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\"
> class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4
> 123.59)\">\n<title>orggraphview</title>\n<polygon fill=\"white\"
> stroke=\"transparent\" points=\"-4,4 -4,-123.59 123.59,-123.59 123.59,4
> -4,4\"/>\n<!-- a -->\n<g id=\"node1\" class=\"node\">\n<title>a</title>\n<g
> id=\"a_node1\"><a xlink:href=\"1\" xlink:title=\"Hover me!\">\n<ellipse
> fill=\"none\" stroke=\"black\" cx=\"59.79\" cy=\"-59.79\" rx=\"59.59\"
> ry=\"59.59\"/>\n<text text-anchor=\"middle\" x=\"59.79\" y=\"-56.09\"
> font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">Hover
> me!</text>\n</a>\n</g>\n</g>\n</g>\n</svg>\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))))
>
> Hovering the circle alters the pointer style and displays the tooltip.
>
> Now run `M-x image-increase-size' or press "i +". While the image
> becomes larger, the area which activates the tooltip remains the same.
>
> See earlier discussion here:
>
> https://yhetil.org/emacs-devel/87r0gng41l.fsf@ushin.org/T/#t
>
> 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
‘:scale 1.0’ when creating the image, or use the result of
‘image-compute-scaling-factor’ to compute the elements of the map.
Can this technique help?
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation,
Eli Zaretskii <=
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/07
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Eli Zaretskii, 2024/03/08
- bug#69602: 29.1; Image :map should adjust with :scale and :rotation, Joseph Turner, 2024/03/21