Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:JSR-226 - SVGLocatableElement.getScreenBBox() and SVGLocatableElement.getScreenCTM() may return wrong values for group elements (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Created: User:Technical writer 1 (14 Sep 2007)
Last edited: hamishwillee (30 Jul 2013)



When using the Scalable 2D Vector Graphics API, the methods SVGLocatableElement.getScreenBBox() and SVGLocatableElement.getScreenCTM() may return wrong values in certain cases.


The box coordinates are in the screen coordinate space, which is connected to the current user coordinate space by the matrix returned by SVGLocatableElement.getScreenCTM(). This happens when the group includes another <group> element which contains transformations.

How to reproduce

This issue affects JSR-226 when running on the emulator.

  <svg viewBox="-100 -100 240 320">
<g id="group1" transform="translate(10, 20)" fill="red" >
<rect id="rect1" transform="scale(2)" x="10" y="10" width="50" height="50"/>
<rect id="rect2" x="10" y="10" width="100" height="100"/>
<g id="group2" transform="translate(10, 20)" >
<rect id="rect3" x="0" y="10" width="150" height="50"/>
<circle id="circle1" cx="20" cy="20" r="100" />
svgImage.setViewportWidth( 240 );
svgImage.setViewportHeight( 320 );
SVGLocatableElement group1Elem = (SVGLocatableElement)
svgImage.getDocument().getElementById( group1 );
SVGRect screenBBox = group1Elem.getScreenBBox();
SVGMatrix m = group1Elem.getScreenCTM();

The returned values are:

 screenBBox  = [-60, -40, 230, 200]
 m = [1, 0, 0; 1, 10, 20];

The correct values are:

 screenBBox  = [40, 60, 230, 200]
 m =  [1, 0, 0; 1, 110, 120]


No solution available.

This page was last modified on 30 July 2013, at 11:06.
32 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.