-
this.handleChange(parseInt(e.target.value))}
- />
-
-
+ // Negative value
+ // We reverse it to a positive for easier maths and style rules
+ } else {
+ value = -value;
+ if (value < -max) {
+ value = -max;
+ }
+ percentage = Math.round((value / max) * 100 / 2);
+ left = 50 - percentage;
+ width = percentage;
+ negative = true;
+
+ if (left < 0) left = 0;
+ if (width > (max / 2)) width = max / 2;
+ }
+
+ return (
+
+
+
+
handleChange(parseInt(e.target.value, 10))}
+ />
+
+
-
- );
- }
+
+
+
+ );
}
+
+export default LatencyControl;
diff --git a/src/js/components/Link.js b/src/js/components/Link.js
index f10c29a9..e495eb3d 100755
--- a/src/js/components/Link.js
+++ b/src/js/components/Link.js
@@ -40,6 +40,7 @@ const Link = ({
retainScroll,
scrollTo: scrollTarget,
onContextMenu,
+ onClick,
className = '',
activeClassName,
to,
@@ -49,9 +50,12 @@ const Link = ({
if (!to) return
{children};
const history = useHistory();
const location = useLocation();
- const onClick = () => updateScrollPosition({
- history, location, retainScroll, scrollTarget,
- });
+ const handleClick = (e) => {
+ updateScrollPosition({
+ history, location, retainScroll, scrollTarget,
+ });
+ if (onClick) onClick(e);
+ }
// Decode both links. This handles issues where one link is encoded and the other isn't, but
// they're otherwise identical
@@ -63,7 +67,7 @@ const Link = ({
const active = history && isLinkActive ? (activeClassName || 'active') : '';
return (
{
if (!clients || clients.length <= 0) {
return (
@@ -77,15 +78,18 @@ const SnapcastClients = ({
value={client.latency}
onChange={(value) => actions.setClientLatency(client.id, parseInt(value))}
/>
- actions.setClientLatency(client.id, parseInt(value))}
- value={String(client.latency)}
- autosave
- />