-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.js
More file actions
26 lines (23 loc) · 778 Bytes
/
engine.js
File metadata and controls
26 lines (23 loc) · 778 Bytes
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
function Engine() {}
Engine.prototype.addSwitchControl = function(switchControl) {
if (!switchControl) { return }
if (!this.switchControls) { this.switchControls = [] }
if (this.switchControls.contains(switchControl)) { return }
this.switchControls.push(switchControl)
this.addSwitchControlOnMap(switchControl)
return this
}
Engine.prototype.removeSwitchControl = function(switchControl) {
if (switchControl) {
var i = this.switchControls.indexOf(switchControl)
if (i < 0) { return }
this.switchControls.splice(i, 1)
this.removeSwitchControlFromMap(switchControl)
} else {
if (this.switchControls.length > 0) {
this.removeSwitchControlFromMap(this.switchControls[0])
this.switchControls.splice(0, 1)
}
}
return this
}