forked from imodeljs/imodeljs-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toolbar.tsx
52 lines (42 loc) · 1.89 KB
/
Toolbar.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from "react";
import {
IModelApp,
ZoomViewTool, PanViewTool, RotateViewTool, SelectionTool, FitViewTool,
} from "@bentley/imodeljs-frontend";
import "./Components.scss";
/** Toolbar containing simple navigation tools */
const toolbar = () => {
return (
<div className="toolbar">
<a href="#" title={SelectionTool.flyover} onClick={select}><span className="icon icon-cursor"></span></a>
<a href="#" title={FitViewTool.flyover} onClick={fitView}><span className="icon icon-fit-to-view"></span></a>
<a href="#" title={RotateViewTool.flyover} onClick={rotate}><span className="icon icon-gyroscope"></span></a>
<a href="#" title={PanViewTool.flyover} onClick={pan}><span className="icon icon-hand-2"></span></a>
<a href="#" title={ZoomViewTool.flyover} onClick={zoom}><span className="icon icon-zoom"></span></a>
</div>
);
};
/**
* See the https://imodeljs.github.io/iModelJs-docs-output/learning/frontend/tools/
* for more details and available tools.
*/
const select = () => {
IModelApp.tools.run(SelectionTool.toolId);
};
const fitView = () => {
IModelApp.tools.run(FitViewTool.toolId, IModelApp.viewManager.selectedView);
};
const rotate = () => {
IModelApp.tools.run(RotateViewTool.toolId, IModelApp.viewManager.selectedView);
};
const pan = () => {
IModelApp.tools.run(PanViewTool.toolId, IModelApp.viewManager.selectedView);
};
const zoom = () => {
IModelApp.tools.run(ZoomViewTool.toolId, IModelApp.viewManager.selectedView);
};
export default toolbar;