os-js / osjs-widgets

OS.js Widgets Module
https://manual.os-js.org/v3/
2 stars 4 forks source link

keep position of widgets consistent relative to desktop window size #17

Open mahsashadi opened 3 years ago

mahsashadi commented 3 years ago

By solving this issue, widgets' position change when desktop size gets smaller.

How can I have the feature that widgets' (and applications) position remain consistent in relative to desktop window.

For example if the widget is horizontally and vertically at the middle of window, I need it to stay at middle by both increasing and decreasing desktop size.

andersevenrud commented 3 years ago

I suppose the clamp functionality that's now used to bring widgets and windows inside the viewport on resize could have two modes.

  1. Current behavior: just move into viewport whenever widget/window overflows
  2. Always move widget/window in the direction of the delta from viewport resize

The only issue I potentially can see with doing this is how to properly handle the states when a resize occurs. Since the positions are absolute with a pixel value and there's no "start" or "end" events for resizing there has to be some sort of timer involved with it's own state for managing the positions :thinking:

I'll have to think about this one :sweat_smile: