10 downloads

Description

This is a demonstration of an advanced algorithm for moving widgets on the MFD screen by touch (mouse cursor). This algorithm allows you to move widgets by any part of them, just like on a real touchpad.
The default widget movement algorithm has a significant drawback – the widget pivot moves to the cursor coordinates regardless of the cursor position relative to the widget. Because of this, the widget movement is abrupt and incorrect, which prompted me to create an advanced algorithm.
The difference in moving widgets can be seen in the gif below (the right display shows the default algorithm, the middle display shows the advanced algorithm, and the left display shows the advanced algorithm for moving widgets with a fixed step).


Description of advanced algorithm

The idea is to move the widget along the X and Y axis by some number of pixels obtained by subtracting the coordinates of the local cursor position on the widget obtained by pressing down on the widget from the current coordinates of the local cursor position on the widget:
1) Move the widget to the top layer and save the coordinates of the local cursor position on the widget (initCord) when the user presses down on the widget for the first time;
2) Get the coordinates of the local cursor position on the widget when the user drags the cursor (currCord);
3) Calculate the value of the coordinates deltaCord = currCord - initCord;
4) Move the widget along the X and Y axis by the calculated number of pixels (deltaCordX & deltaCordY)

Description of displays

Display 1 – default widget movement algorithm;
Display 2 – advanced widget moving algorithm;
Display 3 – advanced widget movement algorithm with pixel binding (widget position coordinates can only take integer values);
Display 4 – advanced algorithm for moving widgets with a fixed step. Use AG1 to change the step value;
Display 5 – an example of the functioning of the above algorithms in the form of sliders.

Thus, it is advisable to use an advanced algorithm for smooth movement of large widgets.

I hope this will be useful to you in your own display programs.

GENERAL INFO

  • Created On: Windows
  • Game Version: 1.3.204.1
  • Price: $239k
  • Number of Parts: 7
  • Dimensions: 2 m x 3 m x 1 m

PERFORMANCE

  • Total Delta V: 0m/s
  • Total Thrust: 0N
  • Engines: 0
  • Wet Mass: 226kg
  • Dry Mass: 226kg

STAGES

Stage Engines Delta V Thrust Burn Mass

3 Comments

  • Log in to leave a comment
  • Profile image
    3,518 IcEStaR

    Your feedback, bug reports, questions and tips are welcome!

    Pinned 2 days ago
  • Profile image
    3,518 IcEStaR

    @Reberbri Thanks!

    14 hours ago
  • Profile image
    1,145 Reberbri

    Well done!! I will definitely have to scour over your code, I've been wanting to make an "edit layout" section in the settings of my current MFD OS build

    yesterday

3 Upvotes

Log in in to upvote this post.