|
| 1 | +@import '../../style/themes/index'; |
| 2 | +@import '../../style/mixins/index'; |
| 3 | + |
| 4 | +@image-prefix-cls: ~'@{ant-prefix}-image'; |
| 5 | +@image-preview-prefix-cls: ~'@{image-prefix-cls}-preview'; |
| 6 | + |
| 7 | +.@{image-prefix-cls} { |
| 8 | + position: relative; |
| 9 | + display: inline-block; |
| 10 | + &-img { |
| 11 | + width: 100%; |
| 12 | + height: auto; |
| 13 | + &-placeholder { |
| 14 | + background-color: @image-bg; |
| 15 | + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=); |
| 16 | + background-repeat: no-repeat; |
| 17 | + background-position: center center; |
| 18 | + background-size: 30%; |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + &-placeholder { |
| 23 | + .box; |
| 24 | + } |
| 25 | + |
| 26 | + &-preview { |
| 27 | + .modal-mask; |
| 28 | + |
| 29 | + height: 100%; |
| 30 | + text-align: center; |
| 31 | + |
| 32 | + &-body { |
| 33 | + .box; |
| 34 | + overflow: hidden; |
| 35 | + } |
| 36 | + |
| 37 | + &-img { |
| 38 | + max-width: 100%; |
| 39 | + max-height: 100%; |
| 40 | + vertical-align: middle; |
| 41 | + transform: scale3d(1, 1, 1); |
| 42 | + cursor: grab; |
| 43 | + transition: transform 0.3s @ease-out 0s; |
| 44 | + user-select: none; |
| 45 | + pointer-events: auto; |
| 46 | + &-wrapper { |
| 47 | + .box; |
| 48 | + transition: transform 0.3s @ease-out 0s; |
| 49 | + &::before { |
| 50 | + display: inline-block; |
| 51 | + width: 1px; |
| 52 | + height: 50%; |
| 53 | + margin-right: -1px; |
| 54 | + content: ''; |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + &-moving { |
| 60 | + .@{image-prefix-cls}-preview-img { |
| 61 | + cursor: grabbing; |
| 62 | + &-wrapper { |
| 63 | + transition-duration: 0s; |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + &-wrap { |
| 69 | + z-index: @zindex-image; |
| 70 | + } |
| 71 | + |
| 72 | + &-operations { |
| 73 | + .reset-component; |
| 74 | + position: absolute; |
| 75 | + top: 0; |
| 76 | + right: 0; |
| 77 | + z-index: 1; |
| 78 | + display: flex; |
| 79 | + flex-direction: row-reverse; |
| 80 | + align-items: center; |
| 81 | + width: 100%; |
| 82 | + color: @image-preview-operation-color; |
| 83 | + list-style: none; |
| 84 | + background: fade(@modal-mask-bg, 10%); |
| 85 | + pointer-events: auto; |
| 86 | + |
| 87 | + &-operation { |
| 88 | + margin-left: @control-padding-horizontal; |
| 89 | + padding: @control-padding-horizontal; |
| 90 | + cursor: pointer; |
| 91 | + &-disabled { |
| 92 | + color: @image-preview-operation-disabled-color; |
| 93 | + pointer-events: none; |
| 94 | + } |
| 95 | + &:last-of-type { |
| 96 | + margin-left: 0; |
| 97 | + } |
| 98 | + } |
| 99 | + &-icon { |
| 100 | + font-size: @image-preview-operation-size; |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + &-switch-left, |
| 105 | + &-switch-right { |
| 106 | + position: absolute; |
| 107 | + top: 50%; |
| 108 | + right: 10px; |
| 109 | + z-index: 1; |
| 110 | + display: flex; |
| 111 | + align-items: center; |
| 112 | + justify-content: center; |
| 113 | + width: 44px; |
| 114 | + height: 44px; |
| 115 | + margin-top: -22px; |
| 116 | + color: @image-preview-operation-color; |
| 117 | + background: fade(@modal-mask-bg, 10%); |
| 118 | + border-radius: 50%; |
| 119 | + cursor: pointer; |
| 120 | + pointer-events: auto; |
| 121 | + &-disabled { |
| 122 | + color: @image-preview-operation-disabled-color; |
| 123 | + cursor: not-allowed; |
| 124 | + > .anticon { |
| 125 | + cursor: not-allowed; |
| 126 | + } |
| 127 | + } |
| 128 | + > .anticon { |
| 129 | + font-size: 18px; |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + &-switch-left { |
| 134 | + left: 10px; |
| 135 | + } |
| 136 | + |
| 137 | + &-switch-right { |
| 138 | + right: 10px; |
| 139 | + } |
| 140 | + } |
| 141 | +} |
0 commit comments