This is about a difficulty that I encounter when fine-lined objects are endowed with hyperlinks (and my previous post): To activate such a link you must click on a sometimes fine line or alternatively a group of those objects with some bigger object in the background to get browser-like behavior, i.e. to have a somewhat “wider” area to click on.
I can do that.
A transparent rectangle gets an attribute pointer-events:all, as suggested on Gitlab. It is grouped with the originally linked object and the link is copied either for the rectangle or the compound object.
I have started to automate this process with an xml-munging routine, but for the time need further insight to understand <path/> definitions, especially where objects consist of several paths or paths are interrupted (subsequent 'm', 'M', after 'z').
This will not be an extension but an external program, to which I feed a SVG file. I do not understand extensions and need a batch-routine, anyway.
I am still struggling with the SVG code and understand that I am about to calculate a “Bounding Box” for compound objects.
The fact alone, that the name “Bounding Box” appears to exist for a long time, makes me doubt.
Here is the question: Am I really the first one who considers hyperlinks on fine-lined objects inconvenient to click on and does really nothing exist already that automatically “widens” the clickable area of such an object?
I like programming, but this precise task occupies me for too long to be called fun anymore...
How about duplicating the object(s),outsetting the duplicates a dozen pixels, setting their paint transparency to 1% (or better: 01 hex is less than half a percent), then grouping.
This is another way around the core problem of hitting fine-lined objects with the mouse-pointer. Thanks for the idea.
But it does not appear to cause less (nor more) work than my transparent rectangle. As all is possible in Inkscape and its rather cool XML-editor, my quest concerns SVG-files with several or many links, each, where I seek automation.
I have seen an Inkscape extension which creates a frame covering the Bounding Box of a path. This is part of the task, and I do not comprehend anything in the code. I am not familiar enough with Python, and less with all the modules or libraries involved.
If I continue sporadically my effort to program a utility, it must be in Ruby or C++. Once I have asked for a textual description of the way that path definitions must be read (or parsed). I can advance on my own, but now I hurt myself against transformations...
It is certain that a bunch of people have solved these very problems. If only there was something to read, outside of the context of any precise programming environment.
It depends upon the program which is rendering the svg.
If it is a browser - it may be a lot simpler than you think. In fact in many ways it's much easier to manipulate some aspects of svgs with browser javascript than it is with python.
Loop through paths, use clone node to create a copy of the object. Give the object a unique ID, - for example a suffix of _mclone append the clone object to the document with a much higher z-index.
Change the clone objects style to have a fill and a stroke, then set the fill-opacity and stroke opacity to 0.
Set an onmouseover event to trigger your function - that's it.
[ edit in fact - it might just be a better idea to set at 'fat stroke', also note z-order does not exist in svg, just paint order]
😉 I might have a hammer somewhere, but would not consider every problem a nail.
For the time, I prefer to exclude the Browser from creating content and rather want to present the final result of my own creative work, as is and fully functional. Basically, none of the things I try to achieve are *necessary* in any sense of the word. It is still the idea to produce “handwritten web-pages” which occupies me. If the Browser is more capable than myself, I do not want to care about that, now.
Thank you anyway. CSS and JavaScript had been my close friends when I had to write Web-Interfaces and even programmed for money. I do luckily not have to do that anymore.
Edit: JavaScript is one answer to the question in my OP. I see, that there are other ways to achieve the same and make fine-lined objects easier to click on. Also, as Inklinea suggested, techniques that I am less inclined to use, appear simpler to other people and the solution obvious.
Maybe I address a non-problem.
Edit II: here is an incomplete version of my current pass-time (tar.xz, 4.4M), containing some links. Page 9 is work in progress, 10 to 20 are untouched, just vectorized.
Good evening.
“The Question” follows below.
This is about a difficulty that I encounter when fine-lined objects are endowed with hyperlinks (and my previous post): To activate such a link you must click on a sometimes fine line or alternatively a group of those objects with some bigger object in the background to get browser-like behavior, i.e. to have a somewhat “wider” area to click on.
I can do that.
A transparent rectangle gets an attribute pointer-events:all, as suggested on Gitlab. It is grouped with the originally linked object and the link is copied either for the rectangle or the compound object.
I have started to automate this process with an xml-munging routine, but for the time need further insight to understand <path/> definitions, especially where objects consist of several paths or paths are interrupted (subsequent 'm', 'M', after 'z').
This will not be an extension but an external program, to which I feed a SVG file. I do not understand extensions and need a batch-routine, anyway.
I am still struggling with the SVG code and understand that I am about to calculate a “Bounding Box” for compound objects.
The fact alone, that the name “Bounding Box” appears to exist for a long time, makes me doubt.
Here is the question: Am I really the first one who considers hyperlinks on fine-lined objects inconvenient to click on and does really nothing exist already that automatically “widens” the clickable area of such an object?
I like programming, but this precise task occupies me for too long to be called fun anymore...
Well, I can't recall anyone asking the question.
How about duplicating the object(s),outsetting the duplicates a dozen pixels, setting their paint transparency to 1% (or better: 01 hex is less than half a percent), then grouping.
This is another way around the core problem of hitting fine-lined objects with the mouse-pointer. Thanks for the idea.
But it does not appear to cause less (nor more) work than my transparent rectangle. As all is possible in Inkscape and its rather cool XML-editor, my quest concerns SVG-files with several or many links, each, where I seek automation.
I have seen an Inkscape extension which creates a frame covering the Bounding Box of a path. This is part of the task, and I do not comprehend anything in the code. I am not familiar enough with Python, and less with all the modules or libraries involved.
If I continue sporadically my effort to program a utility, it must be in Ruby or C++. Once I have asked for a textual description of the way that path definitions must be read (or parsed). I can advance on my own, but now I hurt myself against transformations...
It is certain that a bunch of people have solved these very problems. If only there was something to read, outside of the context of any precise programming environment.
Thank you anyway.
It depends upon the program which is rendering the svg.
If it is a browser - it may be a lot simpler than you think. In fact in many ways it's much easier to manipulate some aspects of svgs with browser javascript than it is with python.
Loop through paths, use clone node to create a copy of the object. Give the object a unique ID, - for example a suffix of _mclone append the clone object to the document with a much higher z-index.
Change the clone objects style to have a fill and a stroke, then set the fill-opacity and stroke opacity to 0.
Set an onmouseover event to trigger your function - that's it.
[ edit in fact - it might just be a better idea to set at 'fat stroke', also note z-order does not exist in svg, just paint order]
😉 I might have a hammer somewhere, but would not consider every problem a nail.
For the time, I prefer to exclude the Browser from creating content and rather want to present the final result of my own creative work, as is and fully functional. Basically, none of the things I try to achieve are *necessary* in any sense of the word. It is still the idea to produce “handwritten web-pages” which occupies me. If the Browser is more capable than myself, I do not want to care about that, now.
Thank you anyway. CSS and JavaScript had been my close friends when I had to write Web-Interfaces and even programmed for money. I do luckily not have to do that anymore.
Edit: JavaScript is one answer to the question in my OP. I see, that there are other ways to achieve the same and make fine-lined objects easier to click on. Also, as Inklinea suggested, techniques that I am less inclined to use, appear simpler to other people and the solution obvious.
Maybe I address a non-problem.
Edit II: here is an incomplete version of my current pass-time (tar.xz, 4.4M), containing some links. Page 9 is work in progress, 10 to 20 are untouched, just vectorized.
[other edits: Kraut2English]