pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add manipulation buttons to caption offset

Jip Fr 269d2b59 e569b5ba

+55 -7
+2
src/components/Icon.tsx
··· 9 9 ARROW_LEFT = "arrowLeft", 10 10 ARROW_RIGHT = "arrowRight", 11 11 CHEVRON_DOWN = "chevronDown", 12 + CHEVRON_UP = "chevronUp", 12 13 CHEVRON_RIGHT = "chevronRight", 13 14 CHEVRON_LEFT = "chevronLeft", 14 15 CLAPPER_BOARD = "clapperBoard", ··· 61 62 eyeSlash: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path fill="currentColor" d="M150.7 92.77C195 58.27 251.8 32 320 32C400.8 32 465.5 68.84 512.6 112.6C559.4 156 590.7 207.1 605.5 243.7C608.8 251.6 608.8 260.4 605.5 268.3C592.1 300.6 565.2 346.1 525.6 386.7L630.8 469.1C641.2 477.3 643.1 492.4 634.9 502.8C626.7 513.2 611.6 515.1 601.2 506.9L9.196 42.89C-1.236 34.71-3.065 19.63 5.112 9.196C13.29-1.236 28.37-3.065 38.81 5.112L150.7 92.77zM223.1 149.5L313.4 220.3C317.6 211.8 320 202.2 320 191.1C320 180.5 316.1 169.7 311.6 160.4C314.4 160.1 317.2 159.1 320 159.1C373 159.1 416 202.1 416 255.1C416 269.7 413.1 282.7 407.1 294.5L446.6 324.7C457.7 304.3 464 280.9 464 255.1C464 176.5 399.5 111.1 320 111.1C282.7 111.1 248.6 126.2 223.1 149.5zM320 480C239.2 480 174.5 443.2 127.4 399.4C80.62 355.1 49.34 304 34.46 268.3C31.18 260.4 31.18 251.6 34.46 243.7C44 220.8 60.29 191.2 83.09 161.5L177.4 235.8C176.5 242.4 176 249.1 176 255.1C176 335.5 240.5 400 320 400C338.7 400 356.6 396.4 373 389.9L446.2 447.5C409.9 467.1 367.8 480 320 480H320z"/></svg>`, 62 63 arrowLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>`, 63 64 chevronDown: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>`, 65 + chevronUp: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-up"><polyline points="18 15 12 9 6 15"></polyline></svg>`, 64 66 chevronRight: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>`, 65 67 chevronLeft: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-left"><polyline points="15 18 9 12 15 6"></polyline></svg>`, 66 68 clapperBoard: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path fill="currentColor" d="M326.1 160l127.4-127.4C451.7 32.39 449.9 32 448 32h-86.06l-128 128H326.1zM166.1 160l128-128H201.9l-128 128H166.1zM497.7 56.19L393.9 160H512V96C512 80.87 506.5 67.15 497.7 56.19zM134.1 32H64C28.65 32 0 60.65 0 96v64h6.062L134.1 32zM0 416c0 35.35 28.65 64 64 64h384c35.35 0 64-28.65 64-64V192H0V416z"/></svg>`,
+53 -7
src/components/player/atoms/settings/CaptionSettingsView.tsx
··· 41 41 label: string; 42 42 min: number; 43 43 decimalsAllowed?: number; 44 + controlButtons?: boolean; 44 45 }) { 45 46 const inputRef = useRef<HTMLInputElement | null>(null); 46 47 const ref = useRef<HTMLDivElement>(null); ··· 75 76 window.removeEventListener("keydown", listener); 76 77 }; 77 78 }, [isFocused]); 79 + 80 + function setNewValue(value: number) { 81 + props.onChange?.(Math.min(Math.max(value, props.min), props.max)); 82 + } 78 83 79 84 const inputClasses = 80 85 "px-3 py-1 bg-video-context-inputBg rounded w-20 text-left text-white cursor-text"; ··· 143 148 } 144 149 /> 145 150 ) : ( 146 - <button 147 - className={inputClasses} 148 - onClick={() => { 151 + <div 152 + className="relative" 153 + onClick={(evt) => { 154 + if ((evt.target as HTMLButtonElement).closest(".actions")) 155 + return; 156 + 149 157 setInputValue(props.value.toFixed(props.decimalsAllowed ?? 0)); 150 158 setIsFocused(true); 151 159 }} 152 - type="button" 153 - tabIndex={0} 154 160 > 155 - {textTransformer(props.value.toFixed(props.decimalsAllowed ?? 0))} 156 - </button> 161 + <button 162 + className={classNames( 163 + inputClasses, 164 + props.controlButtons ? "pr-8 relative" : undefined 165 + )} 166 + type="button" 167 + tabIndex={0} 168 + > 169 + {textTransformer( 170 + props.value.toFixed(props.decimalsAllowed ?? 0) 171 + )} 172 + </button> 173 + {props.controlButtons ? ( 174 + <div className="actions w-6 h-full absolute right-0 top-0 flex items-center flex-col"> 175 + <button 176 + type="button" 177 + onClick={ 178 + () => 179 + setNewValue( 180 + props.value + 1 / 10 ** (props.decimalsAllowed ?? 0) 181 + ) // Add depending on the decimalsAllowed. If there's 1 decimal allowed, add 0.1. For 2, add 0.01, etc. 182 + } 183 + className="hover:text-white transition-colors duration-100" 184 + > 185 + <Icon icon={Icons.CHEVRON_UP} /> 186 + </button> 187 + <button 188 + type="button" 189 + onClick={ 190 + () => 191 + setNewValue( 192 + props.value - 1 / 10 ** (props.decimalsAllowed ?? 0) 193 + ) // Remove depending on the decimalsAllowed. If there's 1 decimal allowed, add 0.1. For 2, add 0.01, etc. 194 + } 195 + className="hover:text-white transition-colors duration-100" 196 + > 197 + <Icon icon={Icons.CHEVRON_DOWN} /> 198 + </button> 199 + </div> 200 + ) : null} 201 + </div> 157 202 )} 158 203 </div> 159 204 </div> ··· 186 231 value={delay} 187 232 textTransformer={(s) => `${s}s`} 188 233 decimalsAllowed={1} 234 + controlButtons 189 235 /> 190 236 <CaptionSetting 191 237 label="Text size"