You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "João Martins (JIRA)" <ji...@apache.org> on 2015/02/05 04:41:34 UTC

[jira] [Comment Edited] (PIVOT-964) Changes in SVG viewBox attribute causes SVG not to render.

    [ https://issues.apache.org/jira/browse/PIVOT-964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14306581#comment-14306581 ] 

João Martins edited comment on PIVOT-964 at 2/5/15 3:40 AM:
------------------------------------------------------------

Hi! No worries at all. I am just happy someone is looking into this! :)

The relevant code within the project can be found here: https://github.com/jgmartins/Full-Thrust/blob/master/FTL-Client/src/org/fullthrust/client/gui/GamePane.java

The relevant functions are resizeGUI(), resizeSVG() and setViewBox().

You should be able to easily test and see the bug using the FTL-Core, FTL-Client and FTL-Server eclipse projects, then running Server, then running Client, picking a faction in the Frame, and finally using right-clicking and mouse-wheeling.

I just have a FillPane (battlePane) with an ImageView with a Drawing pointing to the SVGDiagram. The size of the FillPane changes when the Window is resized. There's a zoom factor, where at 1.00 zoom, 1 pixel = 1 svg unit. I use right mouse clicking to determine the svg coordinates of a new desired center, and translate the viewBox (i.e. the first two arguments) there. I use mousewheel input to increment or decrement a factor of 0.05 onto the zoom factor, which I then use to calculate the desired viewBox width and height (i.e. second two parameters). These are then written to the svg using svgRoot.setAttribute(), and then a repaint() call is made.

I hope this information helps, and don't hesitate to contact me!


was (Author: anvilfolk):
Hi! No worries at all. I am just happy someone is looking into this! :)

The relevant code within the project can be found here: https://github.com/jgmartins/Full-Thrust/blob/master/FTL-Client/src/org/fullthrust/client/gui/GamePane.java

The relevant functions are be resizeGUI(), resizeSVG() and setViewBox().

You should be able to easily test and see the bug using the FTL-Core, FTL-Client and FTL-Server eclipse projects, then running Server, then running Client, picking a faction in the Frame, and finally using right-clicking and mouse-wheeling.

I just have a FillPane (battlePane) with an ImageView with a Drawing pointing to the SVGDiagram. The size of the FillPane changes when the Window is resized. There's a zoom factor, where at 1.00 zoom, 1 pixel = 1 svg unit. I use right mouse clicking to determine the svg coordinates of a new desired center, and translate the viewBox (i.e. the first two arguments) there. I use mousewheel input to increment or decrement a factor of 0.05 onto the zoom factor, which I then use to calculate the desired viewBox width and height (i.e. second two parameters). These are then written to the svg using svgRoot.setAttribute(), and then a repaint() call is made.

I hope this information helps, and don't hesitate to contact me!

> Changes in SVG viewBox attribute causes SVG not to render.
> ----------------------------------------------------------
>
>                 Key: PIVOT-964
>                 URL: https://issues.apache.org/jira/browse/PIVOT-964
>             Project: Pivot
>          Issue Type: Bug
>    Affects Versions: 2.0.4
>         Environment: Windows 7, Java 1.7, Eclipse, Pivot 2.0.4, svgSalamander
>            Reporter: João Martins
>            Assignee: Sandro Martini
>              Labels: svgSalamander
>             Fix For: 2.1, 2.0.5
>
>         Attachments: TestClient2.java, TestClient3.java
>
>
> We try to display a simple SVG file with a rect of width 2000 and height 1000. This is done using an ImageView.
> We have two values of viewBox, both of which capture at least part of the rectangle. For one of them, the rectangle is rendered. For the other, it isn't (but should).
> The exact same scenario, using svgSalamander & Java Swing, works. With Pivot instead of Swing, it does not.
> Here is a Swing minimal example: http://pastebin.com/i0xJbUTg
> Here is a Pivot minimal example: http://pastebin.com/tpgnVe0c



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)