386 lines
6.9 KiB
CSS
386 lines
6.9 KiB
CSS
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
html, body {
|
||
height: 100%;
|
||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||
background: #f5f5f5;
|
||
overflow: hidden;
|
||
-webkit-user-select: none;
|
||
user-select: none;
|
||
}
|
||
|
||
.app {
|
||
display: flex;
|
||
flex-direction: column;
|
||
height: 100vh;
|
||
}
|
||
|
||
/* 顶部工具栏 */
|
||
.toolbar {
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: 16px;
|
||
padding: 12px 16px;
|
||
background: #fff;
|
||
border-bottom: 1px solid #e0e0e0;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.btn {
|
||
padding: 10px 24px;
|
||
font-size: 15px;
|
||
border: 1px solid #ddd;
|
||
border-radius: 6px;
|
||
background: #fff;
|
||
color: #333;
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.btn:active {
|
||
background: #f0f0f0;
|
||
}
|
||
|
||
.btn-primary {
|
||
background: #4a90e2;
|
||
color: #fff;
|
||
border-color: #4a90e2;
|
||
}
|
||
|
||
.btn-primary:active {
|
||
background: #3a7bc8;
|
||
}
|
||
|
||
/* 文本编辑器工具栏 */
|
||
.text-editor-toolbar {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
gap: 8px;
|
||
padding: 10px 16px;
|
||
background: #fff;
|
||
border-bottom: 1px solid #e0e0e0;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.toolbar-btn {
|
||
width: 40px;
|
||
height: 40px;
|
||
font-size: 18px;
|
||
font-weight: bold;
|
||
border: 1px solid #ddd;
|
||
border-radius: 8px;
|
||
background: #fff;
|
||
color: #333;
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
}
|
||
|
||
.toolbar-btn:active {
|
||
background: #f0f0f0;
|
||
}
|
||
|
||
.toolbar-btn.active {
|
||
background: #4a90e2;
|
||
color: #fff;
|
||
border-color: #4a90e2;
|
||
}
|
||
|
||
.toolbar-btn.italic {
|
||
font-style: italic;
|
||
}
|
||
|
||
.toolbar-divider {
|
||
width: 1px;
|
||
height: 28px;
|
||
background: #ddd;
|
||
margin: 0 4px;
|
||
}
|
||
|
||
.toolbar-label {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
font-size: 13px;
|
||
color: #666;
|
||
}
|
||
|
||
.toolbar-label select {
|
||
padding: 6px 8px;
|
||
font-size: 13px;
|
||
border: 1px solid #ddd;
|
||
border-radius: 6px;
|
||
background: #fff;
|
||
cursor: pointer;
|
||
}
|
||
|
||
/* 字号滚轮选择器 */
|
||
.roller-picker {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 4px;
|
||
padding: 4px 8px;
|
||
background: #fff;
|
||
border: 1px solid #ddd;
|
||
border-radius: 6px;
|
||
min-width: 65px;
|
||
height: 36px;
|
||
}
|
||
|
||
.roller-arrow {
|
||
font-size: 10px;
|
||
color: #666;
|
||
cursor: pointer;
|
||
padding: 2px 4px;
|
||
user-select: none;
|
||
transition: color 0.2s;
|
||
}
|
||
|
||
.roller-arrow:hover {
|
||
color: #4a90e2;
|
||
}
|
||
|
||
.roller-value {
|
||
font-size: 14px;
|
||
min-width: 24px;
|
||
text-align: center;
|
||
color: #333;
|
||
}
|
||
|
||
#fontPicker {
|
||
min-width: 55px;
|
||
}
|
||
|
||
.toolbar-label input[type="color"] {
|
||
width: 36px;
|
||
height: 36px;
|
||
padding: 2px;
|
||
border: 1px solid #ddd;
|
||
border-radius: 6px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
/* 图片展示区 */
|
||
.canvas-area {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 16px;
|
||
overflow: auto;
|
||
position: relative;
|
||
}
|
||
|
||
/* 空提示 - 移到预览白板中 */
|
||
.empty-tip {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
color: #999;
|
||
font-size: 14px;
|
||
text-align: center;
|
||
pointer-events: none;
|
||
z-index: 5;
|
||
}
|
||
|
||
/* 预览区域固定 3:5 比例,打开即显示空白面板 */
|
||
.preview {
|
||
overflow: hidden;
|
||
}
|
||
|
||
.image-container {
|
||
display: flex;
|
||
position: relative;
|
||
width: 100%;
|
||
max-width: 360px;
|
||
aspect-ratio: 3 / 5;
|
||
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
|
||
background: #fff;
|
||
overflow: hidden;
|
||
touch-action: pan-x;
|
||
margin: 0 auto;
|
||
contain: layout style paint;
|
||
}
|
||
|
||
.image-container.empty {
|
||
background: #f0f0f0;
|
||
border: 2px dashed #ddd;
|
||
}
|
||
|
||
/* 背景图层 - 用于滑动调整位置,溢出隐藏 */
|
||
.preview-bg-layer {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* 输入框图层 - 与背景图层隔离 */
|
||
.preview-input-layer {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
pointer-events: none;
|
||
}
|
||
|
||
/* 输入框可交互 */
|
||
.preview-input-layer .text-input {
|
||
pointer-events: auto;
|
||
}
|
||
|
||
/* 背景图 - 保持比例,可滑动调整位置 */
|
||
#bgImage {
|
||
display: block;
|
||
position: absolute;
|
||
height: 100%;
|
||
width: auto;
|
||
max-width: none;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
-webkit-user-drag: none;
|
||
}
|
||
|
||
#bgImage[src=""] {
|
||
display: none;
|
||
}
|
||
|
||
/* 文字输入框 - 透明无边框设计,黑色微软雅黑16px */
|
||
.text-input {
|
||
position: absolute;
|
||
min-width: 80px;
|
||
min-height: 32px;
|
||
padding: 4px 8px;
|
||
font-size: 16px;
|
||
color: #000;
|
||
font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
|
||
background: transparent;
|
||
border: 2px solid transparent;
|
||
border-radius: 4px;
|
||
outline: none;
|
||
cursor: grab;
|
||
white-space: nowrap;
|
||
line-height: 1.4;
|
||
-webkit-user-select: none;
|
||
user-select: none;
|
||
transition: border-color 0.2s;
|
||
z-index: 10;
|
||
/* 确保输入框内容超出时不影响父容器和其他元素 */
|
||
overflow: visible;
|
||
max-width: none;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
/* 选中状态(单击/长按) - 仅显示虚线边框 */
|
||
.text-input.selected {
|
||
border: 2px dashed rgba(74, 144, 226, 0.6);
|
||
cursor: grab;
|
||
}
|
||
|
||
/* 编辑状态(双击) - 显示实线边框 */
|
||
.text-input.editing {
|
||
border: 2px solid #4a90e2;
|
||
background: rgba(255,255,255,0.1);
|
||
cursor: text;
|
||
-webkit-user-select: text;
|
||
user-select: text;
|
||
-webkit-touch-callout: default;
|
||
pointer-events: auto;
|
||
}
|
||
|
||
/* 拖拽状态 */
|
||
.text-input.dragging {
|
||
opacity: 0.8;
|
||
cursor: grabbing;
|
||
}
|
||
|
||
/* 隐藏空提示 */
|
||
.empty-tip.hidden {
|
||
display: none;
|
||
}
|
||
|
||
/* 长按提示 */
|
||
.long-press-tip {
|
||
position: fixed;
|
||
bottom: 20px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
padding: 8px 16px;
|
||
background: rgba(0,0,0,0.7);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
border-radius: 16px;
|
||
opacity: 0;
|
||
transition: opacity 0.3s;
|
||
pointer-events: none;
|
||
z-index: 1000;
|
||
}
|
||
|
||
.long-press-tip.show {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* 右键菜单 */
|
||
.context-menu {
|
||
position: fixed;
|
||
background: #fff;
|
||
border: 1px solid #ddd;
|
||
border-radius: 6px;
|
||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||
padding: 4px 0;
|
||
z-index: 1000;
|
||
min-width: 140px;
|
||
}
|
||
|
||
.context-menu-item {
|
||
padding: 10px 16px;
|
||
font-size: 14px;
|
||
color: #333;
|
||
cursor: pointer;
|
||
transition: background 0.2s;
|
||
}
|
||
|
||
.context-menu-item:hover {
|
||
background: #f5f5f5;
|
||
}
|
||
|
||
.context-menu-item:active {
|
||
background: #e8e8e8;
|
||
}
|
||
|
||
/* 拖拽辅助线 */
|
||
.guide-line {
|
||
position: absolute;
|
||
pointer-events: none;
|
||
z-index: 1000;
|
||
display: none;
|
||
}
|
||
|
||
.guide-horizontal {
|
||
left: 0;
|
||
right: 0;
|
||
height: 1px;
|
||
background: #4a90e2;
|
||
box-shadow: 0 0 4px rgba(74, 144, 226, 0.5);
|
||
}
|
||
|
||
.guide-vertical {
|
||
top: 0;
|
||
bottom: 0;
|
||
width: 1px;
|
||
background: #4a90e2;
|
||
box-shadow: 0 0 4px rgba(74, 144, 226, 0.5);
|
||
}
|
||
|
||
.guide-line.visible {
|
||
display: block;
|
||
}
|