Skip to content

Commit

Permalink
fix(api): use explicit UpdateStatesFromObjects instead of Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jspanchu committed Feb 28, 2024
1 parent f9f58c3 commit 36dc58c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion trame_vtklocal/module/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, *args, **kwargs):
self.vtk_object_manager.Initialize()

def update(self):
self.vtk_object_manager.Update()
self.vtk_object_manager.UpdateStatesFromObjects()

@property
def active_ids(self):
Expand Down
30 changes: 15 additions & 15 deletions trame_vtklocal/module/serve/wasm/vtkObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,23 +380,23 @@ var tempDouble;
var tempI64;

var ASM_CONSTS = {
1580140: () => {
1579484: () => {
if (typeof (AudioContext) !== "undefined") {
return true;
} else if (typeof (webkitAudioContext) !== "undefined") {
return true;
}
return false;
},
1580287: () => {
1579631: () => {
if ((typeof (navigator.mediaDevices) !== "undefined") && (typeof (navigator.mediaDevices.getUserMedia) !== "undefined")) {
return true;
} else if (typeof (navigator.webkitGetUserMedia) !== "undefined") {
return true;
}
return false;
},
1580521: $0 => {
1579865: $0 => {
if (typeof (Module["SDL2"]) === "undefined") {
Module["SDL2"] = {};
}
Expand All @@ -418,11 +418,11 @@ var ASM_CONSTS = {
}
return SDL2.audioContext === undefined ? -1 : 0;
},
1581014: () => {
1580358: () => {
var SDL2 = Module["SDL2"];
return SDL2.audioContext.sampleRate;
},
1581082: ($0, $1, $2, $3) => {
1580426: ($0, $1, $2, $3) => {
var SDL2 = Module["SDL2"];
var have_microphone = function(stream) {
if (SDL2.capture.silenceTimer !== undefined) {
Expand Down Expand Up @@ -463,7 +463,7 @@ var ASM_CONSTS = {
}, have_microphone, no_microphone);
}
},
1582734: ($0, $1, $2, $3) => {
1582078: ($0, $1, $2, $3) => {
var SDL2 = Module["SDL2"];
SDL2.audio.scriptProcessorNode = SDL2.audioContext["createScriptProcessor"]($1, 0, $0);
SDL2.audio.scriptProcessorNode["onaudioprocess"] = function(e) {
Expand All @@ -475,7 +475,7 @@ var ASM_CONSTS = {
};
SDL2.audio.scriptProcessorNode["connect"](SDL2.audioContext["destination"]);
},
1583144: ($0, $1) => {
1582488: ($0, $1) => {
var SDL2 = Module["SDL2"];
var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels;
for (var c = 0; c < numChannels; ++c) {
Expand All @@ -494,7 +494,7 @@ var ASM_CONSTS = {
}
}
},
1583749: ($0, $1) => {
1583093: ($0, $1) => {
var SDL2 = Module["SDL2"];
var numChannels = SDL2.audio.currentOutputBuffer["numberOfChannels"];
for (var c = 0; c < numChannels; ++c) {
Expand All @@ -507,7 +507,7 @@ var ASM_CONSTS = {
}
}
},
1584229: $0 => {
1583573: $0 => {
var SDL2 = Module["SDL2"];
if ($0) {
if (SDL2.capture.silenceTimer !== undefined) {
Expand Down Expand Up @@ -545,7 +545,7 @@ var ASM_CONSTS = {
SDL2.audioContext = undefined;
}
},
1585401: ($0, $1, $2) => {
1584745: ($0, $1, $2) => {
var w = $0;
var h = $1;
var pixels = $2;
Expand Down Expand Up @@ -616,7 +616,7 @@ var ASM_CONSTS = {
}
SDL2.ctx.putImageData(SDL2.image, 0, 0);
},
1586870: ($0, $1, $2, $3, $4) => {
1586214: ($0, $1, $2, $3, $4) => {
var w = $0;
var h = $1;
var hot_x = $2;
Expand Down Expand Up @@ -653,18 +653,18 @@ var ASM_CONSTS = {
stringToUTF8(url, urlBuf, url.length + 1);
return urlBuf;
},
1587859: $0 => {
1587203: $0 => {
if (Module["canvas"]) {
Module["canvas"].style["cursor"] = UTF8ToString($0);
}
},
1587942: () => {
1587286: () => {
if (Module["canvas"]) {
Module["canvas"].style["cursor"] = "none";
}
},
1588011: () => window.innerWidth,
1588041: () => window.innerHeight
1587355: () => window.innerWidth,
1587385: () => window.innerHeight
};

/** @constructor */ function ExitStatus(status) {
Expand Down
Binary file modified trame_vtklocal/module/serve/wasm/vtkObjectManager.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion trame_vtklocal/widgets/vtklocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, render_window, **kwargs):

# Must trigger update after registration
self._window_id = self.object_manager.RegisterObject(render_window)
self.object_manager.Update()
self.object_manager.UpdateStatesFromObjects()

self._attributes["rw_id"] = f'render-window="{self._window_id}"'
self._attributes["ref"] = f'ref="{self.__ref}"'
Expand Down
2 changes: 1 addition & 1 deletion vue-components/src/components/VtkLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
});
await Promise.all(pendingRequests);
try {
objectManager.update();
objectManager.updateObjectsFromStates();
} catch (e) {
console.error("WASM update failed");
console.log(e);
Expand Down

0 comments on commit 36dc58c

Please sign in to comment.