diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-20 15:58:22 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-20 16:14:16 +0800 |
| commit | e1996ae9067555c4b774c8de800d1b4d647c4085 (patch) | |
| tree | 9f753d0002f8cc73b728915130ef871a97762ef5 /src/css | |
| parent | b3cabd0868db0b90b98e6ee6bb80943e0f4ede4d (diff) | |
feat: enable onscroll event from plain-draggable
ref: https://github.com/anseki/plain-draggable/issues/148
* put CSS properties resize and overflow-y to content of draggable item
* refine CSS for handle animation
Diffstat (limited to 'src/css')
| -rw-r--r-- | src/css/dumbymap.css | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index 40397c1..005a8f9 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
| @@ -65,6 +65,12 @@ | |||
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | .dumby-block { | ||
| 69 | border-left: #f0f0f0 0.5em solid; | ||
| 70 | padding-left: 0.5em; | ||
| 71 | margin-left: -0.5em; | ||
| 72 | margin-bottom: 3rem; | ||
| 73 | } | ||
| 68 | 74 | ||
| 69 | .DumbyMap { | 75 | .DumbyMap { |
| 70 | position: relative; | 76 | position: relative; |
| @@ -101,12 +107,6 @@ | |||
| 101 | overflow-y: scroll; | 107 | overflow-y: scroll; |
| 102 | width: 100%; | 108 | width: 100%; |
| 103 | 109 | ||
| 104 | .dumby-block { | ||
| 105 | border-left: #f0f0f0 0.5em solid; | ||
| 106 | padding-left: 0.5em; | ||
| 107 | margin-left: -0.5em; | ||
| 108 | } | ||
| 109 | |||
| 110 | pre { | 110 | pre { |
| 111 | width: 100%; | 111 | width: 100%; |
| 112 | 112 | ||
| @@ -189,58 +189,65 @@ | |||
| 189 | 189 | ||
| 190 | .draggable-block { | 190 | .draggable-block { |
| 191 | background-color: white; | 191 | background-color: white; |
| 192 | margin-bottom: 3rem; | ||
| 193 | font-size: 12px; | 192 | font-size: 12px; |
| 194 | pointer-events: auto; | 193 | pointer-events: auto; |
| 195 | box-sizing: content-box; | 194 | box-sizing: content-box; |
| 196 | position: absolute; | 195 | position: absolute; |
| 197 | width: fit-content; | 196 | width: fit-content; |
| 198 | max-height: 50vh; | ||
| 199 | max-width: 25vw; | ||
| 200 | overflow: scroll; | ||
| 201 | border: solid gray; | 197 | border: solid gray; |
| 202 | border-radius: 0.5rem; | 198 | border-radius: 0.5rem; |
| 203 | padding-top: 0.5rem; | 199 | overflow: clip; |
| 204 | padding-bottom: 0; | ||
| 205 | resize: both; | ||
| 206 | |||
| 207 | &[style*="height"], | ||
| 208 | &[style*="width"] { | ||
| 209 | max-height: unset; | ||
| 210 | max-width: unset; | ||
| 211 | } | ||
| 212 | 200 | ||
| 213 | .dumby-block { | 201 | .dumby-block { |
| 214 | border: none; | 202 | border: none; |
| 215 | padding: 0; | 203 | resize: both; |
| 216 | } | 204 | padding-inline: 1em; |
| 205 | margin: 0; | ||
| 206 | overflow: scroll; | ||
| 207 | max-height: 50vh; | ||
| 208 | max-width: 25vw; | ||
| 209 | position: relative; | ||
| 217 | 210 | ||
| 218 | .map-container { | 211 | /* allow random width/height after resize */ |
| 219 | min-width: 200px; | 212 | &[style*="height"], |
| 220 | } | 213 | &[style*="width"] { |
| 214 | max-height: unset; | ||
| 215 | max-width: unset; | ||
| 216 | } | ||
| 221 | 217 | ||
| 222 | > :not(.draggable) { | 218 | /* gray out top of content, make draggable part easy to be seen */ |
| 223 | margin-inline: 0.5rem; | 219 | &::before { |
| 220 | display: block; | ||
| 221 | position: sticky; | ||
| 222 | top: 0; | ||
| 223 | content: ''; | ||
| 224 | width: 100%; | ||
| 225 | height: 1.5rem; | ||
| 226 | background: linear-gradient(0deg, rgb(255 255 255 / 0%), rgb(255 255 255 / 100%) 60%); | ||
| 227 | } | ||
| 228 | |||
| 229 | .map-container { | ||
| 230 | min-width: 200px; | ||
| 231 | } | ||
| 224 | } | 232 | } |
| 225 | 233 | ||
| 226 | .draggable { | 234 | .draggable { |
| 227 | display: block; | 235 | display: block; |
| 236 | position: absolute; | ||
| 237 | width: 100%; | ||
| 228 | top: 0; | 238 | top: 0; |
| 229 | left: 0; | 239 | left: 0; |
| 230 | position: sticky; | 240 | font-size: 1.1rem; |
| 231 | background: linear-gradient(0deg, rgb(255 255 255 / 0%), rgb(255 255 255 / 100%) 60%); | 241 | z-index: 1; |
| 232 | margin-bottom: -18px; | 242 | |
| 233 | transform: translate(0, -16px); | ||
| 234 | width: 100%; | ||
| 235 | padding-inline: 0; | ||
| 236 | padding-bottom: 2em; | ||
| 237 | text-align: center; | 243 | text-align: center; |
| 238 | z-index: 9999; | 244 | |
| 239 | transition: all 0.3s ease-in-out; | 245 | transition: all 0.3s ease-in-out; |
| 246 | transform: translate(0, -0.6rem); | ||
| 240 | 247 | ||
| 241 | &:hover { | 248 | &:hover { |
| 242 | background: #e1e1e1; | 249 | background: #e1e1e1; |
| 243 | padding-block: 1em 0.5em; | 250 | transform: unset; |
| 244 | 251 | ||
| 245 | & ~ * { | 252 | & ~ * { |
| 246 | opacity: 0.7; | 253 | opacity: 0.7; |