Merge pull request #436 from GridSpace/filename-widget-codec

add file meta to widget codec
This commit is contained in:
Stewart Allen 2025-10-16 19:57:16 -07:00 committed by GitHub
commit 8032569b45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -225,7 +225,9 @@ Widget.prototype.encode = function(state) {
json: json, // safe for JSON (float32array mess) json: json, // safe for JSON (float32array mess)
group: this.group.id, group: this.group.id,
track: this.track, track: this.track,
geo: json ? Array.from(geo) : geo geo: json ? Array.from(geo) : geo,
meta: this.meta,
anno: this.anno,
}; };
return coded; return coded;
}; };
@ -234,8 +236,12 @@ registerDecoder(TYPE.WIDGET, function(v, state) {
const id = v.id, const id = v.id,
group = v.group || id, group = v.group || id,
track = v.track || undefined, track = v.track || undefined,
widget = newWidget(id, Widget.Groups.forid(group)); widget = newWidget(id, Widget.Groups.forid(group)),
meta= v.meta || widget.meta,
anno = v.anno || widget.anno;
widget.meta = meta;
widget.anno = anno;
widget.loadVertices(v.json ? v.geo.toFloat32() : v.geo); widget.loadVertices(v.json ? v.geo.toFloat32() : v.geo);
widget.saved = Date.now(); widget.saved = Date.now();
if (track && track.pos) { if (track && track.pos) {