原生js+css实现在线预览测量cad文件dxf可视化工具代码
代码语言:html
所属分类:其他
代码描述:原生js+css实现在线预览测量cad文件dxf可视化工具代码
代码标签: 原生 js css 在线 预览 测量 cad 文件 dxf 可视化 工具 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAD图纸预览器</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
background: #1a1a2e;
color: #fff;
height: 100vh;
overflow: hidden;
}
.app-container {
display: flex;
flex-direction: column;
height: 100vh;
}
/* 顶部工具栏 */
.toolbar {
background: #16213e;
padding: 10px 20px;
display: flex;
align-items: center;
gap: 15px;
border-bottom: 1px solid #0f3460;
flex-wrap: wrap;
}
.toolbar-group {
display: flex;
align-items: center;
gap: 8px;
padding: 0 15px;
border-right: 1px solid #0f3460;
}
.toolbar-group:last-child {
border-right: none;
}
.toolbar-btn {
background: #0f3460;
border: 1px solid #1a4a7a;
color: #fff;
padding: 8px 15px;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
transition: all 0.2s;
}
.toolbar-btn:hover {
background: #1a5a9a;
}
.toolbar-btn.active {
background: #e94560;
border-color: #e94560;
}
.toolbar-btn.primary {
background: #00d4aa;
border-color: #00d4aa;
color: #000;
}
.toolbar-btn.primary:hover {
background: #00f4ca;
}
.toolbar-btn svg {
width: 16px;
height: 16px;
}
.file-input {
display: none;
}
.toolbar-label {
color: #888;
font-size: 12px;
margin-right: 5px;
}
/* 主内容区 */
.main-content {
display: flex;
flex: 1;
overflow: hidden;
}
/* 左侧面板 */
.side-panel {
width: 280px;
background: #16213e;
border-right: 1px solid #0f3460;
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-section {
border-bottom: 1px solid #0f3460;
}
.panel-header {
padding: 12px 15px;
background: #0f3460;
font-size: 13px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
}
.panel-header:hover {
background: #1a4a7a;
}
.panel-content {
padding: 10px;
max-height: 200px;
overflow-y: auto;
}
.panel-content::-webkit-scrollbar {
width: 6px;
}
.panel-content::-webkit-scrollbar-thumb {
background: #0f3460;
border-radius: 3px;
}
/* 图层列表 */
.layer-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
}
.layer-item:hover {
background: rgba(255,255,255,0.05);
}
.layer-color {
width: 16px;
height: 16px;
border-radius: 3px;
border: 1px solid rgba(255,255,255,0.2);
}
.layer-name {
flex: 1;
}
.layer-toggle {
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
color: #00d4aa;
}
.layer-toggle.hidden {
color: #666;
}
/* 属性面板 */
.property-row {
display: flex;
padding: 6px 0;
font-size: 12px;
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.property-label {
width: 80px;
color: #888;
}
.property-value {
flex: 1;
color: #fff;
}
/* Canvas区域 */
.canvas-container {
flex: 1;
position: relative;
overflow: hidden;
background: #0a0a1a;
}
#cadCanvas {
position: absolute;
top: 0;
left: 0;
}
/* 网格背景 */
.grid-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
opacity: 0.3;
}
/* 状态栏 */
.status-bar {
background: #0f3460;
padding: 8px 20px;
display: flex;
align-items: center;
gap: 30px;
font-size: 12px;
color: #aaa;
}
.status-item {
display: flex;
align-items: center;
gap: 6px;
}
.status-item span {
color: #00d4aa;
}
/* 缩放控制 */
.zoom-control {
position: absolute;
bottom: 20px;
right: 20px;
display: flex;
flex-direction: column;
gap: 5px;
z-index: 100;
}
.zoom-btn {
width: 36px;
height: 36px;
background: #16213e;
border: 1px solid #0f3460;
color: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
}
.zoom-btn:hover {
background: #1a5a9a;
}
.zoom-level {
text-align: center;
font-size: 11px;
color: #888;
padding: 5px;
}
/* 坐标显示 */
.coords-display {
position: absolute;
bottom: 20px;
left: 20px;
background: rgba(22, 33, 62, 0.9);
padding: 10px 15px;
border-radius: 4px;
font-size: 12p.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0