Skip to content

Commit

Permalink
Merge pull request #862 from ptcrealitylab/Add-AreaTarget-and-MainCam…
Browse files Browse the repository at this point in the history
…era-listeners

Add area target and main camera listeners
  • Loading branch information
Steve-KX-RL authored Aug 9, 2023
2 parents f0c6361 + f2ee99e commit 2b9ccc7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/vuforia-spatial-core-addon
30 changes: 30 additions & 0 deletions libraries/objectDefaultFiles/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@
this.promptForArea = makeSendStub('promptForArea');
this.getEnvironmentVariables = makeSendStub('getEnvironmentVariables');
this.getUserDetails = makeSendStub('getUserDetails');
this.getAreaTargetMesh = makeSendStub('getAreaTargetMesh');
this.getSpatialCursorEvent = makeSendStub('getSpatialCursorEvent');

this.analyticsOpen = makeSendStub('analyticsOpen');
this.analyticsClose = makeSendStub('analyticsClose');
Expand Down Expand Up @@ -2121,6 +2123,34 @@
};
});
}

this.getAreaTargetMesh = function() {
postDataToParent({
getAreaTargetMesh: true
});
return new Promise((resolve, reject) => {
spatialObject.messageCallBacks.areaTargetMeshResult = function (msgContent) {
if (typeof msgContent.areaTargetMesh !== 'undefined') {
resolve(msgContent.areaTargetMesh);
delete spatialObject.messageCallBacks['areaTargetMeshResult'];
}
}
})
}

this.getSpatialCursorEvent = function() {
postDataToParent({
getSpatialCursorEvent: true
});
return new Promise((resolve, reject) => {
spatialObject.messageCallBacks.spatialCursorEventResult = function (msgContent) {
if (typeof msgContent.spatialCursorEvent !== 'undefined') {
resolve(msgContent.spatialCursorEvent);
delete spatialObject.messageCallBacks['spatialCursorEventResult'];
}
}
})
}

/**
* Stubbed here for backwards compatibility of API. In previous versions:
Expand Down

0 comments on commit 2b9ccc7

Please sign in to comment.