js+css实现可视化拖拽单片机模拟运行编辑器代码

代码语言:html

所属分类:其他

代码描述:js+css实现可视化拖拽单片机模拟运行编辑器代码

代码标签: js css 可视化 拖拽 单片机 模拟 运行 编辑器 代码

下面为部分代码预览,完整代码请点击下载或在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>可视化拖拽单片机仿真模拟器</title>
<style>
  :root {
    --bg: #0d1117;
    --panel: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #ffd33d;
  }

  * {
    box-sizing: border-box;
  }

  html,
  body {
    height: 100%;
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
  }

  .title {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
  }

  .title small {
    color: var(--muted);
    font-weight: 400;
    font-size: 12px;
    margin-left: 6px;
  }

  .toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .toolbar label {
    color: var(--muted);
    font-size: 13px;
  }

  .toolbar select,
  .toolbar button {
    background: #21262d;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
  }

  .toolbar button.primary {
    background: #238636;
    border-color: #2ea043;
    color: #fff;
  }

  .toolbar button:hover {
    filter: brightness(1.12);
  }

  .toolbar button:active {
    transform: translateY(1px);
  }

  main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 230px 1fr 380px;
  }

  aside {
    min-height: 0;
    overflow: auto;
    background: var(--panel);
  }

  #parts {
    border-right: 1px solid var(--border);
    padding: 12px;
  }

  #parts h3,
  #right h3 {
    margin: 0 0 12px;
    font-size: 15px;
  }

  .part {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #21262d;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: grab;
    user-select: none;
  }

  .part:active {
    cursor: grabbing;
  }

  .part .icon {
    display: inline-block;
    width: 38px;
    height: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10px;
    line-height: 22px;
    text-align: center;
    color: #7ee787;
  }

  .help {
    margin-top: 16px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    background: var(--bg);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
  }

  #canvas-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background-color: var(--bg);
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
  }

  body.running #canvas-wrap {
    box-shadow: inset 0 0 0 2px rgba(63, 185, 80, 0.35);
  }

  svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  #tempLayer {
    pointer-events: none;
  }

  #right {
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
  }

  .panel {
    padding: 12px;
    border-bottom: 1px solid var(--border);
  }

  .code-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #asmCode {
    flex: 1;
    min-height: 0;
    margin: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    color: #7ee787;
    overflow: auto;
    white-space: pre;
  }

  footer {
    flex: 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0