SynchroLabs / SynchroServer

The Synchro Server platform
https://synchro.io
1 stars 2 forks source link

Image control scaling support #4

Closed BobDickinson closed 8 years ago

BobDickinson commented 10 years ago

Currently, height and width attributes determine display size (as normal for control).

Scaling support needs to be added. The image control does not yet expose it, but all platforms have native support for:

Image scaling is currently the default on each platform (stretch?).

"None" does not seem particularly useful in our implementation (as the user is more or less abstracted from both the pixel size of the image and the effective DPI of the client display).

If we have scaling, we will also need to support alignment. For example, for a "fit" scaling, the image will be made to completely fit inside of the control dimensions, meaning that we need to be able to align the image in the dimension that does not fit exactly (assuming there is one). For a "fill" scaling, the image will fill the control dimensions in both dimensions, meaning that it may actually overflow in one dimension, and we would want to be able to align the image in the overflow dimension.

It would be nice to also have:

The values, combined with default ("wrap content") sizing in the opposite dimension, provide some added layout functionality. For example, in a vertical stack layout, it would be nice to have an image fill the width, but have the control be only as tall as needed, so that the controls underneath are tightly aligned underneath.

Another way of looking at this is that we could have the sizing logic handle the case of "fit" scaling when only one dimension of the control was specified (have it set the other dimension based on the size in the size-specified dimension and the image aspect ratio). Not sure how that magic would work on all platforms, but maybe.

BobDickinson commented 8 years ago

This is now implemented and documented.