Skip to content

Commit aac1bd1

Browse files
authored
Improve control feel and behavior (#49)
1 parent 1607f54 commit aac1bd1

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

index.html

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,36 @@
6464
justify-content: space-between;
6565
padding: 18px 20px;
6666
gap: 20px;
67-
transition: opacity var(--transition);
67+
transition: opacity var(--transition), transform var(--transition);
6868
}
6969

7070
.controls>div {
7171
display: flex;
7272
gap: 20px;
7373
}
7474

75+
@media (hover: hover) and (pointer: fine) {
76+
.controls#top.hidden {
77+
opacity: 0;
78+
transform: translateY(-5px);
79+
}
80+
81+
.controls#bottom.hidden {
82+
opacity: 0;
83+
transform: translateY(5px);
84+
}
85+
}
86+
87+
/* Keep controls visible on mobile */
88+
@media (hover: none) and (pointer: coarse) {
89+
90+
.controls#top.hidden,
91+
.controls#bottom.hidden {
92+
opacity: 1;
93+
transform: none;
94+
}
95+
}
96+
7597
.btn {
7698
cursor: pointer;
7799
font-size: 15px;
@@ -134,14 +156,14 @@
134156

135157
.scroll-fade.top {
136158
top: 0;
137-
mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
138-
-webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
159+
mask-image: linear-gradient(to bottom, black 25%, transparent 100%);
160+
-webkit-mask-image: linear-gradient(to bottom, black 25%, transparent 100%);
139161
}
140162

141163
.scroll-fade.bottom {
142164
bottom: 0;
143-
mask-image: linear-gradient(to top, black 50%, transparent 100%);
144-
-webkit-mask-image: linear-gradient(to top, black 50%, transparent 100%);
165+
mask-image: linear-gradient(to top, black 25%, transparent 100%);
166+
-webkit-mask-image: linear-gradient(to top, black 25%, transparent 100%);
145167
}
146168
</style>
147169
</head>
@@ -308,10 +330,8 @@
308330
document.addEventListener('click', e => {
309331
const action = e.target.dataset.action;
310332
if (action && actions[action]) {
333+
e.preventDefault();
311334
actions[action]();
312-
if (!('ontouchstart' in window)) {
313-
this.editor.focus();
314-
}
315335
}
316336
});
317337

@@ -394,9 +414,9 @@
394414
const minutes = Math.ceil(wordCount / wordsPerMinute);
395415

396416
if (minutes === 0) {
397-
return '<1 min';
417+
return '<1 minute';
398418
} else if (minutes < 60) {
399-
return `~${minutes} min${minutes !== 1 ? 's' : ''}`;
419+
return `~${minutes} minute${minutes !== 1 ? 's' : ''}`;
400420
} else if (minutes < 1440) {
401421
const hours = Math.ceil(minutes / 60);
402422
return `~${hours} hour${hours !== 1 ? 's' : ''}`;

0 commit comments

Comments
 (0)