mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
Revert "Remove Overlays.getOverlayObject() from JavaScript API"
This reverts commit 8e2a3e8c99
.
This commit is contained in:
parent
4341347148
commit
05efc5a231
3 changed files with 28 additions and 0 deletions
|
@ -388,6 +388,21 @@ QString Overlays::getOverlayType(OverlayID overlayId) {
|
|||
return "";
|
||||
}
|
||||
|
||||
QObject* Overlays::getOverlayObject(OverlayID id) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QObject* result;
|
||||
PROFILE_RANGE(script, __FUNCTION__);
|
||||
BLOCKING_INVOKE_METHOD(this, "getOverlayObject", Q_RETURN_ARG(QObject*, result), Q_ARG(OverlayID, id));
|
||||
return result;
|
||||
}
|
||||
|
||||
Overlay::Pointer thisOverlay = getOverlay(id);
|
||||
if (thisOverlay) {
|
||||
return qobject_cast<QObject*>(&(*thisOverlay));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OverlayID Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
||||
if (!_enabled) {
|
||||
return UNKNOWN_OVERLAY_ID;
|
||||
|
|
|
@ -235,6 +235,15 @@ public slots:
|
|||
*/
|
||||
QString getOverlayType(OverlayID overlayId);
|
||||
|
||||
/**jsdoc
|
||||
* Get the overlay script object.
|
||||
* @function Overlays.getOverlayObject
|
||||
* @deprecated This function is deprecated and will soon be removed.
|
||||
* @param {Uuid} overlayID - The ID of the overlay to get the script object of.
|
||||
* @returns {object} The script object for the overlay if found.
|
||||
*/
|
||||
QObject* getOverlayObject(OverlayID id);
|
||||
|
||||
/**jsdoc
|
||||
* Get the ID of the 2D overlay at a particular point on the screen or HUD.
|
||||
* @function Overlays.getOverlayAtPoint
|
||||
|
|
|
@ -307,6 +307,10 @@ WebTablet.prototype.setScriptURL = function (scriptURL) {
|
|||
Overlays.editOverlay(this.webOverlayID, { scriptURL: scriptURL });
|
||||
};
|
||||
|
||||
WebTablet.prototype.getOverlayObject = function () {
|
||||
return Overlays.getOverlayObject(this.webOverlayID);
|
||||
};
|
||||
|
||||
WebTablet.prototype.setWidth = function (width) {
|
||||
// imported from libraries/utils.js
|
||||
resizeTablet(width);
|
||||
|
|
Loading…
Reference in a new issue