matting-editor
Version:
matting-editor
981 lines (870 loc) • 21.9 kB
text/less
@import './btn-tips.less';
@import './matting-transition.less';
.matting-container {
.matting-btn {
border: none;
outline: none;
}
}
.matting-header{
height: 80px;
position: relative;
.matting-version{
position: absolute;
top: 0.5em;
right: -1em;
color: #ccc;
}
.matting-logo{
margin:0 0 0 -80px;
width: 160px;
height: 100%;
position: absolute;
left: 50%;
top: 0;
}
.logo-image{
display: block;
background: svg-load('./icons/logo-koutu.svg', fill=#000) no-repeat 50%;
background-size: 132px 24px;
color: #45454b;
font-size: 0;
margin-top: 10px;
height: 60px;
text-align: center;
&:hover{
color: #111;
}
}
.matting-help_btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 40px;
.matting-btn {
color: #666;
font-size: 14px;
cursor: pointer;
}
}
}
.matting-tools{
margin: 25px 0 0 20px;
position: absolute;
left: 0;
top: 0;
ul{
margin: 0;
padding: 0;
}
li{
float: left;
list-style: none;
padding: 0 10px;
}
.btn-tips {
span{
display: none;
}
}
button{
padding: 0;
background: none;
border: none;
border-radius: 0;
outline: none;
-webkit-appearance: none;
&:disabled,
&[disabled],
&:disabled:hover,
&[disabled]:hover{
cursor: default;
}
&:hover{
cursor: pointer;
}
&:disabled{
opacity: .7;
}
&::before{
display: inline-block;
content: "";
height: 24px;
width: 24px;
vertical-align: top;
}
}
.tools-icon(@name) {
button.matting-tools-@{name}{
&:before{
background: svg-load('./icons/@{name}.svg', fill=#52555d);
}
&:not(:disabled):hover:before{
background: svg-load('./icons/@{name}.svg', fill=#333);
}
}
}
.tools-icon(undo);
.tools-icon(redo);
.tools-icon(zoomin);
.tools-icon(zoomout);
.tools-icon(zoomfit);
.tools-icon(zoomfull);
.tools-icon(zoomoff);
.matting-tools-pipe{
display: inline-block;
border-left: 1px solid #DDD;
margin-top: 1px;
height: 22px;
width: 0;
overflow: hidden;
vertical-align: top;
}
}
.matting-canvas{
background: #fff;
overflow: hidden;
position: absolute;
bottom: 80px;
top: 80px;
right: 0;
left: 0;
z-index: 1;
.matting-canvas-panel{
width: 50%;
height: 100%;
overflow: hidden;
position: absolute;
left: 0;
top: 0
}
.matting-canvas-main,
.matting-canvas-main canvas{
outline: 0;
position: absolute;
left: 0;
top: 0;
}
.matting-canvas-main{
width: 100%;
height: 100%;
}
.matting-canvas-tips{
background: rgba(0, 0, 0, .5);
color: #FFF;
font-size: .85em;
line-height: 2;
padding: 0 10px;
position: absolute;
right: 0;
top: 0;
z-index: 9;
pointer-events: none;
}
.matting-canvas-result{
// background-image: linear-gradient(to top right,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),linear-gradient(to top right,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);
// background-position: 0 0, 16px 16px;
// background-size: 32px 32px;
left: 50%;
&:before{
content: "";
background: #EEE;
height: 100%;
width: 1px;
position: absolute;
left: 0;
top: 0;
z-index: 5;
pointer-events: none;
}
.matting-canvas-tips{
right: auto;
left: 0;
}
}
.matting-canvas-panel .matting-brush:not(.is-hide){
visibility: visible;
opacity: 1;
}
.is-tool-pan .matting-canvas-main{
cursor: pointer;
cursor: url(./icons/pan-16.png) 8 8, pointer;
}
.is-tool-keep .matting-canvas-main{
cursor: pointer;
cursor: url(./icons/keep-16.png) 8 8, auto;
}
.is-tool-drop .matting-canvas-main{
cursor: pointer;
cursor: url(./icons/drop-16.png) 8 8, auto;
}
}
.matting-brush{
font-size: 0;
position: absolute;
bottom: 30px;
left: 50%;
opacity: 0;
visibility: hidden;
white-space: nowrap;
transform: translate(-50%, 0);
transition: all linear .4s;
button{
background: rgba(0, 0, 0, .8);
color: #FFF;
cursor: pointer;
font-size: 14px;
height: 48px;
width: 98px;
&:first-child{
border-radius: 48px 0 0 48px;
}
&:last-child{
border-radius: 0 48px 48px 0;
}
&:hover,
&.active{
background-color: rgb(0, 92, 249, .8);
}
&:before{
display: inline-block;
content: "";
background: svg-load('./icons/keep.svg');
margin: -1px 5px 0 0;
height: 24px;
width: 24px;
vertical-align: middle;
}
}
.tools-icon(@name) {
button.matting-brush-@{name}{
&:before{
background-image: svg-load('./icons/@{name}.svg');
}
}
}
.tools-icon(drop);
button.matting-brush-keep{
&:hover:before,
&.active:before{
background-image: svg-load('./icons/keep-hover.svg');
}
}
button.matting-brush-pan{
&:before,
&:hover:before{
background-image: svg-load('./icons/pan.svg', fill=#fff);
}
}
}
.matting-footer{
height: 80px;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
z-index: 3;
.matting-options-item{
float: left;
padding: 0 12px;
margin: 22px 0;
position: relative;
&.matting-options-bgcolor{
padding: 6px 26px;
}
&::before{
content: "";
background: #CCD1DA;
margin-top: 7px;
height: 22px;
width: 1px;
position: absolute;
left: 0;
top: 0;
}
&:first-child::before{
display: none;
}
.matting-ranger,
.matting-color-picker-panel{
vertical-align: top;
}
}
.matting-color-more {
float: left;
margin: 22px 0;
margin-left: -20px;
position: relative;
padding: 6px 0;
.color-more-btn {
border: 1px solid #ccc;
border-radius: 24px;
font-size: 0;
height: 22px;
overflow: hidden;
text-align: center;
&:hover{
cursor: pointer;
border-color: #3156e5;
.color-more-font{
background-image: radial-gradient(2px, #3156e5, #3156e5, #FFF);
}
}
&.is-active{
background: #3156e5;
border-color: #3156e5;
.color-more-font{
background-color: #3156e5;
background-image: radial-gradient(2px, #FFF, #FFF, #3156e5);
}
}
}
.color-more-font{
display: inline-block;
border-radius: 22px;
height: 100%;
vertical-align: top;
background: #FFF repeat-x 0 center;
background-image: radial-gradient(2px, #666, #666, #FFF);
background-size: 6px;
margin: 0 10px;
min-width: 18px;
width: 18px;
}
}
.matting-color-picker-panel-pop {
position: absolute;
bottom: 100%;
right: -120px;
background: #fff;
padding: 20px;
}
.btn-tips.btn-tips--top {
overflow: inherit;
&:before {
top: auto;
bottom: 100%;
border-bottom-color: transparent;
border-top-color: rgba(0, 0, 0, .8);
margin-bottom: 3px;
}
&:after {
top: auto;
bottom: 100%;
margin-bottom: 13px;
margin-top: auto;
font-size: 12px;
line-height: 1;
}
}
}
.matting-color-picker{
background: #FFF;
padding: 20px;
position: relative;
.matting-color-picker-main{
margin: 0 auto;
.farbtastic{
margin: 0 auto;
}
}
.matting-color-picker-val{
color: #3366ff;
font-size: 1.142em;
padding: 15px 0;
min-height: 1.5em;
text-align: center;
em{
// border-bottom: 1px solid currentColor;
font-style: normal;
}
}
.matting-color-picker-historys{
margin: 20px auto 0;
width: 204px;
ul{
font-size: 0;
margin: 0;
padding: 0;
text-align: center;
overflow: hidden;
}
li{
display: inline-block;
box-sizing: border-box;
// border-radius: 50%;
background: #FFF no-repeat;
cursor: pointer;
// margin: 0 6px;
// height: 40px;
// width: 40px;
vertical-align: top;
border-radius: 2px;
margin: 0 2px 4px;
height: 30px;
width: 30px;
&:hover{
box-shadow: 0 1px 2px #CCC;
}
&.is-active {
border: 3px solid #3156e5;
background-image: svg-load('./icons/tick.svg', fill=#fff);
background-repeat: no-repeat;
background-position: 50%;
&.is-dark {
background-image: svg-load('./icons/tick.svg', fill=#000);
}
}
em{
display: none;
}
}
[data-color='#FFF'],
[data-color='#FFFFFF'],
[data-color='#fff'],
[data-color='#ffffff']{
box-shadow: inset 0 0 0 1px #EEE;
}
}
}
.matting-color-picker-panel{
display: inline-flex;
line-height: 24px;
position: relative;
.matting-color-picker{
position: absolute;
bottom: 100%;
// right: -140px;
right: -120px;
}
.matting-color-picker-panel-label{
color: #333;
}
.matting-color-picker-panel-swatches{
ul{
display: inline-flex;
margin: 0 0 0 12px;
padding: 0;
vertical-align: top;
}
li{
background: #fff;
background-size: 22px 22px;
background-position: 0 0, 11px 11px;
background-image: linear-gradient(to top right,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),linear-gradient(to top right,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);
border: 1px solid #CCC;
border-radius: 24px;
font-size: 0;
margin: 0 5px;
height: 22px;
overflow: hidden;
text-align: center;
.matting-color-picker-panel-swatch-tick {
display: none;
}
&:hover,
&.is-current{
position: relative;
border-color: #3156e5;
cursor: pointer;
&>.matting-color-picker-panel-swatch-tick {
display: block;
position: absolute;
width: 22px;
height: 22px;
left: -4px;
top: -4px;
border: 4px solid #3156e5;
border-radius: 22px;
}
}
&.is-current {
&>.matting-color-picker-panel-swatch-tick {
background-image: svg-load('./icons/tick.svg', fill=#fff);
background-repeat: no-repeat;
background-position: 50%;
}
&>.is-dark {
background-image: svg-load('./icons/tick.svg', fill=#000);
}
}
}
em{
display: inline-block;
border-radius: 22px;
height: 100%;
min-width: 22px;
vertical-align: top;
}
}
}
.matting-ranger{
display: inline-block;
border-radius: 36px;
color: #333;
line-height: 36px;
height: 36px;
width: 140px;
overflow: hidden;
position: relative;
white-space: nowrap;
&:hover,
&.is-actived{
background-color: #2f3035;
color: #FFF;
cursor: ew-resize;
.matting-ranger-val{
color: #FFF;
}
.matting-ranger-bar{
opacity: 1;
}
}
.matting-ranger-bar{
box-sizing: border-box;
background: #337dfa;
border-right: 1px solid #8cb7ff;
height: 100%;
position: absolute;
z-index: 0;
opacity: 0;
}
.matting-ranger-main{
display: inline-flex;
justify-content: stretch;
box-sizing: border-box;
padding: 0 18px;
height: 100%;
width: 100%;
vertical-align: top;
position: relative;
pointer-events: none;
}
em{
font-style: normal;
}
.matting-ranger-label{
padding-right: 16px;
}
.matting-ranger-val{
flex: 1;
color: #005cf9;
}
}
.matting-loader{
background: rgba(0, 0, 0, .8);
border-radius: 3px;
color: #FFF;
font-size: 1em;
padding: 16px 25px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
visibility: hidden;
opacity: 0;
z-index: 9;
transition: all linear .4s;
pointer-events: none;
span:before{
content: '';
display: block;
background-image: svg-load('./icons/loader.svg', stroke=#EEE);
background-size: contain;
margin: 0 auto .5em;
height: 32px;
width: 32px;
animation: rotation 1.6s linear infinite;
}
@keyframes rotation {
100% {
transform: rotate(360deg);
}
}
&.is-loading{
visibility: visible;
opacity: 1;
}
}
.matting-guider{
.hd{
img{
width: 680px;
height: 300px;
vertical-align: top;
}
}
.md{
text-align: center;
h3{
font-size: 20px;
line-height: 2.65em;
margin: 1.125em auto 0.2em;
font-weight: normal;
}
.new-user-mark{
color: #f90023;
}
.next-brush-icon{
width: 0.8em;
vertical-align: middle;
margin: 0 0.25em 0.1em;
}
}
.ft{
margin-top: 20px;
margin-bottom: 20px;
text-align: center;
button{
font-size: 14px;
padding: 0;
color: #005cf9;
cursor: pointer;
border: none;
&:hover{
color: #0a53d0;
}
}
}
}
.matting-dialog{
position: relative;
z-index: 15;
.matting-dialog-mask{
background: rgba(255, 255, 255, 0.8);
height: 100%;
width: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 17;
}
.matting-dialog-inner{
background: #FFF;
padding: 0;
position: fixed;
left: 50%;
top: 50%;
z-index: 19;
transform: translate(-50%, -54%);
box-shadow: 0px 2px 8px rgba(160, 160, 180, 0.4);
}
.matting-dialog-close{
cursor: pointer;
font-size: 0;
padding: 7px;
position: absolute;
right: 20px;
top: 20px;
opacity: .6;
&::before{
content: "";
display: block;
background: svg-load('./icons/close.svg', fill=#AAA) no-repeat 50%;
background-size: contain;
height: 16px;
width: 16px;
}
&:hover{
opacity: 1;
}
}
}
.matting-popper-base {
position: fixed;
z-index: 99;
max-width: 212px;
max-height: 300px;
white-space: nowrap;
.arrow {
position: absolute;
display: block;
width: 0;
height: 0;
border: 10px solid transparent;
}
.guider-popper {
position: relative;
float: left;
padding: 16px 0;
background: #171717;
box-shadow: 0px 1px 16px 0 rgba(0, 0, 0, 0.12);
font-size: 14px;
max-height: 300px;
max-width: 300px;
--animate-margin-top: 30px;
--animate-margin-left: 0px;
--animate-transform-vertical: bottom;
&__btn {
float: right;
margin: 16px 12px 0 0;
padding: 10px 15px 10px 16px;
height: 32px;
border-radius: 2px;
border: none;
background-color: #005cf9;
color: #fff;
text-align: center;
line-height: 12px;
letter-spacing: 0.3px;
cursor: pointer;
white-space: nowrap;
}
&__text {
margin: 0 25px 0 15px;
line-height: 1.57;
letter-spacing: 0.3px;
color: #fff;
}
&-layout--center {
text-align: center;
& > .guider-popper__text {
margin: 0 12px;
}
}
&-position--bottom {
--animate-margin-top: -30px;
--animate-transform-vertical: top;
}
&__arrow {
&--top {
.arrow;
left: 50%;
bottom: 1px;
transform: translate(-50%, 10px * 2);
border-top-color: #171717;
}
&--bottom {
.arrow;
top: -10px * 2;
left: 50%;
transform: translateX(-50%);
border-bottom-color: #171717;
}
&--left {
.arrow;
top: 50%;
left: 100%;
transform: translateY(-50%);
border-left-color: #171717;
}
&--right {
.arrow;
top: 50%;
left: -10px * 2;
transform: translateY(-50%);
border-right-color: #171717;
}
}
}
.popper-bounce-enter-active {
animation: popperBounce .2s;
p, button {
animation: contentFade .2s;
}
}
.popper-bounce-leave-active {
transition: opacity .2s;
}
.popper-bounce-leave-to {
opacity: 0;
}
@keyframes popperBounce {
from {
transform-origin: center var(--animate-transform-vertical);
transform: scale(0);
opacity: 0;
margin-top: var(--animate-margin-top);
margin-left: var(--animate-margin-left);
}
10% {
transform: scale(.1);
}
50% {
transform: scale(.9,1);
opacity: 1;
}
80% {
animation-timing-function: ease-out;
margin-top: 0;
}
to {
animation-timing-function: cubic-bezier(0.0,0.0,0.2,1);
transform: scale(1);
}
}
@keyframes contentFade {
from {opacity: 0;}
60% {opacity: 0;}
}
}
.matting-help_container {
position: absolute;
box-sizing: border-box;
padding: 42px 52px;
z-index: 10;
top: 0;
right: 0;
background-color: #fff;
width: 662px;
height: 100%;
color: #333;
font-family: "Microsoft YaHei";
.help-body {
position: relative;
height: 100%;
}
.help-container {
position: absolute;
top: 26px;
left: 0;
width: 100%;
height: calc(~"100% - 36px");
overflow-y: auto;
overflow-x: hidden;
}
.help-close {
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 14px;
height: 14px;
cursor: pointer;
background: svg-load("./icons/close.svg", fill=#999) center;
}
.help-title {
font-size: 22px;
font-weight: bold;
}
.intro-icon {
display: inline-block;
width: 16px;
height: 16px;
background-size: cover;
&.icon--remain {
background-image: url("./icons/remain@2x.png");
}
&.icon--drop {
background-image: url("./icons/eliminate@2x.png");
}
}
.help-container {
margin-top: 36px;
font-size: 14px;
}
.help-container_item {
margin-bottom: 22px;
}
.help-item_paragraph {
margin-top: 4px;
margin-bottom: 8px;
}
.item_image {
margin-top: 24px;
margin-bottom: 22px;
img {
width: 100%;
}
}
}