Get separated element by it's id.
See original GitHub issueHi,
Is there a way I could get some portion of the drawing by it’s “id” attribute? I’m currently loading the drawing via SvgViewBox
but from what I see this only produces raw GeometryDrawing
instances on drawing canvas that I cannot identify. Is there any way I can do this at the moment?
On top page you wrote “Interaction with the conversion process (by a visitor pattern) to allow for custom hyper-link implementations, font substitutions etc.” by I’m not sure if this is what I need and can’t find example of that.
Basically I have drawn some buttons in illustrator and would like modify some basic stuff at runtime - toggle visibility, maybe change some background, or size. Can I force converter to output WPF Grids for named elements?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
how can I use split inside of getElementById("demo") to get ...
Can this be done with XMLHttpRequest , getElementById , and the split command to make multiple id tags based on a character that...
Read more >Get part of element ID - javascript
I am getting the number part of the container ID that the button is in. Now I am wondering if I need to...
Read more >Searching: getElement*, querySelector*
If an element has the id attribute, we can get the element using the method document.getElementById(id) , no matter where it is.
Read more >How to Get Elements by Class, ID, Tag Name, or Selector in ...
This tutorial will teach you how to access DOM elements in JavaScript with the help of their class, id, tag name or selectors....
Read more >HTML DOM Element id Property
The id property sets or returns the value of an element's id attribute. Note. An id should be unique within a page. See...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Really nice work you are doing with this stuff, highly impressive.
True, the initial release was experimental and the updated version even add more information to the drawings that are not needed except when you need the features in
WpfDrawingDocument
. So, I made it optional, you have to set the a new property,InteractiveMode
to eitherSvgInteractiveModes.Standard
orSvgInteractiveModes.Advanced
. For now there is no difference between the Standard and Advanced modes. For the advanced mode, I am thinking about something in line with your work but by rendering each individual drawing toDrawingVisual
, which is still lighter object but supports interactivities unlike theDrawing
objects.I have posted a pull request to your repository, so you can take a look at the updates to make it work.
It is one of the puzzle I have still not resolved yet. At the WPF low-level, that flexibility of simple changing characters is not there, so you may need to recreate the
GlyphRunDrawing
or set bothGlyphRun.Characters
andGlyphRun.GlyphIndices
, I have not tried it.The main problem is when the text is rendered as
PathGeometry
, there you cannot even tell the original character contents.WpfDrawingDocument
contains the SVG DOM orSvgDocument
object instanceWpfDrawingDocument.Document
, which is an extension of the .NETXmlDocument
class, so you can query it for all other contents. If necessary, we can support theInkscape
contents like the metadata contents element,SvgMetadataElement
; saySvgInkscapeElement
with specialized properties to make things easier.Hello, I actually didn’t expect from you to be that quick 😃 I’ve only find out that you responded about half a year ago and I played around with this but I didn’t finish what I wanted, then I couldn’t find the project I made and now I just moved back to in yesterday and made some progress.
So this seem to work. I made a little explorer class based on the
WpfDrawingDocument
to manipulate the image easier. It may not fit your programming style but it works nice for me, and the ids do work.Now, I still didn’t figure out few things.
Initially I added this project to my local repo of SharpVectors and it works from there. However when I extracted this to separate solution and installed latest SharpVectors nuget package the
WpfDrawingDocument.DrawingNames
don’t sore any name. Do I need to specify some additional configuration for the properties. Here is the link for this solution.I would like to be able to change text of the
<text>
element. But I’m not sure how to do this. I tried to setCharacters
property ofGlyphRunDrawing
, but this gives me an exception. I’m also not sure if a new text would be properly placed. Can you give me some hints? How you set up these glyph runs?I concerned about object’s transform’s center. Inkscape exports path with absolute coordinates or relative to layer and produced WPF drawings seem to reflect that. However this is not ideal when I rotate or scale an object. I can set pivot point relative to AABB of the drawing and this works ok in most scenarios. However there are some object for which this is not desirable. For example the AABB of a star may not be in it’s center. For star I can calculate center of a mass to rote it in place, however there are still some other scenarios where it would be nice to specify pivot in a drawing software. For example if I would like to animate pointer of a gauge, it’s practically impossible to figure out the point in code:
When I move the point in Inkscape, I see Inkscape saves this as
inkscape:transform-center-x/y
. This suggest that defining such point is not native for SVG, so you probably will not support it. Perhaps maybe there is a way I can access whole original svg element that is associated with the drawing similar to how I accessWpfDrawingDocument.DrawingNames
?