From b1047e91eed657da23b3ce20cbfa223e108ae1c3 Mon Sep 17 00:00:00 2001 From: Aoife Date: Sat, 3 Apr 2021 22:00:40 -0400 Subject: [PATCH] stop text dragging --- src/App.js | 4 ++++ src/features/editor/Timbre.js | 4 ++-- src/features/editor/card.js | 4 +++- src/features/editor/parameters/Amp.js | 31 +++++++++++++-------------- src/features/utils/components.js | 7 +++--- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/App.js b/src/App.js index 3988204..b9c70d1 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,10 @@ import Menu from './features/menu'; import Editor from './features/editor'; function App() { + // DUMB THING TO STOP TEXT FROM DRAGGING GRRRR + window.ondragstart = function () { + return false; + }; return (
diff --git a/src/features/editor/Timbre.js b/src/features/editor/Timbre.js index dc03a45..130c58a 100644 --- a/src/features/editor/Timbre.js +++ b/src/features/editor/Timbre.js @@ -119,7 +119,7 @@ export default function Timbre(props) { - {/* - */} +
); } diff --git a/src/features/editor/card.js b/src/features/editor/card.js index 73e6c76..e5d9f1a 100644 --- a/src/features/editor/card.js +++ b/src/features/editor/card.js @@ -6,7 +6,9 @@ export default function Card(props = { className: 'col-span-2' }) { ' flex flex-col justify-start border border-gray-200 rounded-md shadow-md bg-white' }>
-

{props.header}

+

+ {props.header} +

{props.children} diff --git a/src/features/editor/parameters/Amp.js b/src/features/editor/parameters/Amp.js index 38cfa20..53adfc0 100644 --- a/src/features/editor/parameters/Amp.js +++ b/src/features/editor/parameters/Amp.js @@ -1,4 +1,6 @@ import React from 'react'; +import { Knob } from '../../utils/components'; +import Card from '../card'; import { useSelector, useDispatch } from 'react-redux'; import { selectById, parameterUpdated } from './parameterSlice.js'; import { Slider, Checkbox } from '../../helpers/Helpers'; @@ -8,12 +10,10 @@ export default function Amp(props) { const dispatch = useDispatch(); return ( -
- {`${props.name}`} - Amp Level - +

Amp Level

+ dispatch( @@ -24,10 +24,10 @@ export default function Amp(props) { ) } /> - PanPot - PanPot + dispatch( @@ -38,10 +38,10 @@ export default function Amp(props) { ) } /> - Amp Keyboard Tracking - Amp Keyboard Tracking + dispatch( @@ -53,7 +53,6 @@ export default function Amp(props) { } /> dispatch( @@ -64,7 +63,7 @@ export default function Amp(props) { ) } /> -
+ ); } diff --git a/src/features/utils/components.js b/src/features/utils/components.js index ab60a23..7fd34b0 100644 --- a/src/features/utils/components.js +++ b/src/features/utils/components.js @@ -54,7 +54,7 @@ function getKnobValue(dragStart, currentY, bipolar) { const slope = 0.01; let newValue = value + deltaY * slope; if (bipolar) { - const zeroCrossingResistance = 0.3; + const zeroCrossingResistance = 0; //0.3 if (value >= 0 && newValue < 0) { newValue += Math.min(zeroCrossingResistance, -newValue); } else if (value < 0 && newValue > 0) { @@ -89,7 +89,7 @@ function Knob({ const [lineX1, lineY1] = getPointPair( size / 2, valueAngle, - radius - fillWidth + 2 + radius - fillWidth + 3 ); const [dragStart, setDragStart] = useState(null); @@ -220,7 +220,8 @@ function Knob({ x2={size / 2} y2={size / 2} strokeLinecap='round' - className='stroke-current text-indigo-900 stroke-2'> + strokeWidth='2' + className='stroke-current text-indigo-900'> }