forked from fex-team/kityminder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaper.js
53 lines (43 loc) · 1.2 KB
/
paper.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
45
46
47
48
49
50
51
52
53
/**
* @fileOverview
*
* 初始化渲染容器
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
Minder.registerInit(function() {
this._initPaper();
});
kity.extendClass(Minder, {
_initPaper: function() {
this._paper = new kity.Paper();
this._paper.getNode().setAttribute('contenteditable', true);
this._paper.getNode().ondragstart = function(e) {
e.preventDefault();
};
this._paper.shapeNode.setAttribute('transform', 'translate(0.5, 0.5)');
this._addRenderContainer();
this.setRoot(this.createNode(this.getLang().maintopic));
if (this._options.renderTo) {
this.renderTo(this._options.renderTo);
}
},
_addRenderContainer: function() {
this._rc = new kity.Group().setId(KityMinder.uuid('minder'));
this._paper.addShape(this._rc);
},
renderTo: function(target) {
this._paper.renderTo(this._renderTarget = target);
this._bindEvents();
},
getRenderContainer: function() {
return this._rc;
},
getPaper: function() {
return this._paper;
},
getRenderTarget: function() {
return this._renderTarget;
},
});