added basic WA.camera commands
This commit is contained in:
parent
99ffb7b450
commit
5f26a39a5d
9 changed files with 112 additions and 4 deletions
|
@ -17,6 +17,27 @@ export class WorkAdventureCameraCommands extends IframeApiContribution<WorkAdven
|
|||
}),
|
||||
];
|
||||
|
||||
public setPosition(x: number, y: number, width: number, height: number, smooth: boolean = false): void {
|
||||
sendToWorkadventure({
|
||||
type: "cameraSetPosition",
|
||||
data: { x, y, width, height, smooth },
|
||||
});
|
||||
}
|
||||
|
||||
public focusOn(x: number, y: number, width: number, height: number, smooth: boolean = false): void {
|
||||
sendToWorkadventure({
|
||||
type: "cameraFocusOn",
|
||||
data: { x, y, width, height, smooth },
|
||||
});
|
||||
}
|
||||
|
||||
public followPlayer(smooth: boolean = false): void {
|
||||
sendToWorkadventure({
|
||||
type: "cameraFollowPlayer",
|
||||
data: { smooth },
|
||||
});
|
||||
}
|
||||
|
||||
onCameraUpdate(callback: WasCameraUpdatedEventCallback): void {
|
||||
moveStream.subscribe(callback);
|
||||
sendToWorkadventure({
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import type { ChatEvent } from "../Events/ChatEvent";
|
||||
import { isUserInputChatEvent, UserInputChatEvent } from "../Events/UserInputChatEvent";
|
||||
import { IframeApiContribution, sendToWorkadventure } from "./IframeApiContribution";
|
||||
import { apiCallback } from "./registeredCallbacks";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue