Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-964

Changes in SVG viewBox attribute causes SVG not to render.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.1, 2.0.5
    • Component/s: None
    • Labels:
    • Environment:
      Windows 7, Java 1.7, Eclipse, Pivot 2.0.4, svgSalamander

      Description

      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

      1. TestClient3.java
        4 kB
        João Martins
      2. TestClient2.java
        5 kB
        João Martins

        Activity

        Hide
        smartini Sandro Martini added a comment -

        Just updated SvgSalamander jar to latest stable, took the jar under sources from their latest tag 1.0.39 .

        Show
        smartini Sandro Martini added a comment - Just updated SvgSalamander jar to latest stable, took the jar under sources from their latest tag 1.0.39 .
        Hide
        smartini Sandro Martini added a comment -

        Before 2.0.5 I'll try to update another time SVG Salamander jar (if there is a new release), and then make some test to ensure all is good the same (but I can't test deeply this issue due to a missing test), so I'll close it.
        Be free to reopen later if/when needed.

        Show
        smartini Sandro Martini added a comment - Before 2.0.5 I'll try to update another time SVG Salamander jar (if there is a new release), and then make some test to ensure all is good the same (but I can't test deeply this issue due to a missing test), so I'll close it. Be free to reopen later if/when needed.
        Hide
        smartini Sandro Martini added a comment -

        Hi,
        I'm sorry but I can't help you so much because of timing constraints ...

        I'll keep open this issue and retry later with an updated release of SVGSalamander.jar to see if something works better, otherwise we can mark this as resolved (the original issue is already resolved) and continue with a new one.

        Show
        smartini Sandro Martini added a comment - Hi, I'm sorry but I can't help you so much because of timing constraints ... I'll keep open this issue and retry later with an updated release of SVGSalamander.jar to see if something works better, otherwise we can mark this as resolved (the original issue is already resolved) and continue with a new one.
        Hide
        anvilfolk João Martins added a comment -

        Hi,

        I haven't yet contacted Mark or posted a bug on SVGSalamander. I tried to find a minimal example showcasing the bug, but was unable to do so, so to reproduce it one would need to set up the entire project. At this point I'm losing motivation in trying to get everything to work. Hopefully it'll come back at some point!

        Show
        anvilfolk João Martins added a comment - Hi, I haven't yet contacted Mark or posted a bug on SVGSalamander. I tried to find a minimal example showcasing the bug, but was unable to do so, so to reproduce it one would need to set up the entire project. At this point I'm losing motivation in trying to get everything to work. Hopefully it'll come back at some point!
        Hide
        smartini Sandro Martini added a comment -

        Hi Joao, some update on this ?
        Have you been able to speak with Mark (SVGSalamander) ?

        Show
        smartini Sandro Martini added a comment - Hi Joao, some update on this ? Have you been able to speak with Mark (SVGSalamander) ?
        Hide
        smartini Sandro Martini added a comment -

        The problem we see here, at SVGSalamander side is: https://java.net/jira/browse/SVGSALAMANDER-53
        and from latest SVGSalamander jars (recompiled by me yesterday) it seems resolved, but in the issue it's not clear if it's already resolved as probably it is.

        Your latest tests seems related to another SVGSalamander issue, so I'd try to check with them before if can be resolved there, maybe opening a new issue there: https://java.net/jira/browse/SVGSALAMANDER/ , and see what Mark say. Here is you find all SVGSalamander mailing lists: https://java.net/projects/svgsalamander/lists

        Note that SVGSalamander in Maven repository is old, probably another request fot them is to publish an updated jar, if not in Maven repository maybe at JCenter (BinTray); otherwise I can put an updated jar (ifd needed building it) in Pivot sources.

        I'll try to take a look at your updated code, but in Windows I'm currently having some problem with git-related commands in your Gradle config.

        Please post here some update to keep us aligned.

        Show
        smartini Sandro Martini added a comment - The problem we see here, at SVGSalamander side is: https://java.net/jira/browse/SVGSALAMANDER-53 and from latest SVGSalamander jars (recompiled by me yesterday) it seems resolved, but in the issue it's not clear if it's already resolved as probably it is. Your latest tests seems related to another SVGSalamander issue, so I'd try to check with them before if can be resolved there, maybe opening a new issue there: https://java.net/jira/browse/SVGSALAMANDER/ , and see what Mark say. Here is you find all SVGSalamander mailing lists: https://java.net/projects/svgsalamander/lists Note that SVGSalamander in Maven repository is old, probably another request fot them is to publish an updated jar, if not in Maven repository maybe at JCenter (BinTray); otherwise I can put an updated jar (ifd needed building it) in Pivot sources. I'll try to take a look at your updated code, but in Windows I'm currently having some problem with git-related commands in your Gradle config. Please post here some update to keep us aligned.
        Hide
        anvilfolk João Martins added a comment -

        Hi all!

        Some bad news. It looks like there might've been some unintended side-effects to List com.kitfox.svg.SVGDiagram.pick(Point2D point, List retVec) from the latest changes.

        Using the Maven svgSalamander jar, I can get an accurate list of SvgElements under the mouse-click. Current behaviour with svgSlamander-tiny.jar file from 2.0.x, is strange. It appears that clicks are not mapped to the correct position in the SVG Diagram. It's working, since clicking in empty spots of the screen sometimes comes up with the same SVG Elements that I can get with Maven svgSalamander.jar... it's just not working as intended!

        So, the "real" rects get mapped into "ghost" rects.

        So far I've been able to determine it's not just a translation of the original SVG, so it's not just to do with offsets. The "ghost" rect that I can click on appears bigger than the "real" rect, and sometimes I can't even find any "ghost" rect.

        I don't have a minimalist example right now. But I switched my project to Gradle, so it should be relatively easy to get up and running. It will download gradle into your computer, along with dependencies (Apache Pivot + svgSalamander) from the Maven repository. Instructions are:

        • Checkout https://github.com/jgmartins/Full-Thrust
        • run "gradlew eclipse", (gradlew.bat for Windows) which should create Eclipse projects for FTL-Core, FTL-Server, FTL-Client. If it's not finding dependencies, run "gradlew build" first, and then "gradlew eclipse again"
        • Open Eclipse with the workspace inside the Full-Thrust folder that you checked out, then create each of the projects. They should be configured.

        To run,

        • Run org.fullthrust.server.Server first, and then org.fullthrust.client.Client. The run configurations need to be set up so that the working directory (found under the Arguments tab in Run Configurations) is the Full-Thrust folder. Using "$ {workspace_loc}

          " works.

        • Once the client opens, make sure to click one of the buttons for choosing a faction.
        • Because of the bug in svgSalamander.jar, the screen will be empty. But some viewBoxes work, as per this bug report! A viewbox that shows the ImageView for me is [DEBUG] Setting viewBox: -275 -204 551 408 (this is debug output in the console). You can pan the image using right-click (which centers the screen on the mouse location) until the image shows up (don't mind the graphics, they are buggy). Now, left-clicking on the rect or on the ships will cause a console message to be printed out with SVG Element IDs found under the mouse. The two nulls are the visible white/blue rect, and MyShipID identifies the ships. This also works when the image is not displaying.

        To test 2.0.x svgSalamander-tiny, you can just change the build path for FTL-Client to point at it. There is a copy under FTL-Client/. The image will display correctly (minus some strange scaling under the faction selection screen that might be a bug on my part - not sure!). Clicking now does not "pick" the right SVG Elements under the mouse.

        This is complicated, but should get you an interactive example. I'll try to come up with a minimalist example at some point though, unless the cause of this is somehow obvious from the changes made

        Show
        anvilfolk João Martins added a comment - Hi all! Some bad news. It looks like there might've been some unintended side-effects to List com.kitfox.svg.SVGDiagram.pick(Point2D point, List retVec) from the latest changes. Using the Maven svgSalamander jar, I can get an accurate list of SvgElements under the mouse-click. Current behaviour with svgSlamander-tiny.jar file from 2.0.x, is strange. It appears that clicks are not mapped to the correct position in the SVG Diagram. It's working, since clicking in empty spots of the screen sometimes comes up with the same SVG Elements that I can get with Maven svgSalamander.jar... it's just not working as intended! So, the "real" rects get mapped into "ghost" rects. So far I've been able to determine it's not just a translation of the original SVG, so it's not just to do with offsets. The "ghost" rect that I can click on appears bigger than the "real" rect, and sometimes I can't even find any "ghost" rect. I don't have a minimalist example right now. But I switched my project to Gradle, so it should be relatively easy to get up and running. It will download gradle into your computer, along with dependencies (Apache Pivot + svgSalamander) from the Maven repository. Instructions are: Checkout https://github.com/jgmartins/Full-Thrust run "gradlew eclipse", (gradlew.bat for Windows) which should create Eclipse projects for FTL-Core, FTL-Server, FTL-Client. If it's not finding dependencies, run "gradlew build" first, and then "gradlew eclipse again" Open Eclipse with the workspace inside the Full-Thrust folder that you checked out, then create each of the projects. They should be configured. To run, Run org.fullthrust.server.Server first, and then org.fullthrust.client.Client. The run configurations need to be set up so that the working directory (found under the Arguments tab in Run Configurations) is the Full-Thrust folder. Using "$ {workspace_loc} " works. Once the client opens, make sure to click one of the buttons for choosing a faction. Because of the bug in svgSalamander.jar, the screen will be empty . But some viewBoxes work, as per this bug report! A viewbox that shows the ImageView for me is [DEBUG] Setting viewBox: -275 -204 551 408 (this is debug output in the console). You can pan the image using right-click (which centers the screen on the mouse location) until the image shows up (don't mind the graphics, they are buggy). Now, left-clicking on the rect or on the ships will cause a console message to be printed out with SVG Element IDs found under the mouse. The two nulls are the visible white/blue rect, and MyShipID identifies the ships. This also works when the image is not displaying. To test 2.0.x svgSalamander-tiny, you can just change the build path for FTL-Client to point at it. There is a copy under FTL-Client/. The image will display correctly (minus some strange scaling under the faction selection screen that might be a bug on my part - not sure!). Clicking now does not "pick" the right SVG Elements under the mouse. This is complicated, but should get you an interactive example. I'll try to come up with a minimalist example at some point though, unless the cause of this is somehow obvious from the changes made
        Hide
        smartini Sandro Martini added a comment -

        Hi João, very good ...

        Unless objections I can merge remaining changes to trunk and mark this as resolved (during next days).

        Of course be free to reopen is something should happen.

        Show
        smartini Sandro Martini added a comment - Hi João, very good ... Unless objections I can merge remaining changes to trunk and mark this as resolved (during next days). Of course be free to reopen is something should happen.
        Hide
        anvilfolk João Martins added a comment -

        Just confirmed. Substituting the Maven svgSalamander.jar for http://svn.apache.org/repos/asf/pivot/branches/2.0.x/wtk/lib/svgSalamander-tiny.jar fixes the problem in my application! I can see everything, independently of the viewBox set!!!

        Show
        anvilfolk João Martins added a comment - Just confirmed. Substituting the Maven svgSalamander.jar for http://svn.apache.org/repos/asf/pivot/branches/2.0.x/wtk/lib/svgSalamander-tiny.jar fixes the problem in my application! I can see everything, independently of the viewBox set!!!
        Hide
        smartini Sandro Martini added a comment -

        Hi all,
        some good news: after some changes (and info) from Roger, I tried to update even SvgSalamander to latest stable, so I compile it from their latest tag 1.0.38 (but had to do a small change in one class there to fix a class not found compiler error). And then commit updated jar in branches/2.0.x .
        Now if I do some tests with our Pivot964Pivot.java class, all seems to work even changing values to those fiound by Roger ... of course wrong behavior (in SVGSalamander) could exist the same but with different values.

        If all it's ok I can merge latest things even in trunk, tell me.

        Note: now I'm worried by availability of fixes for SVGSalamander; even because I'm not able to find their jar in usual Maven repositories ... I'll post some update on this in a related issue for 2.1.0 .

        Show
        smartini Sandro Martini added a comment - Hi all, some good news: after some changes (and info) from Roger, I tried to update even SvgSalamander to latest stable, so I compile it from their latest tag 1.0.38 (but had to do a small change in one class there to fix a class not found compiler error). And then commit updated jar in branches/2.0.x . Now if I do some tests with our Pivot964Pivot.java class, all seems to work even changing values to those fiound by Roger ... of course wrong behavior (in SVGSalamander) could exist the same but with different values. If all it's ok I can merge latest things even in trunk, tell me. Note: now I'm worried by availability of fixes for SVGSalamander; even because I'm not able to find their jar in usual Maven repositories ... I'll post some update on this in a related issue for 2.1.0 .
        Hide
        rwhitcomb Roger Whitcomb added a comment -

        Oops! Fixed the Java 6 compile errors in branches/2.0.x:
        Sending src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java
        Transmitting file data .
        Committed revision 1688550.

        Show
        rwhitcomb Roger Whitcomb added a comment - Oops! Fixed the Java 6 compile errors in branches/2.0.x: Sending src/org/apache/pivot/tests/issues/pivot964/Pivot964Pivot.java Transmitting file data . Committed revision 1688550.
        Hide
        rwhitcomb Roger Whitcomb added a comment -

        Made changes (in trunk) to the test case program:
        Sending org\apache\pivot\tests\issues\pivot964\Pivot964Pivot.java
        Transmitting file data .
        Committed revision 1688523.

        Merged to branches/2.0.x:
        Sending .
        Sending tests\src\org\apache\pivot\tests\issues\pivot964\Pivot964Pivot.java
        Transmitting file data .
        Committed revision 1688524.

        Show
        rwhitcomb Roger Whitcomb added a comment - Made changes (in trunk) to the test case program: Sending org\apache\pivot\tests\issues\pivot964\Pivot964Pivot.java Transmitting file data . Committed revision 1688523. Merged to branches/2.0.x: Sending . Sending tests\src\org\apache\pivot\tests\issues\pivot964\Pivot964Pivot.java Transmitting file data . Committed revision 1688524.
        Hide
        rwhitcomb Roger Whitcomb added a comment -

        Likewise, if you set the y offset to 269 it will work, but 270 makes it go invisible. So, any X offset less than 508 or any Y offset less than 270 is fine. Investigating further.

        Show
        rwhitcomb Roger Whitcomb added a comment - Likewise, if you set the y offset to 269 it will work, but 270 makes it go invisible. So, any X offset less than 508 or any Y offset less than 270 is fine. Investigating further.
        Hide
        rwhitcomb Roger Whitcomb added a comment -

        I have just now tried a few things, and made a variable value for the view box offset (instead of 800), and it seems to work correctly for any value up to 507, then at 508 it disappears (on my screen resolution at least). Must be an overflow or something like that. Will try to investigate further.... Seems like an odd value, though. I will check in the updated Pivot sample code a little later.

        Show
        rwhitcomb Roger Whitcomb added a comment - I have just now tried a few things, and made a variable value for the view box offset (instead of 800), and it seems to work correctly for any value up to 507, then at 508 it disappears (on my screen resolution at least). Must be an overflow or something like that. Will try to investigate further.... Seems like an odd value, though. I will check in the updated Pivot sample code a little later.
        Hide
        smartini Sandro Martini added a comment -

        Hi, sorry for the big delay but I've been busy a lot during last months ...
        I'll try your new test case during this week, and probably it makes sense here to fix the behavior of fill:true (at least) but I have to fix it without breaking things in other applications ...

        I'll post an update soon.
        Thanks for now.

        Show
        smartini Sandro Martini added a comment - Hi, sorry for the big delay but I've been busy a lot during last months ... I'll try your new test case during this week, and probably it makes sense here to fix the behavior of fill:true (at least) but I have to fix it without breaking things in other applications ... I'll post an update soon. Thanks for now.
        Hide
        anvilfolk João Martins added a comment -

        Ok, I just pushed FTL-Client/org.fullthrust.client.TestClient4. It appears to be showing similar behaviour. Let me specify:

        • When fill:true, nothing is shown at all.
        • When fill:false, then when if the window is large enough, the image is displayed. If you make the window smaller, the image starts going off the display area, and then disappears entirely.

        I don't actually understand the implications of this at all, but hopefully this will help narrow down the problem!

        Show
        anvilfolk João Martins added a comment - Ok, I just pushed FTL-Client/org.fullthrust.client.TestClient4. It appears to be showing similar behaviour. Let me specify: When fill:true, nothing is shown at all. When fill:false, then when if the window is large enough, the image is displayed. If you make the window smaller, the image starts going off the display area, and then disappears entirely. I don't actually understand the implications of this at all, but hopefully this will help narrow down the problem!
        Hide
        anvilfolk João Martins added a comment -

        Hi,

        Life has been rough, but I'm trying to figure this out again. There are clearly a lot of problems with my build system for this, which is something I plan to rectify at some point, but I feel like it will be an investment.

        Did you try FTL-Client/org.fullthrust.client.TestClient3? This is a fairly minimal example that allows you to press 2 buttons which set different viewboxes. One of them displays the SVG, the other one does not. I believe it is exactly the same as what is happening for me. It might be a lot easier than getting a client-server thing working

        I will try attempt something with your latest fill:true suggestion to see if I can figure something out.

        Show
        anvilfolk João Martins added a comment - Hi, Life has been rough, but I'm trying to figure this out again. There are clearly a lot of problems with my build system for this, which is something I plan to rectify at some point, but I feel like it will be an investment. Did you try FTL-Client/org.fullthrust.client.TestClient3? This is a fairly minimal example that allows you to press 2 buttons which set different viewboxes. One of them displays the SVG, the other one does not. I believe it is exactly the same as what is happening for me. It might be a lot easier than getting a client-server thing working I will try attempt something with your latest fill:true suggestion to see if I can figure something out.
        Hide
        smartini Sandro Martini added a comment -

        Can you try to do something like in image_view_svg_test.bxml (under tests) ?
        Inside it there is:
        <ImageView image="@logo.svg" styles="

        {fill:false, preserveAspectRatio:false, horizontalAlignment:'left', verticalAlignment:'bottom'}

        "/>
        but if you try with fill:true something changes ? If yes, you still see the problem ?

        Show
        smartini Sandro Martini added a comment - Can you try to do something like in image_view_svg_test.bxml (under tests) ? Inside it there is: <ImageView image="@logo.svg" styles=" {fill:false, preserveAspectRatio:false, horizontalAlignment:'left', verticalAlignment:'bottom'} "/> but if you try with fill:true something changes ? If yes, you still see the problem ?
        Hide
        smartini Sandro Martini added a comment -

        Hi,
        even after your updates and eclipse launch files (thanks ) I get some errors running your app.

        I had to change this line in ReceiveBattleState.java:
        // pane = (GamePane) bxmlSerializer.readObject(new FileInputStream(new File("data/bxml/GamePane.bxml"))); // original
        pane = (GamePane) bxmlSerializer.readObject(this.getClass(), "data/bxml/GamePane.bxml"); // new, temp

        Server:
        [DEBUG] Starting state manager with state org.fullthrust.server.states.LoadTutorialState@29af45f4
        [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@1a543937)
        [ERROR] Util.loadScenario: IOException Test.xml
        [DEBUG] Terminated stateorg.fullthrust.server.states.LoadTutorialState@29af45f4
        [DEBUG] Initiating stateorg.fullthrust.server.states.WaitForConnectionsState@31395750
        [DEBUG] EventManager(org.fullthrust.server.events.ServerLoginEvent@18b679e1)
        [DEBUG] EventManager(org.fullthrust.core.events.state.LogMsgEvent@1f13cd63)
        [LOG] User a(/127.0.0.1) logged in.
        [DEBUG] Terminated stateorg.fullthrust.server.states.WaitForConnectionsState@31395750
        [DEBUG] Initiating stateorg.fullthrust.server.states.BattleSyncState@5b21cbdb
        [DEBUG] EventManager(org.fullthrust.core.events.state.BattleSyncEvent@13060ee9)
        [DEBUG] Terminated stateorg.fullthrust.server.states.BattleSyncState@5b21cbdb
        [DEBUG] Initiating stateorg.fullthrust.server.states.FactionChoiceState@79662429
        [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@5349b9a8)
        [ERROR] IOException while reading object from a(/127.0.0.1)
        [ERROR] IOException while writing object a(/127.0.0.1)
        [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@72e9625d)
        [DEBUG] EventManager(org.fullthrust.server.events.ServerLoginEvent@3839029b)
        [DEBUG] EventManager(org.fullthrust.core.events.state.LogMsgEvent@26da2af3)
        [LOG] User a(/127.0.0.1) logged in.

        Client:
        [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@23617fc5)
        [ERROR] Problem reading font data/font/Monkirta Pursuit NC.ttf. Defaulting to Arial.
        [DEBUG] Starting state manager with state Login
        [DEBUG] EventManager(org.fullthrust.core.events.state.LoginEvent@4921bae7)
        [DEBUG] Terminated stateLogin
        [DEBUG] Initiating stateSynchronising
        [DEBUG] EventManager(ChangedStateEvent: ReceiveBattle, Synchronising)
        [DEBUG] EventManager(ChangedStateEvent: Login, Login)

        And then in the Client GUI I only see all black with a Label "Server waiting for other connections..." but even after waiting some seconds I can only terminate it, sorry ...

        In the meantime I'll try to focus on minimal Test classes.

        Show
        smartini Sandro Martini added a comment - Hi, even after your updates and eclipse launch files (thanks ) I get some errors running your app. I had to change this line in ReceiveBattleState.java: // pane = (GamePane) bxmlSerializer.readObject(new FileInputStream(new File("data/bxml/GamePane.bxml"))); // original pane = (GamePane) bxmlSerializer.readObject(this.getClass(), "data/bxml/GamePane.bxml"); // new, temp Server: [DEBUG] Starting state manager with state org.fullthrust.server.states.LoadTutorialState@29af45f4 [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@1a543937) [ERROR] Util.loadScenario: IOException Test.xml [DEBUG] Terminated stateorg.fullthrust.server.states.LoadTutorialState@29af45f4 [DEBUG] Initiating stateorg.fullthrust.server.states.WaitForConnectionsState@31395750 [DEBUG] EventManager(org.fullthrust.server.events.ServerLoginEvent@18b679e1) [DEBUG] EventManager(org.fullthrust.core.events.state.LogMsgEvent@1f13cd63) [LOG] User a(/127.0.0.1) logged in. [DEBUG] Terminated stateorg.fullthrust.server.states.WaitForConnectionsState@31395750 [DEBUG] Initiating stateorg.fullthrust.server.states.BattleSyncState@5b21cbdb [DEBUG] EventManager(org.fullthrust.core.events.state.BattleSyncEvent@13060ee9) [DEBUG] Terminated stateorg.fullthrust.server.states.BattleSyncState@5b21cbdb [DEBUG] Initiating stateorg.fullthrust.server.states.FactionChoiceState@79662429 [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@5349b9a8) [ERROR] IOException while reading object from a(/127.0.0.1) [ERROR] IOException while writing object a(/127.0.0.1) [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@72e9625d) [DEBUG] EventManager(org.fullthrust.server.events.ServerLoginEvent@3839029b) [DEBUG] EventManager(org.fullthrust.core.events.state.LogMsgEvent@26da2af3) [LOG] User a(/127.0.0.1) logged in. Client: [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@23617fc5) [ERROR] Problem reading font data/font/Monkirta Pursuit NC.ttf. Defaulting to Arial. [DEBUG] Starting state manager with state Login [DEBUG] EventManager(org.fullthrust.core.events.state.LoginEvent@4921bae7) [DEBUG] Terminated stateLogin [DEBUG] Initiating stateSynchronising [DEBUG] EventManager(ChangedStateEvent: ReceiveBattle, Synchronising) [DEBUG] EventManager(ChangedStateEvent: Login, Login) And then in the Client GUI I only see all black with a Label "Server waiting for other connections..." but even after waiting some seconds I can only terminate it, sorry ... In the meantime I'll try to focus on minimal Test classes.
        Hide
        anvilfolk João Martins added a comment -

        Hi!

        This problem should not exist with TestClient2 and TestClient3, which showcase the same behaviour and are much more minimal examples.

        I have pushed some changes that include some .launch files for the run configurations. I think these will work if you pull and restart Eclipse. In case it doesn't, could you set run configurations for Client and Server, then for both go under the Arguments tab, and in the "Working Directory" border choose Other: "$

        {workspace_loc}

        ", without quotes.

        Once the Client has connected, click one of the faction buttons, and then keep zooming out (mouse-wheel). The field shows up once the debug message "[DEBUG] Setting viewBox: -550 -408 1101 816" appears. Alternatively, panning to the right and bottom with the right mouse also works. This behaviour is consistent for me - not random from execution to execution.

        This was the only way I could get all the paths to play nice, but having a FTL-data repository that is linked to also makes a lot of sense! I can even have one for common data and one for graphics data Thanks!

        Show
        anvilfolk João Martins added a comment - Hi! This problem should not exist with TestClient2 and TestClient3, which showcase the same behaviour and are much more minimal examples. I have pushed some changes that include some .launch files for the run configurations. I think these will work if you pull and restart Eclipse. In case it doesn't, could you set run configurations for Client and Server, then for both go under the Arguments tab, and in the "Working Directory" border choose Other: "$ {workspace_loc} ", without quotes. Once the Client has connected, click one of the faction buttons, and then keep zooming out (mouse-wheel). The field shows up once the debug message " [DEBUG] Setting viewBox: -550 -408 1101 816" appears. Alternatively, panning to the right and bottom with the right mouse also works. This behaviour is consistent for me - not random from execution to execution. This was the only way I could get all the paths to play nice, but having a FTL-data repository that is linked to also makes a lot of sense! I can even have one for common data and one for graphics data Thanks!
        Hide
        smartini Sandro Martini added a comment -

        Hi and sorry for the delay ... now I have an eclipse workspace with Pivot-2.0.x sources and your project.
        But when I run FL-Client main application (org.fullthrust.client.Client) on a JDK 7 under Windows 7, I get this:
        [ERROR] Problem reading font data/font/Monkirta Pursuit NC.ttf. Defaulting to Arial.
        [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@7b1c661c)
        java.lang.NullPointerException
        at org.fullthrust.client.Options.init(Options.java:38)
        at org.fullthrust.client.Client.startup(Client.java:70)
        at org.apache.pivot.wtk.DesktopApplicationContext$2.run(DesktopApplicationContext.java:666)
        because f = Font.getFont("Arial"); in my environment returns null, but changing it using Font.decode (like in Pivot) it works ... but after this I get another NPE because all data/ folder is missing from sources, so I have to stop now:
        [ERROR] Could not load data/bxml/Window.bxml
        Ok, just found the trick to make it work in eclipse: copy your data folder to a new one (mine is "other") and add it as Linked folder in eclipse project, but probably it would be better to move it in a near-empty eclipse project with the data folder inside src (or like Maven, a resources source folder with data/... inside), and make FL-Client dependent on it.
        But after this I see that for example here:
        window = (Window)bxmlSerializer.readObject(new FileInputStream(new File("data/bxml/Window.bxml")));
        you use the base version of that Pivot API but in this case it would be better at least in my dev env):
        window = (Window)bxmlSerializer.readObject(this.getClass(), "/data/bxml/Window.bxml");
        and then the same for data/bxml/Login.bxml and ConnectDialog.bxml ...
        After this of course ow I get a Connection error to the server (not started) ... but to simplify my test (I have very few time and still didn't see the error) can I skip this, or can you set a mock for the connection that i can enable only for my tests ?

        I downloaded your projects with git, so tell me when you push some update .

        Show
        smartini Sandro Martini added a comment - Hi and sorry for the delay ... now I have an eclipse workspace with Pivot-2.0.x sources and your project. But when I run FL-Client main application (org.fullthrust.client.Client) on a JDK 7 under Windows 7, I get this: [ERROR] Problem reading font data/font/Monkirta Pursuit NC.ttf. Defaulting to Arial. [DEBUG] EventManager(org.fullthrust.core.events.state.ErrorMsgEvent@7b1c661c) java.lang.NullPointerException at org.fullthrust.client.Options.init(Options.java:38) at org.fullthrust.client.Client.startup(Client.java:70) at org.apache.pivot.wtk.DesktopApplicationContext$2.run(DesktopApplicationContext.java:666) because f = Font.getFont("Arial"); in my environment returns null, but changing it using Font.decode (like in Pivot) it works ... but after this I get another NPE because all data/ folder is missing from sources, so I have to stop now: [ERROR] Could not load data/bxml/Window.bxml Ok, just found the trick to make it work in eclipse: copy your data folder to a new one (mine is "other") and add it as Linked folder in eclipse project, but probably it would be better to move it in a near-empty eclipse project with the data folder inside src (or like Maven, a resources source folder with data/... inside), and make FL-Client dependent on it. But after this I see that for example here: window = (Window)bxmlSerializer.readObject(new FileInputStream(new File("data/bxml/Window.bxml"))); you use the base version of that Pivot API but in this case it would be better at least in my dev env): window = (Window)bxmlSerializer.readObject(this.getClass(), "/data/bxml/Window.bxml"); and then the same for data/bxml/Login.bxml and ConnectDialog.bxml ... After this of course ow I get a Connection error to the server (not started) ... but to simplify my test (I have very few time and still didn't see the error) can I skip this, or can you set a mock for the connection that i can enable only for my tests ? I downloaded your projects with git, so tell me when you push some update .
        Hide
        anvilfolk João Martins added a comment - - edited

        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!

        Show
        anvilfolk João Martins added a comment - - edited 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!
        Hide
        smartini Sandro Martini added a comment -

        Just integrated (Committed in revision 1657421) your test classes, but I had to align with Pivot ... you can find them under branches/2.0.x (a merge even in trunk will follow next).
        Note that because of its usage of SVGSalamander now even the tests subproject must have access to it to compile (change just done, in eclipse files and in build.xml).

        @João:
        How do you zoom in/out ? How do you move the ViewBox, using scrolling or other ?
        Sorry for questions but I must be sure of what is the error and how to reproduce it ...
        Last, if you should do some changes to test files, please use those just integrated and provide here a diff.

        Show
        smartini Sandro Martini added a comment - Just integrated (Committed in revision 1657421) your test classes, but I had to align with Pivot ... you can find them under branches/2.0.x (a merge even in trunk will follow next). Note that because of its usage of SVGSalamander now even the tests subproject must have access to it to compile (change just done, in eclipse files and in build.xml). @João: How do you zoom in/out ? How do you move the ViewBox, using scrolling or other ? Sorry for questions but I must be sure of what is the error and how to reproduce it ... Last, if you should do some changes to test files, please use those just integrated and provide here a diff.
        Hide
        smartini Sandro Martini added a comment -

        I hope too we'll find the real problem ...

        > Would I need to build Apache Pivot 2.0.x myself, or are there some .jar files that I can easily test out (didn't find any)?
        to test with updated Pivot you can build Pivot sources using Ant (because snapshot files are not saved by our Jenkins builds) ... but at the moment you can skip this step (in 2.0.x and in trunk there aren't relevant changes related to this issue and to svg) ...

        Let's update in a few days.

        Show
        smartini Sandro Martini added a comment - I hope too we'll find the real problem ... > Would I need to build Apache Pivot 2.0.x myself, or are there some .jar files that I can easily test out (didn't find any)? to test with updated Pivot you can build Pivot sources using Ant (because snapshot files are not saved by our Jenkins builds) ... but at the moment you can skip this step (in 2.0.x and in trunk there aren't relevant changes related to this issue and to svg) ... Let's update in a few days.
        Hide
        anvilfolk João Martins added a comment -

        Hello,

        No problem at all. Hopefully we can figure out where the problem is

        I just confirmed the issue is also present in MacOS 10.8.5.

        It also remains if I substitute svgSalamander.jar for svgSalamander-tiny.jar, both from https://svgsalamander.java.net/ as well as http://svn.apache.org/repos/asf/pivot/branches/2.0.x/wtk/lib/

        Would I need to build Apache Pivot 2.0.x myself, or are there some .jar files that I can easily test out (didn't find any)?

        Show
        anvilfolk João Martins added a comment - Hello, No problem at all. Hopefully we can figure out where the problem is I just confirmed the issue is also present in MacOS 10.8.5. It also remains if I substitute svgSalamander.jar for svgSalamander-tiny.jar, both from https://svgsalamander.java.net/ as well as http://svn.apache.org/repos/asf/pivot/branches/2.0.x/wtk/lib/ Would I need to build Apache Pivot 2.0.x myself, or are there some .jar files that I can easily test out (didn't find any)?
        Hide
        smartini Sandro Martini added a comment -

        Hi João, thanks for attaching test cases and for providing so much info, in a few days I'll take a look ans post here some update.
        In the meantime, could you try even with an updated svgSalamander jar, or from code from branches/2.0.x (where svgSalamander jar has been updated to latest stable) ?

        Thanks,
        Sandro

        Show
        smartini Sandro Martini added a comment - Hi João, thanks for attaching test cases and for providing so much info, in a few days I'll take a look ans post here some update. In the meantime, could you try even with an updated svgSalamander jar, or from code from branches/2.0.x (where svgSalamander jar has been updated to latest stable) ? Thanks, Sandro
        Hide
        anvilfolk João Martins added a comment -

        For more information: I'm developing an application in which the viewBox is translated and scaled to display a large "world", by recentering the viewBox and zooming in and out.

        The boundary between the SVG rendering and not rendering doesn't appear to be totally arbitrary. It seems related to some sort of bounds, but having a zoomed out view sometimes renders while zooming in ceases to render. Moving the viewBox overly to the left, right, top or bottom of the 2000x1000 rectangle seems to stop the rendering. If one remains in the vicinity of the 0,0 origin, zooming in and out, even translating a little bit around it (i.e. less than 1000 away) seems to work fine.

        Hopefully this is useful information. I really hope this can be fixed soon - it's impossible to use the application otherwise.

        Show
        anvilfolk João Martins added a comment - For more information: I'm developing an application in which the viewBox is translated and scaled to display a large "world", by recentering the viewBox and zooming in and out. The boundary between the SVG rendering and not rendering doesn't appear to be totally arbitrary. It seems related to some sort of bounds, but having a zoomed out view sometimes renders while zooming in ceases to render. Moving the viewBox overly to the left, right, top or bottom of the 2000x1000 rectangle seems to stop the rendering. If one remains in the vicinity of the 0,0 origin, zooming in and out, even translating a little bit around it (i.e. less than 1000 away) seems to work fine. Hopefully this is useful information. I really hope this can be fixed soon - it's impossible to use the application otherwise.
        Hide
        anvilfolk João Martins added a comment -

        Pivot example - with bug.

        Show
        anvilfolk João Martins added a comment - Pivot example - with bug.
        Hide
        anvilfolk João Martins added a comment -

        Swing example - working. No bug.

        Show
        anvilfolk João Martins added a comment - Swing example - working. No bug.

          People

          • Assignee:
            smartini Sandro Martini
            Reporter:
            anvilfolk João Martins
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development