SVG drag and drop - svg

Please can someone help?
I need to drag and drop small spot circles representing room sensors onto a floor Layout rendered inline (binary) into the browser.
How can I achieve this.

Download the SVG, add points via SVG program (for example InkScape), upload the SVG again.
If the SVG is displayed completely as a file in your browser (i.e. the URL ends with ".svg" or something like that), so the browser handles the drag and drop, which probably isn't implemented to work with SVG in any way, as your browser is probably not layed out to edit SVG files.
If the SVG is embedded somehow into an HTML site you might have a chance if you use JavaScript or something alike to edit the SVG in the browser, implying you can change the JavaScript on that site because you can access it or have a plugin for that.
Oh yeah, maybe there is a plugin for your browser to edit SVGs, who knows?

Related

SVG works different under different cases

ehm, right now I'm trying to vectorize and old logo my friend did for a club at my uni. I have the logo as .ai and find a converter to svg.
When I open that converted svg logo in my browser it appears great.
Here's a print screen of how it looks in firefox.
Also, when i open the logo on Inkscape, it also appears great.
Here's how it looks on Inkscape.
Nevertheless, when I open it on Corel Draw, it is a complete mess.
How it looks in corel.
I found that some of the objects are causing some trouble, the stars and some other things. If i delete them, the logo appears a little bit more understandable in corel, but still doesn't look great. Logo with less details.
I'm trying to use the logo to make some banners, posters and things like that, and the printer can't use that version of the logo because they use corel.
Does someone know why is that happening and how to correct the issue?
I'm gonna left the .ai as the .svg in case somebody need them to undestand the issue. ai and svg.

Absolute Positioning of Text in a Dynamically Sized SVG

I have an SVG graphic that I want to put some text on from my PHP variables. The graphic was generated in Illustrator and resizes in my web page to 100% width. Here is a representation of it:
How could this be done for the 8 text items? Does something special need to be done in Illustrator, like creating an anchor point for the text? How do I update the text item? I've done research but haven't been able to find a similar situation.
Thankful for any information that could help me narrow down my search.
Being someone who has never worked with files of .SVG file type before, this was a misunderstanding.
If you design a graphic in Adobe Illustrator, save it as an SVG and edit it with your favorite text editor, you will be able to see the SVG mark-up. It all makes sense now, and here you will be able to change the text at the code-level.
For my application, I saved the SVG as a PHP file and did an include on it, while changing the raw text to PHP variables in said file. This allowed me to pass my dynamic text as variables to the graphic.

SVG file looks different in webbrowser than in Illustrator

I've been doing some stuff in Illustrator and I have a problem with saving a project in to SVG file that I open in webbrowser, It just looks different.
And it hapens only in SVG, if I save it to PDF or PNG it looks how it should.
What am I doing wrong?
That's how it looks in Ai
That's how it looks in webbrowser
Here's a link to download rar file with .ai and .svg that I have.
Since all browsers render it the same way, it would seem likely that this is a bug in the AI SVG export filter.
To me it looks like you are applying a blend mode ("Overlay" perhaps?) to the white parts on top of the image. That effect ought to be reproducible using SVG filters, but perhaps AI's exporter doesn't support that yet.
If you are using an "odd" blend mode, try changing it, or reproducing the effect another way.
Individual pixel control needed in identical svg conversion is not possible. SVG creates only specific shapes. The Ai app conversion seems to use opacity to provide the color shades. You could probably tweek opacity and add some svg filters to improve the svg.
Print your design in a . pdf file instead of exporting it directly. Then open the printed .pdf back in Illustrator and export the .svg from this one, it shoud do the trick.

Center screen at a SVG object

I'm developing a gps tracking app for android using custom SVG maps. I can print my exact position at the SVG map through the device's GPS but I'm having some difficulties when I want to pan/center the screen at my position. Basically the idea is to keep moving/panning the map automatically while i'm moving so the user won't have to do it by himself. I'm using the jquery.panzoom (https://github.com/timmywil/jquery.panzoom). Has anyone did this before, would appreciate any suggestions. Thanks
You could try using SVG fragment identifiers.
http://www.w3.org/TR/SVG11/linking.html#SVGFragmentIdentifiers
Basically you can supply a viewBox in the URL of the SVG you are linking to. That's assuming you are using an external SVG file (ie not embedded).
So for instance, if you want to show the top left 200x200 of an SVG, you can do:
http://url.of.my.svg/map.svg#svgView(viewBox(0,0,200,200))
An example: http://upload.wikimedia.org/wikipedia/commons/2/21/New_Zealand_location_map.svg#svgView(viewBox(800,1600,400,400))
Then when the GPS position changes, you just update the URL. It saves having to mess about with the contents of the file.
The only proviso is that I haven't checked that the Android WebView supports it. I'm assuming you are using a WebView??

foreignobject in svg

How to change the height and width of textarea (or any html element) from javascript which is inside foreign object in svg.Moreover, can I drag an html elelment and drop on svg container by any mean (htm5 any hint) or atleast can I get the coordinates on svg during draging so that I can implement my own drag and drop. Thanks in advance
You appear to my eye to have at least two distinct questions. If I understand correctly, the first one is something like this: how can you write JavaScript within an SVG instance so that you can embed the SVG instance and have the JS control the embedding HTML? Do I have that right?
If so, the answer can be constructed from the parts of http://phaseit.net/examples/SVG4/c1.html and related examples. Briefly, write "window.top" to reach the HTML reference.
The same sort of reference gives access to HTML5 drag-and-drop, if that's what you're after.
Is that the level of answer you're after, or do you need an executable example?
LATER, AFTER MORE DISCUSSION: it appears that http://phaseit.net/examples/SVG5/embedding.svg is more like what you're after. Do I have that right, Arslan Ahson? What you should see when you display the SVG instance there is an SVG-coded elliptical button which, when pushed, toggles the appearance (background color and width) of a nearby embedded HTML textarea.

Resources