simplajs / simpla-img

An editable image you can update inline, built on Simpla
https://www.simplajs.org
MIT License
6 stars 3 forks source link

Reimplement img upload 'pulsing' animation #55

Open madeleineostoja opened 7 years ago

madeleineostoja commented 7 years ago

Img should have a (private?) loading or uploading state, and apply a basic pulsing animation while it is true. Interface regression from v0 that needs to be reimplemented.

madeleineostoja commented 7 years ago

@bede any thoughts on an uploading type prop for this? Could take advantage of new buffer state in SDK no?

bedeoverend commented 7 years ago

@seaneking yeah so the buffer state currently won't suffice, agree a prop for it would be nice. Essentially it's just a way for the SDK to say: path X is currently being saved. Do you want to make an issue on the SDK for a way to check that saves are taking place? e.g. just buffer[this.path].saving === true?

madeleineostoja commented 7 years ago

So you mean tacking on a saving prop to the buffer path objects? That seems pretty messy. Maybe they should have a general meta object for all this stuff (saving, modified, etc.) Also it'd mean that the image would have to poll that anyway. Maybe have a separate saving state (either plain Boolean or array of paths saving, which you could check length for Boolean behaviour), and then images can just pulse if in the dirty buffer and saving is true. Seems a lot more general, and fills this use case well enough. Not sure though.

bedeoverend commented 7 years ago

Re: where to put it, yeah not 100% sure on whether it should be in buffer or somewhere else, but buffer seems good enough.

As for polling - it would just be in the observer, so Simpla.observeState('buffer', (buffer) => this.saving = buffer[this.path].saving)

madeleineostoja commented 7 years ago

Oh derp yeah obviously haha.

Yeah not sure about putting it in buffer...