mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix GalleryStorageService
GalleryStorageService is sending JSON so it couldn't serialize the ArrayBuffer which came from serializing the Piskel. In this commit it sends the ArrayBuffer as an Array to the server so it can store it easily.
This commit is contained in:
parent
baf8049ea6
commit
5577c3ab5a
@ -12,7 +12,7 @@
|
|||||||
var deferred = Q.defer();
|
var deferred = Q.defer();
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
framesheet : this.piskelController.serialize(),
|
framesheet : '[' + new Uint8Array(this.piskelController.serialize()) + ']',
|
||||||
fps : this.piskelController.getFPS(),
|
fps : this.piskelController.getFPS(),
|
||||||
name : descriptor.name,
|
name : descriptor.name,
|
||||||
description : descriptor.description,
|
description : descriptor.description,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
var modelVersion;
|
var modelVersion;
|
||||||
|
|
||||||
var isJSON = false;
|
var isJSON = false;
|
||||||
if (data instanceof ArrayBuffer) {
|
if (data instanceof ArrayBuffer || data instanceof Array) {
|
||||||
var uint8 = new Uint8Array(data);
|
var uint8 = new Uint8Array(data);
|
||||||
|
|
||||||
// Backward compatibility for JSON (modelVersion < 3)
|
// Backward compatibility for JSON (modelVersion < 3)
|
||||||
@ -22,7 +22,7 @@
|
|||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
modelVersion = data.modelVersion;
|
modelVersion = data.modelVersion;
|
||||||
} else {
|
} else {
|
||||||
var arr16 = new Uint16Array(data);
|
var arr16 = new Uint16Array(uint8.buffer);
|
||||||
modelVersion = arr16[0];
|
modelVersion = arr16[0];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -47,7 +47,7 @@
|
|||||||
var j;
|
var j;
|
||||||
var buffer = this.data_;
|
var buffer = this.data_;
|
||||||
var arr8 = new Uint8Array(buffer);
|
var arr8 = new Uint8Array(buffer);
|
||||||
var arr16 = new Uint16Array(buffer);
|
var arr16 = new Uint16Array(arr8.buffer);
|
||||||
var sub;
|
var sub;
|
||||||
|
|
||||||
/********/
|
/********/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user