Image doesn't fit on canvas (1.14)

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Image doesn't fit on canvas (1.14)

Post by vghetto »

Hi,
On 1.14 I'm getting Image doesn't fit on canvas error.

Code: Select all

20220116 12:10:03 error general: An error due to possibly invalid WML occurred
The error message is :
Image doesn't fit on canvas.

When reporting the bug please include the following error message :
Condition 'as_int >= 0' failed at /mnt/SDB/src/wesnoth/build/wesnoth/src/gui/core/canvas.cpp:1041 in function 'dimension_validation'. Extra development information: Image 'misc/new-battle2.png', x = -15.
The culprit is this bit:

Code: Select all

        [part]
            [background_layer]
                image=misc/bigmap1.png
            [/background_layer]
            show_title=yes
            {NEW_BATTLE 835 400}
        [/part]
Any ideas on how to fix that?
misc/bigmap1.png dimensions are 1024x768.
error.png
On 1.16 I'm not getting an error, but it doesn't seem to be placing the battle marker on the right place either. It's showing it in the top left corner.
User avatar
beetlenaut
Developer
Posts: 2813
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Image doesn't fit on canvas (1.14)

Post by beetlenaut »

Overlay images (like in NEW_BATTLE) are placed using the dimensions of the image set by the "background" key in [part], not by the image in the [background_layer] tag. (You can have it use the layer, but you would have to specify that.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: Image doesn't fit on canvas (1.14)

Post by vghetto »

That explains why the overlay was displayed in the top left corner in 1.16.

So there are two solutions for it.

Code: Select all

        [part]
            [background_layer]
                image=misc/bigmap1.png
                base_layer=yes
            [/background_layer]
            show_title=yes
            {NEW_BATTLE 835 400}
        [/part]
or

Code: Select all

        [part]
            background=misc/bigmap1.png
            show_title=yes
            {NEW_BATTLE 835 400}
        [/part]
Thank you for your help!
Post Reply