-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loadNFTMarkers has incorrect onSuccess signature #230
Comments
Hi @antokhio have you a piece of code to test? currently with ARnft (see Worker.ts) i never had this issue https://github.com/webarkit/ARnft/blob/bf748f29af0ce694c2f8730115468a113fb884a4/src/Worker.ts#L104-L116 ar.loadNFTMarkers(nftMarkerUrls, (id: number) => {
let marker = ar.getNFTData(ar.id, 0);
ctx.postMessage({ type: "markerInfos", marker: marker });
ar.trackNFTMarkerId(id);
console.log("loadNFTMarker -> ", id);
console.log(id);
ctx.postMessage({ type: "endLoading", end: true });
}).catch((err: any) => {
console.error("Error in loading marker on Worker", err);
});
ctx.postMessage({ type: "loaded", proj: JSON.stringify(cameraMatrix) });
}; I think jsartoolkitNFT need some improves in type checking see for example the LoadNFTMarkers jsartoolkitNFT/src/ARControllerNFT.ts Lines 704 to 719 in 9277579
at line 712 (ids: any) => {
...
} I think this is really odd... |
@kalwalt here is WIP project, https://github.com/antokhio/react-three-jsartoolkitnft/blob/main/src/workers/arnft.worker.ts Just to note, trying to make it an npm package, but i have issues with web worker bundling i can't sort out for a week or so ;) if you wanna test it, this minimum code to make it work: function App() {
return (
<ARNFTCanvas>
<ARNFTMarker markers={['/markers/pinball']} persisted>
<Box args={[100, 100, 100]} />
</ARNFTMarker>
<ARNFTMarker markers={['/markers/insta']}>
<Sphere args={[100, 100, 100]} />
</ARNFTMarker>
</ARNFTCanvas>
);
} p.s. there gonna be a bit of refactor/cleanup when i manage to make worker portable |
@kalwalt the problem is line 706 jsartoolkitNFT/src/ARControllerNFT.ts Line 706 in 9277579
this prevents call with correct signature.... likely it's just misstyped however according to this: jsartoolkitNFT/src/ARControllerNFT.ts Lines 100 to 105 in 9277579
the return type should be: {id: number}[] not sure, looks like an error in both places actually {
id: number;
width: number;
height: number;
dpi: number;
}[] |
@antokhio i will try to fix in a PR i hope soon. |
with the latest in PR #231 it should works in this way: await ar?.loadNFTMarkers(nftMarkerUrls, (id: number[]) => {
let marker = ar.getNFTData(id[i], 0);
ctx.postMessage({ type: "markerInfos", marker: marker });
ar.trackNFTMarkerId(id[i]);
console.log("loadNFTMarker -> ", id);
console.log(id);
ctx.postMessage({ type: "endLoading", end: true });
}, () => {}).catch((err: string) => {
console.error("Error in loading marker on Worker", err);
}); |
loadNFTMarkers has incorrect return signature
currently have to convert it to unknow first:
The text was updated successfully, but these errors were encountered: