forked from imodeljs/simple-viewer-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toolbar.tsx
58 lines (47 loc) · 2.14 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
53
54
55
56
57
58
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
import * as React from "react";
import {
IModelApp,
ZoomViewTool, PanViewTool, RotateViewTool, SelectionTool, FitViewTool,
} from "@bentley/imodeljs-frontend";
import { PlaceRoadTool } from "../tools/PlaceRoadTool";
import "./Components.scss";
/** Toolbar containing simple navigation tools */
const toolbar = () => {
return (
<div className="toolbar">
<a href="#" title="Place road" onClick={placeroad}><span className="icon icon-hand-2"></span></a>
<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);
};
const placeroad = () => {
IModelApp.tools.run(PlaceRoadTool.toolId);
};
export default toolbar;