js实现浏览器中类似photoshop多图层图片编辑排版代码
代码语言:html
所属分类:其他
代码描述:js实现浏览器中类似photoshop多图层图片编辑排版代码
代码标签: js 浏览器 类似 photoshop 多 图层 图片 编辑 排版 代码
下面为部分代码预览,完整代码请点击下载或在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>Mini PS - 多图层图片编辑器</title>
<style>
:root {
--bg: #17181d; --panel: #202129; --panel2: #262732; --border: #33343f;
--text: #dcdee6; --muted: #8b8fa3; --accent: #4c8dff; --accent2: #3a72d4;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
background: var(--bg); color: var(--text);
display: flex; flex-direction: column; overflow: hidden;
user-select: none;
}
input, textarea, select { user-select: text; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3b47; border-radius: 5px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }
/* ===== 顶栏 ===== */
#topbar {
height: 52px; flex: none; background: var(--panel);
border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 8px; padding: 0 14px;
}
.logo { font-weight: 700; font-size: 15px; margin-right: 10px; white-space: nowrap; }
.tb-btn {
background: var(--panel2); border: 1px solid var(--border); color: var(--text);
padding: 7px 12px; border-radius: 7px; font-size: 13px; cursor: pointer;
white-space: nowrap; transition: border-color .15s;
}
.tb-btn:not(:disabled):hover { border-color: var(--accent); }
.tb-btn:disabled { opacity: .35; cursor: not-allowed; }
.tb-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-btn.primary:not(:disabled):hover { background: var(--accent2); }
.tb-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex: none; }
.zoom-group {
display: flex; align-items: center; gap: 2px; background: var(--panel2);
border: 1px solid var(--border); border-radius: 7px; padding: 2px;
}
.zoom-group button {
background: none; border: none; color: var(--text); width: 26px; height: 26px;
border-radius: 5px; cursor: pointer; font-size: 14px;
}
.zoom-group button:hover { background: var(--border); }
#zoomLabel { font-size: 12px; color: var(--muted); min-width: 44px; text-align: center; }
/* ===== 主区域 ===== */
#main { flex: 1; display: flex; min-height: 0; }
#canvasArea {
flex: 1; overflow: auto; display: flex; position: relative;
background: radial-gradient(circle at 50% 40%, #1b1c23, #101116);
}
#canvasHolder { margin: auto; padding: 48px; }
.canvas-stack { position: relative; box-shadow: 0 6px 40px rgba(0,0,0,.55); }
#canvasArea.dragover .canvas-stack { outline: 2px dashed var(--accent); outline-offset: 8px; }
#mainCanvas {
display: block;
background-image: repeating-conic-gradient(#2b2d36 0% 25%, #232429 0% 50%);
background-size: 20px 20px;
}
#overlayCanvas { position: absolute; inset: 0; display: block; touch-action: none; }
/* ===== 右侧面板 ===== */
#rightbar {
width: 272px; flex: none; background: var(--panel);
border-left: 1px solid var(--border); display: flex; flex-direction: column;
}
.panel-title {
font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 1px;
margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;
}
#adjustSection { border-bottom: 1px solid var(--border); padding: 12px; overflow-y: auto; max-height: 56%; }
#layerSection { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px; }
#layerList { flex: 1; overflow-y: auto; margin: 0 -6px; }
.empty-hint { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 10px; line-height: 1.9; }
/* 图层项 */
.layer-item {
display: flex; align-items: center; gap: 8px; padding: 6px;
border-radius: 8px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px;
}
.layer-item:hover { background: var(--panel2); }
.layer-item.selected { background: rgba(76,141,255,.14); border-color: var(--accent); }
.layer-item canvas { width: 40px; height: 40px; border-radius: 6px; background: #15161b; flex: none; }
.lname { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-input {
flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--accent);
color: var(--text); border-radius: 4px; padding: 2px 6px; font-size: 13px;
}
.eye { backgro.........完整代码请登录后点击上方下载按钮下载查看















网友评论0