-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
105 lines (73 loc) · 1.99 KB
/
index.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import {subclass, property} from "esri/core/accessorSupport/decorators";
import Widget = require("esri/widgets/Widget");
import view = require("esri/views/View");
import LayerList = require("esri/widgets/LayerList");
import Swipe = require("esri/widgets/Swipe");
import { renderable, tsx } from "esri/widgets/support/widget";
import Layer from "esri/layers/Layer";
import Collection from "esri/core/Collection";
const CSS = {
base: "esri-icon-edit"
};
@subclass("esri.widgets.SwipeManager")
class SwipeManager extends Widget {
constructor(params?: any) {
super();
this._getWidgets = this._getWidgets.bind(this);
this.view = params.view;
this.layermanagerposition = params.layermanagerposition;
this.widgetsclosed = true;
this.trailingLayers = params.trailingLayers;
this.leadingLayers = params.leadingLayers;
this.swipe = new Swipe({
view: this.view
});
this.layerlist = new LayerList({
view: this.view
});
}
@property()
@renderable()
view: view ;
@property()
layermanagerposition: any;
@property()
trailingLayers: Collection<Layer>;
@property()
leadingLayers: Collection<Layer>;
@property()
widgetsclosed: boolean;
@property()
layerlist: LayerList;
@property()
swipe: Swipe;
render() {
const icon = CSS.base;
let _this = this;
return (
<div class="esri-widget--button">
<span aria-hidden="true" onclick={this._getWidgets} class={icon}></span><span class="esri-icon-font-fallback-text">Genişlet</span>
</div>
);
}
private _getWidgets(): void {
if(this.widgetsclosed)
{
this.view.ui.add(this.layerlist, {
position: this.layermanagerposition
});
this.view.ui.add(this.swipe);
}
else
{
if(this.view.ui.find(this.swipe.id)){
this.view.ui.remove(this.swipe);
}
if(this.view.ui.find(this.layerlist.id)){
this.view.ui.remove(this.layerlist);
}
}
this.widgetsclosed =!this.widgetsclosed;
}
}
export = SwipeManager;