kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
340 lines (302 loc) • 7.06 kB
text/less
@import "../../styles/var.less";
.k-image {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
overflow: hidden;
.k-image-img {
width: 100%;
height: auto;
// max-height: 100%;
}
.k-image-loading {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: var(--kui-color-mask);
display: flex;
color: var(--kui-color-main);
align-items: center;
justify-content: center;
font-size: 20px;
}
.k-image-error {
font-size: 50px;
opacity: 0.3;
color: var(--kui-color-disabled);
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--kui-color-disabled);
}
.k-image-preview-mask {
opacity: 0;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
font-size: 14px;
color: #fff;
background-color: var(--kui-color-mask);
gap: 10px;
cursor: pointer;
transition: opacity 0.3s cubic-bezier(0.39, 0.575, 0.565, 1);
}
&:hover {
.k-image-preview-mask {
opacity: 1;
}
}
}
.k-image-preview {
// transition: all .25s ease-in-out;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1001;
display: flex;
.k-image-preview-mask {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1001;
height: 100%;
background-color: var(--kui-color-mask);
}
.k-image-preview-wrap {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
flex: 1;
overflow: hidden;
outline: 0;
-webkit-overflow-scrolling: touch;
z-index: 1002;
pointer-events: none;
transition: all 0.3s;
.k-image-preview-control {
position: absolute;
background-color: #ffffff10;
display: flex;
padding: 10px;
position: absolute;
left: 50%;
transform: translate(-50%);
bottom: 20px;
pointer-events: auto;
z-index: 1;
flex-direction: row-reverse;
list-style: none;
align-items: center;
justify-content: center;
margin: 0;
gap: 5px 10px;
border-radius: 12px;
// backdrop-filter: blur(10px);
line-height: 1;
.k-image-preview-action {
line-height: 1;
display: flex;
font-size: 20px;
color: #fff;
padding: 5px;
&:not(.k-image-preview-action-disabled):hover {
color: var(--kui-color-main);
background-color: var(--kui-color-mask-30);
border-radius: 5px;
}
}
path {
stroke-width: 40px ;
}
.k-image-preview-action-divider {
width: 1px;
height: 0.9em;
vertical-align: middle;
border-width: 1px 0 0;
background-color: var(--kui-color-border);
}
.k-image-preview-action-rotate-left .k-icon {
transform: rotateY(-180deg) rotate(45deg);
}
.k-image-preview-action-rotate-right .k-icon {
transform: rotate(45deg);
}
.k-image-preview-action-disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
.k-image-preview-switch-left,
.k-image-preview-switch-right {
position: absolute;
width: 44px;
height: 44px;
color: #999;
font-size: 25px;
border-radius: 50%;
background-color: var(--kui-color-mask-30);
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
top: 50%;
pointer-events: auto;
cursor: pointer;
&:hover {
background-color: var(--kui-color-main);
color: #fff;
}
&:active {
background-color: var(--kui-color-main-active);
}
}
.k-image-preview-switch-left {
left: 10px;
transform: rotate(-90deg);
}
.k-image-preview-switch-right {
right: 10px;
transform: rotate(90deg);
}
.k-image-preview-switch-disabled {
cursor: not-allowed;
opacity: 0.6;
&:hover {
background-color: var(--kui-color-mask-30);
}
}
.k-image-preview-img-wrap {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transition: transform 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;
text-align: center;
// overflow: hidden;
pointer-events: none;
&::before {
display: inline-block;
width: 0;
height: 50%;
content: "";
}
.k-image-preview-img {
vertical-align: middle;
user-select: none;
pointer-events: auto;
cursor: grab;
transition: transform 0.3s ease-in-out;
max-width: 100%;
max-height: 100%;
}
video.k-image-preview-img {
max-height: calc(100vh - 130px);
}
.k-image-preview-img-error {
pointer-events: auto;
width: 60%;
height: 50%;
background-color: var(--kui-color-mask-30);
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
color: var(--kui-color-disabled);
// filter: blur(1px);
font-size: 50px;
text-align: center;
display: flex;
justify-content: center;
border-radius: var(--kui-border-radius);
align-items: center;
}
}
}
.k-image-preview-panel {
background-color: var(--kui-color-mask-30);
position: absolute;
max-width: 512px;
top: 0;
right: 0;
bottom: 0;
padding: 20px;
z-index: 1002;
transform: translateX(0);
opacity: 1;
transition: all 0.3s;
color: #fff;
.k-image-preview-panel-action {
position: absolute;
left: 0;
top: 50%;
background-color: var(--kui-color-mask);
border-radius: 0 5px 5px 0;
padding: 15px 0;
color: #fff;
cursor: pointer;
.k-icon {
transform: rotate(90deg);
}
}
}
.k-image-preview-panel-hidden {
transform: translateX(100%);
opacity: 0;
}
}
.k-image-panel-enter-active,
.k-image-panel-leave-active {
transition: all 0.3s;
}
.k-image-group {
display: inline-block;
}
@keyframes k-image-zoom {
from {
opacity: 0;
transform: scale3d(0.3, 0.3, 0) translateZ(0);
}
to {
opacity: 1;
}
}
.k-image-zoom-enter-active {
animation: k-image-zoom 0.25s cubic-bezier(0.78, 0.14, 0.15, 0.86);
}
.k-image-zoom-leave-active {
animation: k-image-zoom 0.25s cubic-bezier(0.78, 0.14, 0.15, 0.86) reverse;
}
.k-image-preview-loading {
color: var(--kui-color-main);
position: absolute;
left: 50%;
top: 50%;
z-index: 1;
width: 50px;
font-size: 20px;
height: 50px;
border-radius: 10px;
background: var(--kui-color-mask-30);
display: flex;
align-items: center;
justify-content: center;
transform: translate(-50%, -50%);
}