You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/src/Add-on/SwitchCamera.ts

26 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { Intent } from '@blueprintjs/core';
import { app } from '../ApplicationServices/Application';
import { Command } from '../Editor/CommandMachine';
import { CameraType } from '../GraphicsSystem/CameraUpdate';
import { AppToaster } from '../UI/Components/Toaster';
export class Command_SwitchCamera implements Command
{
async exec()
{
app.Viewer.CameraCtrl.SwitchCamera();
AppToaster.show({
message: `成功切换相机为:${app.Viewer.CameraCtrl.CameraType === CameraType.OrthographicCamera ? "正交相机" : "透视相机"}。 请使用SwitchCamera来切换回原来的相机模式`,
timeout: 10000,
intent: Intent.SUCCESS,
}, "SwitchCamera");
if (app.Viewer.CameraCtrl.CameraType === CameraType.PerspectiveCamera)
AppToaster.show({
message: `透视相机模式下:您可以按住鼠标右键旋转观察角度,按WASD或者↑←↓→来进行移动相机,QE进行升高和下降,按住Shift时可加速移动!`,
timeout: 10000,
intent: Intent.SUCCESS,
}, "SwitchCamera2");
}
}