Thanks a lot Thomas for those explanations. Thomas DeWeese wrote : > Thomas Charbonnel wrote: > > >>I'm working with Batik 1.6 on x86_64 linux with Blackdown 1.4.2-02 > >>(64bit). I'm displaying a dynamic document in a JSVGCanvas, and am > >>trying to keep it top-left aligned, and still have it scale when I > >>resize the frame the canvas is in. > >>For this I set preserveAspectRatio="xMinYMin meet" on my document's > >>outermost svg. Initially, the canvas' preferred size matches the > >>width/height ratio of the document. > > > Do I misunderstand the standard or implementation, or is this really a > > bug ? > > So I think the problem is that we don't treat a resize of the > canvas as a change in the width and height of the document, that is > fixed at the first load (or when the width/height are updated > via script). One of the reasons for this is that a change in > width/height on an SVG requires that every element that uses > percentages be update, since we can't track this directly we rebuild > the entire graphics tree. >
I can understand this, and don't see this as a problem really. But I was thinking that the canvas was the viewport for the document, and expecting that the behaviour described in section 7.8 of the specs would apply. > Also the SVG spec does not cover conformant behavior here. So our > behavior (resize on the center of the canvas) is probably ok. > With this behaviour, the canvas is indeed de facto as the viewport for documents with preserveAspectRatio="xMidYMid", this may have induced my confusion. > > My understanding of preserveAspectRatio="xMinYMin meet" is that the > > document should always stay top-left anchored, and scale linearly. > > This is not what's happening in batik at the moment. > > This is what happens on load. > > > At the end some content is lost past the left border of the canvas, and > > the document is no more top-anchored, despite "xMinYMin". > > So I will say that for a document that matched aspect ratio at > load I couldn't get this to make any difference. In my case the > document was always centered when the canvas aspect ratio stopped > matching. > > > For now I work around the problem by registering a ComponentListener on > > the canvas, then getting the rendering transform in the componentResized > > callback and calling setToTranslation(0, 0) on it. > > The best thing would probably be to simply replace the > updateRenderingTransform method so it doesn't zoom on the > center of the canvas. > OK, I'll do just that. > > I'd appreciate some feedback on this. > > I did appreciate the feedback ! Thanks again, Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
