Closed moinmoin-sh closed 2 years ago
I wonder if we should look to re-organise this payload a bit - the zoom
, posOffset
and angle
are image only related but they are in the root tile payload.
What about something like;
{
"tiles":[
{
"screen": <number>,
"tile": <number>,
"image": {
"base64": "<encodeBase64(.png)>",
"zoom": <number>,
"offset": [<x number>,<y number>],
"angle": <number>
}
}
]
}
That makes sense. I was already thinking about an additional cmnd/ that set the parameters of a previously sent image which saves sending and rendering the same image everytime
{
"tiles":[
{
"screen": <number>,
"tile": <number>,
"imageProperties": {
"zoom": <number>,
"offset": [<x number>,<y number>],
"angle": <number>
}
}
]
}
Would it make sense to keep everything in the one "image": {}
payload, and if you don't want/need to send the image itself you just leave out the "base64": <>
field (i.e. if already sent earlier)?
OK, so empty "image" (may be change to "bgImage") payload means remove the image
missing/empty "base64" means use existing image
That sounds good to me.
Please see updated top comment.
Looks great, ship it!
This allows to rotate the bg image.
EDIT: updated to match latest changes
An additional parameter is added to the payload and the stucture of the payload has changed (sorry):
"angle":<number>
is an integer that defines the rotation angle in increments of 0.1 deg (eg 900 = 90 deg)+ <number>
rotates CW ,- <number>
rotates CCWeach rotation is absolute from origin (not incremental)
key is now
"bgImage"
"bgImage":{}
removes the bg image"bgImage":{ without "base64"}
applies the properties (zoom, angle, offset) to the previously loaded image -> changing the properties of an existing image doesn't require to load the image again.If the image is removed once, it has to be reloaded.
Missing properties are set to default. With all properties missing the original image is positioned in the center of the tile.