Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    Game notes max width

    Map Making
    4
    36
    1496
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Cernel Moderators @redrum last edited by

      @redrum The only way I can explain this is that there must be something somewhere in the program that increases all "px" values given in notes by 30%. It would be good to get rid of it. Hardly any idea why any developers decided to have this, if I'm right.

      1 Reply Last reply Reply Quote 0
      • Frostion
        Frostion Admin last edited by Frostion

        A bit of topic, but .... can notes have background picture instead of background color? If so, what would the code look like?

        BTW, and if it is of any use, I use text max width in some map notifications instead of a <br> at every line to keep a long sentence to not make the notification window very wide. Notification code looks like this like this:
        HumansIntro=<body><p style="width: 260px"><img src="IntroLogo.png"/><br><b>Humans:</b><br>Bla bla bla.<br><img src="GreatBattleArthur.png"/><br><br></p></body>
        But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose.

        C 1 Reply Last reply Reply Quote 0
        • C
          Cernel Moderators @Frostion last edited by

          @Frostion said in Game notes max width:

          But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose.

          Yes, and I would say that is bad. Then, if someone would (finally) fix this problem (if it is a problem), your layout would be messed up. Probably other mapmakers do the same, and maybe don't even realize it.

          My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.

          As far as background pictures go, I think that would be another topic.

          1 Reply Last reply Reply Quote -1
          • LaFayette
            LaFayette Admin last edited by

            @Cernel said in Game notes max width:

            My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.

            Quite positive no. AFAIK the HTML of game notes is plopped into the Swing UI for rendering. I'd conclude it's more a problem with the dimensions calculations the HTML rendering is using. Inline styles of some elements can be overridden to stretch/fill space. You may need to include a 'filler' element that can occupy the extra space that is being used so that the 'filler' is expanded rather than the HTML engine stretching your component. For example, consider this:

            <p style="width:500px">
               <p style="width:250px">
              </p>
            </p>
            

            you might think that nested element is going to be 250px wide, but the engine sees that the component needs to be made 500px, so you the child styling might lose or might win, it totally depends on the HTML rendering engine.

            Some things you can try:

            • try a table, the width of tables is usually respected
            • avoid nesting elements with width specifications
            • see if you can get the HTML to render well in a web browser, if you can't get it to render well there, then there is not much hope in a swing HTML renderer.
            C 1 Reply Last reply Reply Quote 0
            • C
              Cernel Moderators @LaFayette last edited by

              @LaFayette I've tried in several other cases, also on otherwise completely blank or next to blank notes, as per screenshots at this thread, and it still gives 30% more pixels. Look at this:
              https://forums.triplea-game.org/topic/1784/game-notes-max-width/6?page=1

              LaFayette 1 Reply Last reply Reply Quote 0
              • LaFayette
                LaFayette Admin @Cernel last edited by

                @Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.

                C 2 Replies Last reply Reply Quote 0
                • C
                  Cernel Moderators @LaFayette last edited by

                  @LaFayette said in Game notes max width:

                  @Cernel Give it a try as a web-page.

                  What do you mean?

                  1 Reply Last reply Reply Quote 0
                  • LaFayette
                    LaFayette Admin last edited by

                    Save the HTML content as a ".html" file and open it in a web browser.

                    1 Reply Last reply Reply Quote 0
                    • C
                      Cernel Moderators @LaFayette last edited by

                      @LaFayette said in Game notes max width:

                      @Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.

                      Ok here it is what I get on a html file with this code:

                      <html>
                      <body>
                      <table width="1000px" border="1px">
                        <tr>
                          <th>AAA</th>
                          <th>BBB</th> 
                        </tr>
                        <tr>
                          <td>aaa</td>
                          <td>bbb</td> 
                        </tr>
                      </table>
                      </body>
                      </html>
                      

                      Screenshot:
                      508791ff-bc01-40f8-b30b-b55e5523b907-image.png

                      It's fully correct. So, does this prove the problem (getting 130% the pixels you ask for) is not with my system, but with TripleA?

                      1 Reply Last reply Reply Quote 0
                      • LaFayette
                        LaFayette Admin last edited by

                        We're using Swing HTML rendering, we literally can't fix it and have not coded anything to alter or manage it. The fix needs to be in crafting the HTML that renders properly in that HTML rendering engine.

                        1 Reply Last reply Reply Quote 0
                        • LaFayette
                          LaFayette Admin last edited by

                          Correct rendering in a webpage is necessary but not sufficient criteria for having it render well in the Swing HTML renderer. Said another way, if it does not work on a vanilla webpage, it certainly won't work in Swing. But even if it renders well on a modern browser, the Swing HTML renderer does not guarantee to be compliant, is old, and has no guarantee it'll do anything really correctly.

                          1 Reply Last reply Reply Quote 0
                          • C
                            Cernel Moderators last edited by

                            Well, in my opinion this is a pretty major issue TripleA is going to go along with, as mapmakers will keep formatting notes likely inherently wrong, with respect to their intentions (like @Frostion), over the years, and new mapmakers will have to find out that they are getting 30% more pixel than they wanted, so I suggest at least tracking this somewhere.

                            1 Reply Last reply Reply Quote 0
                            • LaFayette
                              LaFayette Admin last edited by

                              Tracking is for things we can fix and do something about. The problem is in the HTML and the HTML renderer, neither of which is controlled by the game engine proper.

                              1 Reply Last reply Reply Quote 0
                              • C
                                Cernel Moderators last edited by Cernel

                                Ok, anyway, if anybody is curious about this problem that, apparently, will never be possibly fixed, you can install this map:
                                0.zip

                                Then, starting it, if you see what I see, you should see a table of 130 pixels wideness, while, opening the xml, you can see this is the code of the notes property:

                                    <property name="notes">
                                      <string/>
                                      <value><![CDATA[
                                <html>
                                <body>
                                <table style="width:100px;background-color:FFFFFF">
                                  <tr>
                                    <th>a</th>
                                    <th>b</th> 
                                  </tr>
                                  <tr>
                                    <td>c</td>
                                    <td>d</td> 
                                  </tr>
                                </table>
                                </body>
                                </html>
                                				]]></value>
                                    </property>
                                

                                The map works both on 1.9 and 2.0.

                                If you believe the wideness of the table in notes is given as 100 pixels (as it should), please upload a screenshot of it.

                                1 Reply Last reply Reply Quote 0
                                • C
                                  Cernel Moderators last edited by

                                  Issue tracked in:
                                  https://github.com/triplea-game/triplea/issues/6157

                                  1 Reply Last reply Reply Quote 0
                                  • LaFayette
                                    LaFayette Admin last edited by

                                    @Cernel the HTML needs to be fixed within the constraints of the HTML rendering. There is no code fix for us to apply here. We're not modifying the HTML, we're not rendering it ourselves. There is no way we're going to change anything (short of rebuilding an HTML renderer, IE; a web-browser) that makes this exact HTML render how you want.

                                    1 Reply Last reply Reply Quote 0
                                    • 1
                                    • 2
                                    • 2 / 2
                                    • First post
                                      Last post
                                    Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums