384 lines
6.5 KiB
Plaintext
Raw Normal View History

2024-02-21 17:43:11 +08:00
Page {
/* 点的颜色 */
--primary-color: #69f;
/* 边框颜色 */
--primary-color-outline: rgba(102, 153, 255, .75);
/* 虚线颜色 */
--primary-color-dashed: rgba(255,255,255,0.46);
/* 裁剪区域背景色 */
--box-bg: rgba(255,255,255,0.3);
}
.wx-content-info{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
align-items: center;
flex-direction: column;
background: #000;
}
.cropper-config{
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 80rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid rgba(255,255,255,.12);
}
.cropper-config .cropper-cancle, .cropper-config .cropper-save{
color: #fff;
font-size: 26rpx;
padding: 15rpx 25px;
}
.cropper-content{
min-height: calc(100% - 80rpx);
width: 720rpx;
margin: 0 auto;
margin-top: 8rpx;
display: flex;
align-items: center;
}
.wx-corpper{
position: relative;
overflow: visible;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
box-sizing: border-box;
}
.wx-corpper-content{
position: relative;
}
.wx-corpper-content image {
display: block;
width: 100%;
min-width: 0 !important;
max-width: none !important;
height: 100%;
min-height: 0 !important;
max-height: none !important;
image-orientation: 0deg !important;
margin: 0 auto;
}
/* 移动图片效果 */
.wx-cropper-drag-box{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
cursor: move;
background: rgba(0,0,0,0.6);
z-index: 1;
}
/* 内部的信息 */
.wx-corpper-crop-box{
position: absolute;
background: var(--box-bg);
z-index: 2;
}
.wx-corpper-crop-box .wx-cropper-view-box {
position: relative;
display: block;
width: 100%;
height: 100%;
overflow: visible;
outline: 1px solid var(--primary-color-outline);
}
/* 横向虚线 */
.wx-cropper-dashed-h{
position: absolute;
top: 33.33333333%;
left: 0;
width: 100%;
height: 33.33333333%;
border-top: 1px dashed var(--primary-color-dashed);
border-bottom: 1px dashed var(--primary-color-dashed);
}
/* 纵向虚线 */
.wx-cropper-dashed-v{
position: absolute;
left: 33.33333333%;
top: 0;
width: 33.33333333%;
height: 100%;
border-left: 1px dashed var(--primary-color-dashed);
border-right: 1px dashed var(--primary-color-dashed);
}
/* 四个方向的线 为了之后的拖动事件*/
.wx-cropper-line-t{
position: absolute;
display: block;
width: 100%;
background-color: var(--primary-color);
top: 0;
left: 0;
height: 1px;
opacity: 0.1;
cursor: n-resize;
}
.wx-cropper-line-t::before{
content: '';
position: absolute;
top: 50%;
right: 0rpx;
width: 100%;
-webkit-transform: translate3d(0,-50%,0);
transform: translate3d(0,-50%,0);
bottom: 0;
height: 41rpx;
background: transparent;
z-index: 11;
}
.wx-cropper-line-r{
position: absolute;
display: block;
background-color: var(--primary-color);
top: 0;
right: 0px;
width: 1px;
opacity: 0.1;
height: 100%;
cursor: e-resize;
}
.wx-cropper-line-r::before{
content: '';
position: absolute;
top: 0;
left: 50%;
width: 41rpx;
-webkit-transform: translate3d(-50%,0,0);
transform: translate3d(-50%,0,0);
bottom: 0;
height: 100%;
background: transparent;
z-index: 11;
}
.wx-cropper-line-b{
position: absolute;
display: block;
width: 100%;
background-color: var(--primary-color);
bottom: 0;
left: 0;
height: 1px;
opacity: 0.1;
cursor: s-resize;
}
.wx-cropper-line-b::before{
content: '';
position: absolute;
top: 50%;
right: 0rpx;
width: 100%;
-webkit-transform: translate3d(0,-50%,0);
transform: translate3d(0,-50%,0);
bottom: 0;
height: 41rpx;
background: transparent;
z-index: 11;
}
.wx-cropper-line-l{
position: absolute;
display: block;
background-color: var(--primary-color);
top: 0;
left: 0;
width: 1px;
opacity: 0.1;
height: 100%;
cursor: w-resize;
}
.wx-cropper-line-l::before{
content: '';
position: absolute;
top: 0;
left: 50%;
width: 41rpx;
-webkit-transform: translate3d(-50%,0,0);
transform: translate3d(-50%,0,0);
bottom: 0;
height: 100%;
background: transparent;
z-index: 11;
}
.wx-cropper-point{
width: 5px;
height: 5px;
/* background-color: var(--primary-color); */
opacity: .75;
position: absolute;
z-index: 3;
}
.point-t{
top: -3px;
left: 50%;
margin-left: -3px;
cursor: n-resize;
}
.point-r{
top: 50%;
left:100%;
margin-left: -3px;
margin-top: -3px;
cursor: n-resize;
}
.point-tr, .point-rb, .point-bl, .point-lt{
cursor: n-resize;
width: 29rpx;
height: 29rpx;
position: absolute;
z-index: 1112;
opacity: 1;
}
.point-rb{
right: 0;
bottom: 0;
-webkit-transform: translate3d(50%,50%,0);
}
.point-tr{
right: 0;
top: 0;
-webkit-transform: translate3d(50%,-50%,0);
}
.point-bl{
left: 0;
bottom: 0;
-webkit-transform: translate3d(-50%,50%,0);
}
.point-lt{
top: 0;
left: 0;
-webkit-transform: translate3d(-50%,-50%,0);
}
.point-rb::before, .point-rb::after,
.point-tr::before, .point-tr::after,
.point-bl::before, .point-bl::after,
.point-lt::before, .point-lt::after{
content: '';
position: absolute;
background-color: var(--primary-color);
}
/* 右下 */
.point-rb::before{
width: 6rpx;
height: 30rpx;
right: calc(50% - 6rpx);
bottom: calc(50% - 6rpx);
}
.point-rb::after{
height: 6rpx;
width: 30rpx;
right: calc(50% - 6rpx);
bottom: calc(50% - 6rpx);
}
/* 右上 */
.point-tr::before{
width: 6rpx;
height: 30rpx;
right: calc(50% - 6rpx);
top: calc(50% - 6rpx);
}
.point-tr::after{
height: 6rpx;
width: 30rpx;
right: calc(50% - 6rpx);
top: calc(50% - 6rpx);
}
/* 左下 */
.point-bl::before{
width: 6rpx;
height: 30rpx;
left: calc(50% - 6rpx);
bottom: calc(50% - 6rpx);
}
.point-bl::after{
height: 6rpx;
width: 30rpx;
left: calc(50% - 6rpx);
bottom: calc(50% - 6rpx);
}
/* 左上 */
.point-lt::before{
width: 6rpx;
height: 30rpx;
left: calc(50% - 6rpx);
top: calc(50% - 6rpx);
}
.point-lt::after{
height: 6rpx;
width: 30rpx;
left: calc(50% - 6rpx);
top: calc(50% - 6rpx);
}
.point-b{
left:50%;
top: 100%;
margin-left: -3px;
margin-top: -3px;
cursor: n-resize;
}
.point-l{
left:0%;
top: 50%;
margin-left: -3px;
margin-top: -3px;
cursor: n-resize;
}
/* 裁剪框预览内容 */
.wx-cropper-viewer{
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
.wx-cropper-viewer image{
position: absolute;
z-index: 2;
}