GithubHelp home page GithubHelp logo

Comments (7)

christopho avatar christopho commented on September 27, 2024

This is only possible from the edit entity dialog box. But still a bug, yes.

from solarus-quest-editor.

Maxs1789 avatar Maxs1789 commented on September 27, 2024

I see three ways to solve this issue:

  1. Check values when closing the dialog and show an appropriate error message.
  2. Detect value changes then force the value to be a multiple of the base size:
    round(value / size) * size.
  3. Use suffix of QSpinBox to display n * size where n >= 1, so the user cannot set arbitrary values.

I like the last one because it's very simple and gives informations about the base size.

from solarus-quest-editor.

christopho avatar christopho commented on September 27, 2024

Even if 1 was the behavior in the old editor, I'd say 2, like we do for the entity name: we silently change it it is already used.
3 is not an option to me.

from solarus-quest-editor.

Maxs1789 avatar Maxs1789 commented on September 27, 2024

Ok, and what do you think about the idea to consider the ResizeMode in the edit entity dialog box?

  • ResizeMode::NONE: disable two spin boxes.
  • ResizeMode::HORIZONTAL_ONLY: disable the height spin box.
  • ResizeMode::VERTICAL_ONLY: disable the width spin box.
  • ResizeMode::SQUARE: detect when one of these spin boxes change and set the same value to the other one.
  • ResizeMode::SINGLE_DIMENSION: the more complex, I don't know how to handle this case.
  • ResizeMode::MULTI_DIMENSION_ONE: nothing to do.
  • ResizeMode::MULTI_DIMENSION_ALL: nothing to do.

Also, what about the EntityModel::is_size_valid() method?

I think we should replace

if (width % 8 != 0 || height % 8 != 0) {
  return false;
}

by

if (width % base_size.width() != 0 || height % base_size.height() != 0) {
  return false;
}

It seems to me that width and height of the base_size are always multiple of 8.

from solarus-quest-editor.

christopho avatar christopho commented on September 27, 2024

Good ideas. For ResizeMode::SINGLE_DIMENSION: detect when one of these spin boxes change and set the base size to the other one.
Ok for the is_size_valid() change but first we need to check all callers.

from solarus-quest-editor.

Maxs1789 avatar Maxs1789 commented on September 27, 2024

This is done for ResizeMode constraints!

But I realized that in this context, the modes SQUARE and SINGLE_DIMENSION aren't possible because they don't corresponds to a TilePatternRepeatMode.

Finally, we silently change values when closing the dialog or directly when editing spin boxes?

And for callers of the is_size_valid() I think it's ok.


Edit: I am wrong, the jumpers can be in ResizeMode::SQUARE and separators can be in ResizeMode::SINGLE_DIMENSION. I was thinking only about tiles ...

from solarus-quest-editor.

Maxs1789 avatar Maxs1789 commented on September 27, 2024

All done!

Commited in master:

from solarus-quest-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.