new State()
- Source:
State class. Saves: data url/path, display info.
History:
- v0.5 (dwv 0.30.0, ??/2021)
- store position as array
- new draw position group key
- v0.4 (dwv 0.29.0, 06/2021)
- move drawing details into meta property
- remove scale center and translation, add offset
- v0.3 (dwv v0.23.0, 03/2018)
- new drawing structure, drawings are now the full layer object and using toObject to avoid saving a string representation
- new details structure: simple array of objects referenced by draw ids
- v0.2 (dwv v0.17.0, 12/2016)
- adds draw details: array [nslices][nframes] of detail objects
- v0.1 (dwv v0.15.0, 07/2016)
- adds version
- drawings: array [nslices][nframes] with all groups
- initial release (dwv v0.10.0, 05/2015), no version number...
- content: window-center, window-width, position, scale, scaleCenter, translation, drawings
- drawings: array [nslices] with all groups
Methods
apply(app, data)
- Source:
Load an application state from JSON.
Parameters:
Name | Type | Description |
---|---|---|
app |
object | The app to apply the state to. |
data |
object | The state data. |
fromJSON(json) → {object}
- Source:
Load an application state from JSON.
Parameters:
Name | Type | Description |
---|---|---|
json |
string | The JSON representation of the state. |
Returns:
The state object.
- Type
- object
toJSON(app) → {string}
- Source:
Save the application state as JSON.
Parameters:
Name | Type | Description |
---|---|---|
app |
object | The associated application. |
Returns:
The state as a JSON string.
- Type
- string