-
Notifications
You must be signed in to change notification settings - Fork 0
/
cartannotate.js
44 lines (37 loc) · 1006 Bytes
/
cartannotate.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
43
44
var cartannotate = (function() {
var data = {};
var control = L.Control.extend({
options: { position: 'topright' },
onAdd: function(map) {
var container = L.DomUtil.create('div', 'cartannotate-control-container');
var textControl = L.DomUtil.create('div', 'cartannotate-text-control', container);
return container;
}
});
var initialize = function(map, doc) {
data.map = map;
data.doc = doc;
var FullPageCanvas = L.CanvasLayer.extend({
render: function() {
var canvas = new fabric.Canvas(this.getCanvas().id);
this.renderText(canvas, 'HELLO!');
},
renderText: function(canvas, text) {
var text = new fabric.Text(text, { left: 100, top: 100 });
canvas.add(text);
}
});
var annotationsCanvas = new FullPageCanvas();
annotationsCanvas.getCanvas().id = 'cartannotate-canvas';
annotationsCanvas.addTo(map);
map.on('click', function(event) {
//
});
return {
'control': control
};
}
return {
'initialize': initialize
}
}());