-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
notice.js
42 lines (32 loc) · 1.21 KB
/
notice.js
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
import _debounce from 'lodash-es/debounce';
import { t } from '../core/localizer';
import { svgIcon } from '../svg/index';
export function uiNotice(context) {
return function(selection) {
var div = selection
.append('div')
.attr('class', 'notice');
var button = div
.append('button')
.attr('class', 'zoom-to notice fillD')
.on('click', function() {
context.map().zoomEase(context.minEditableZoom());
})
.on('wheel', function(d3_event) { // let wheel events pass through #4482
var e2 = new WheelEvent(d3_event.type, d3_event);
context.surface().node().dispatchEvent(e2);
});
button
.call(svgIcon('#iD-icon-plus', 'pre-text'))
.append('span')
.attr('class', 'label')
.call(t.append('zoom_in_edit'));
function disableTooHigh() {
var canEdit = context.map().zoom() >= context.minEditableZoom();
div.style('display', canEdit ? 'none' : 'block');
}
context.map()
.on('move.notice', _debounce(disableTooHigh, 500));
disableTooHigh();
};
}