Both. In SVG we're actually struggling with the same (or rather similar) issue.
There’s a big difference between: <div><svg><rect/></svg><svg><circle/></svg></div> and <div><svg><g><rect/><circle/></g></svg></div> Each svg has its own coordinate space, and svg elements cannot have transform properties. This is proving to be quite difficult in terms of transformations. Ideally, it should be easy to pick whether you want to wrap each shape in its own SVG element or have them all in the same svg element (or g element). Currently GraphicShape draws each shape with its own svg wrapper. CompoundShape, on the other hand, draws separate objects within a single svg element. GraphicContainer takes svg-type elements as children, but does not care exactly which type. I think there should also be a GraphicGroup object which would be a g element and take children. I’m struggling with how to specify whether svg element have the svg wrapper and not. (Ideas welcome!) These concepts apply pretty well to canvas too. I’d imagine you sometimes want a lot of separate canvases, and sometime you’d want a “display list” on a single canvas. If each object would have its own canvas, they would be separate DOM elements, but if it’s a “virtual” display list, there would be a single canvas element visible on the DOM. Both are valid use cases, and both should be possible. On Jul 26, 2016, at 5:28 PM, Peter Ent <p...@adobe.com> wrote: > Hi, > > For my own education, I just wanted to get some clarification. With > regards to SVG, when you use it, it looks something like this in the HTML > file: > <svg style="Š"> > <rect style="Š" /> > <rect style="Š" /> > </svg> > > With Canvas, there aren't any graphic elements, you just have <canvas /> > and then JS code to draw the rects (or whatever). > > Were you thinking we would be able to substitute Canvas for SVG? In other > words, in the Charts, I used SVG in the JS version of the BoxItemRenderer. > Is it your intent that you could write a BoxItemRenderer that used Canvas > instead, for each renderer? The JS would be something like a > <div><canvas/></div> (the SVG version is <div><svg><rect /></svg></div> so > the mouse tracking would be on the outer <div>. > > Or were you thinking that if you wanted to use Canvas for the Charts, > you'd work at a higher level and have a <canvas> per chart and inside of > that the renderers would simply use Canvas drawing to make the bars, > columns, axes, etc.? > > I just wanted to see where you were envisioning this going. I think both > approaches would work. > > ‹peter > > On 7/25/16, 5:13 PM, "Harbs" <harbs.li...@gmail.com> wrote: > >> FYI: >> >> I just added a bunch of drawing APIs for SVG which should work for canvas >> as well when we have it. >> >> It should be possible to efficiently construct paths with can be used for >> all outputs. I still need to do some testing and add simple rounded rects >> and I need to add string decomposition for canvas, but it¹s pretty >> complete. (Although the AS Docs could use some work.) >> >> The paths can be built implicitly using complex rounded rects or built >> using the new PathBuilder class which wraps a suite of drawing commands >> and spits them out as path strings. (Of course you can construct the >> strings manually if you like, but that seems very error prone to me.) >> Converting existing Flash drawing should be very straight-forward and it >> maps naturally to HTML. >> >> That¹s it for todayŠ >> >> On Jul 25, 2016, at 1:54 PM, Harbs <harbs.li...@gmail.com> wrote: >> >>> I think I missed the correct config file the first time around, and I >>> fixed this. >>> >>> The change is that SVG components such as Rect, Circle, etc, should now >>> need the library://ns.apache.org/flexjs/svg namespace in MXML instead of >>> library://ns.apache.org/flexjs/basic. >>> >>> So to use vsg compenents, you¹d need to do this: >>> xmlns:svg="library://ns.apache.org/flexjs/svg² >>> >>> and <svg:Circle/> >>> >>> (eventually, I expect we¹ll have <canvas:Circle/> as well) >>> >>> On Jul 25, 2016, at 1:36 PM, Christofer Dutz >>> <christofer.d...@c-ware.de> wrote: >>> >>>> Hi Harbs, >>>> >>>> >>>> it would have been easier to check, if all Is ok, if you had described >>>> what you changed. From a review of the commit it seems you moved some >>>> parts to dedicated svg packages, created a new namespace file to >>>> reference the svg elements and removed the old ones from the original >>>> ones. Am I correct? >>>> >>>> >>>> I just did a quick check ... I was still able to build everything >>>> (including examples) with Maven, so in general it should be ok ... but >>>> I did notice, that you only updated the manifest info in the >>>> flex-config.xml template in the maven distribution module, but not to >>>> any of the configs in the normal framework directory or any of the >>>> other templates in the distribution directory. I Fixed this for the >>>> maven distribution and will commit that as soon as I have finished my >>>> current work on bundling AIR in the directory distribution, but you'll >>>> have to finish that in the framework directory the Ant build uses. >>>> >>>> >>>> Chris >>>> >>>> ________________________________ >>>> Von: Harbs <harbs.li...@gmail.com> >>>> Gesendet: Montag, 25. Juli 2016 12:12:15 >>>> An: dev >>>> Betreff: Changed svg namespace >>>> >>>> I just changed the svg namespace in the Graphics package. I¹m not 100% >>>> sure I did it right ‹ especially with the maven build. >>>> >>>> I hope I did not mess up the next build, but we¹ll find out soon. ;-) >>>> >>>> If someone could double-check what I did (both on the ant side and the >>>> maven side), that might catch my errors soonerŠ >>>> >>>> Thanks, >>>> Harbs >>> >> >