Files
invitation-maker/css/style.css

199 lines
3.6 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;
}
/* 图片展示区 */
.canvas-area {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
overflow: auto;
position: relative;
}
.empty-tip {
color: #999;
font-size: 14px;
}
/* 预览区域固定 3:5 比例,打开即显示空白面板 */
.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;
}
.image-container.empty {
background: #f0f0f0;
border: 2px dashed #ddd;
}
/* 背景图自适应铺满容器,超出部分裁剪 */
#bgImage {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
-webkit-user-drag: none;
}
#bgImage[src=""] {
display: none;
}
/* 文字输入框 - 透明无边框设计 */
.text-input {
position: absolute;
min-width: 80px;
min-height: 32px;
padding: 4px 8px;
font-size: 18px;
color: #333;
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;
}
/* 选中状态(单击/长按) - 仅显示虚线边框 */
.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;
}
/* 拖拽状态 */
.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;
}