pickAsync pick first match

This commit is contained in:
Adam Larkeryd 2025-10-15 09:56:44 +09:00
parent 116ef099dd
commit c0f3fd44fd
1 changed files with 8 additions and 1 deletions

View File

@ -4408,7 +4408,14 @@ Scene.prototype.pick = function (windowPosition, width, height) {
};
Scene.prototype.pickAsync = async function (windowPosition, width, height) {
return this._picking.pick(this, windowPosition, width, height, true); // TODO: merge apis?
return new Promise((resolve, reject) => {
this._picking
.pick(this, windowPosition, width, height, 1, true)
.then((result) => {
resolve(result[0]);
})
.catch(reject);
});
};
/**