pickFromScreen function not working

viewer
api

(Nikunjarora12345) #1
const iframe = document.querySelector("#frame");
const uid = "e32350f52f4a40e3b29d7c5fe5249e3c";

const client = new Sketchfab(iframe);

function viewerLoaded(api) {
	api.start();

	api.addEventListener("viewerready", () => {
		document.querySelector("#btn").addEventListener("click", () => {
			api.pickFromScreen([100, 100], (err, info) => {
				if (err) {
					console.error(err);
				} else {
					console.log(info);
				}
			});
		});
	});
}

client.init(uid, {
	success: viewerLoaded,
	error: () => console.error("Error")
});

This gives the following error -

DOMException: Failed to execute ‘postMessage’ on ‘Window’: WebGLRenderingContext object could not be cloned.
at y. (https://static.sketchfab.com/static/builds/web/dist/embed-46bc90398e31703e5bf7.js:1:3818)
at p.pickFromScreen (https://static.sketchfab.com/static/builds/web/dist/embed-46bc90398e31703e5bf7.js:1:10920)
at y. (https://static.sketchfab.com/static/builds/web/dist/embed-46bc90398e31703e5bf7.js:1:3999)
at n (https://static.sketchfab.com/static/builds/web/dist/commons-794ec24d4b6ce7f3afef.js:56:16518)

on Chrome Version 70.0.3538.102

While we are on this subject, could you also update the examples given on viewer api documents page. Some of them are wrong, like pickFromScreen showing example to getWorldToScreenCoordinates, etc.


(Paul Sketch) #2

Thanks for the report, I reproduced the bug and will work on a fix.
Documentation samples will be updated too.