-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLayerList.js
More file actions
68 lines (55 loc) · 2.08 KB
/
LayerList.js
File metadata and controls
68 lines (55 loc) · 2.08 KB
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
// JavaScript Document
cad.LayerList=function(){
this.Create=function(){
var canvasRect = h_5_cad.Canvas.getCurCanvasRect();
var LayerListDiv = document.createElement("div");
LayerListDiv.setAttribute("id","LayerListDiv");
LayerListDiv.setAttribute("class","box-layer-command");
LayerListDiv.setAttribute("ondragover", "allowDrop(event)");
var left = canvasRect.left+canvasRect.width-200;
var top = canvasRect.top+20+120+10;
LayerListDiv.style.left=left+"px";
LayerListDiv.style.top=top+"px";
LayerListDiv.style.zIndex=1;
CreatLayerList(LayerListDiv);
CreatLayerColor(LayerListDiv);
document.body.appendChild(LayerListDiv);
LayerListDiv ="";
}
function CreatLayerList(node){
var html_string="<div id='LAYERLISTTEXT' class='obj-text-box' style='left: 6px; top: 4px;'>图层</div><div class='layer_list'>\
<table><tbody>";
var Layers = h_5_cad.DataBase.Ls;
for(var i=0;i<Layers.length;i++)
{
html_string +="<tr>\
<td onclick='showLayerColor("+i+");' style='"+getLayerColorCss(Layers[i].C)+"' class='layer_color'></td>\
<td onclick='showLayerVisible("+i+");' class='layer_visible'><span class="+getLayerVisibleCss(Layers[i].V)+"></span></td>\
<td onclick='showLayerLock("+i+");' class='layer_lock'><span class="+getLayerLockCss(Layers[i].L)+"></span></td>\
<td class='layer_name'>"+Layers[i].N+"</td>\
</tr>";
}
html_string+="</tbody></table></div>";
node.innerHTML = html_string;
}
function CreatLayerColor(parent){
var layer_color = document.createElement("div");
layer_color.setAttribute("id","pane_color_layer");
layer_color.setAttribute("class","pane_color_layer");
layer_color.style.zIndex=1;
var sHTML = "<div id='layer_color' class='layer_color'>";
for(var i=0;i<h_5_cad.colorList.length;i++)
{
sHTML+="<div \
id='layer_color"+i+"'\
class='color_element'\
style='background-color: "+getColor(i)+";'\
onclick='setLayerColor("+i+")'></div>";
}
sHTML +="</div>";
layer_color.innerHTML = sHTML;
layer_color.style.display = 'none';
parent.appendChild(layer_color);
layer_color = "";
}
}