forked from TurboWarp/scratch-gui
-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathsprite-selector.css
More file actions
131 lines (108 loc) · 3.16 KB
/
sprite-selector.css
File metadata and controls
131 lines (108 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@import "../../css/colors.css";
@import "../../css/units.css";
@import "../../css/z-index.css";
.sprite-selector {
flex-grow: 1;
position: relative;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin-right: calc($space / 2);
background-color: $ui-secondary;
border-top-right-radius: $space;
border-top-left-radius: $space;
border-color: $ui-black-transparent;
border-width: 1px;
border-style: solid;
border-bottom: 0;
}
[theme="high-contrast"] .sprite-selector .spriteIcon {
filter: invert(1);
}
.sprite-wrapper {
/*
Our goal is to fit sprites evenly in a row without leftover space.
Flexbox's `space between` property gets us close, but doesn't flow
well when the # of items per row > 1 and less than the max per row.
Solving by explicitly calc'ing the width of each sprite. Setting
`border-box` simplifies things, because content, padding and
border-width all are included in the width, leaving us only to subtract
the left + right margins.
@todo: make room for the scrollbar
*/
box-sizing: border-box;
width: calc((100% / $sprites-per-row ) - $space);
max-width: 6rem;
min-width: 4rem;
min-height: 4rem; /* @todo: calc height same as width */
margin: calc($space / 2);
}
.sprite {
height: 100%;
}
.scroll-wrapper {
/*
Sets the sprite-selector items as a scrollable pane
@todo: Safari: pane doesn't stretch to fill height;
@todo: Adding `position: relative` still doesn't fix Safari scrolling pane, and
also introduces a new bug in Chrome when vertically resizing window down,
then back up, introduces white space in the outside the page container.
*/
height: calc(100% - $sprite-info-height);
overflow-y: auto;
}
.scroll-wrapper-dragging {
background-color: $drop-highlight;
}
.items-wrapper {
display: flex;
flex-wrap: wrap;
flex-direction: row;
padding-top: calc($space / 2);
padding-left: calc($space / 2);
padding-right: calc($space / 2);
padding-bottom: $space;
overflow: hidden;
}
.add-button {
position: absolute;
bottom: 0.75rem;
}
[dir="ltr"] .add-button {
right: 1rem;
}
[dir="rtl"] .add-button {
left: 1rem;
}
.raised {
background-color: $drop-highlight;
transition: all 0.25s ease;
}
.raised:hover {
background-color: $drop-highlight;
transform: scale(1.05);
}
.raised:hover {
animation-name: wiggle;
animation-duration: 500ms;
animation-iteration-count: 1;
animation-timing-function: ease-in-out;
background-color: $drop-highlight;
}
@keyframes wiggle {
0% {transform: rotate(3deg) scale(1.05);}
25% {transform: rotate(-3deg) scale(1.05);}
50% {transform: rotate(5deg) scale(1.05);}
75% {transform: rotate(-2deg) scale(1.05);}
100% {transform: rotate(0deg) scale(1.05);}
}
.receivedBlocks {
animation: glowing 250ms;
}
@keyframes glowing {
10% { box-shadow: 0 0 10px #7fff1e; }
90% { box-shadow: 0 0 10px #7fff1e; }
100% { box-shadow: none; }
}
.placeholder > .sprite {
background: black;
filter: opacity(15%) brightness(0%);
}