fix: sync PADDING_LEFT = barDuration in both lanes, add snap '4' (1-bar)
This commit is contained in:
+12
-5
@@ -447,7 +447,7 @@ const WaveformLane = ({
|
||||
if (snapValue && snapValue !== 'free') {
|
||||
const beatDuration = 60 / parseFloat(bpm || 120);
|
||||
let divisor = 1;
|
||||
if (snapValue === '1') divisor = 1; else if (snapValue === '1/2') divisor = 0.5; else if (snapValue === '1/4') divisor = 0.25; else if (snapValue === '1/8') divisor = 0.125; else if (snapValue === '1/16') divisor = 0.0625; else if (snapValue === '1/32') divisor = 0.03125;
|
||||
if (snapValue === '4') divisor = 4; else if (snapValue === '1') divisor = 1; else if (snapValue === '1/2') divisor = 0.5; else if (snapValue === '1/4') divisor = 0.25; else if (snapValue === '1/8') divisor = 0.125; else if (snapValue === '1/16') divisor = 0.0625; else if (snapValue === '1/32') divisor = 0.03125;
|
||||
gridSpacing = beatDuration * divisor;
|
||||
} else {
|
||||
gridSpacing = 60 / parseFloat(bpm || 120);
|
||||
@@ -1267,7 +1267,7 @@ const TempoTrackLane = ({
|
||||
ctx.strokeStyle = 'rgba(255, 255, 255, 0.15)';
|
||||
ctx.lineWidth = 0.8;
|
||||
let divisor = 1;
|
||||
if (snapValue === '1') divisor = 1; else if (snapValue === '1/2') divisor = 0.5; else if (snapValue === '1/4') divisor = 0.25; else if (snapValue === '1/8') divisor = 0.125; else if (snapValue === '1/16') divisor = 0.0625; else if (snapValue === '1/32') divisor = 0.03125;
|
||||
if (snapValue === '4') divisor = 4; else if (snapValue === '1') divisor = 1; else if (snapValue === '1/2') divisor = 0.5; else if (snapValue === '1/4') divisor = 0.25; else if (snapValue === '1/8') divisor = 0.125; else if (snapValue === '1/16') divisor = 0.0625; else if (snapValue === '1/32') divisor = 0.03125;
|
||||
const snapInterval = beatDuration * divisor;
|
||||
if (snapInterval * zoom >= 4) {
|
||||
const firstSnap = Math.floor(tStart / snapInterval) * snapInterval;
|
||||
@@ -2464,6 +2464,8 @@ const SubTabToolbar = ({
|
||||
}, /*#__PURE__*/React.createElement("option", {
|
||||
value: "free"
|
||||
}, "Free"), /*#__PURE__*/React.createElement("option", {
|
||||
value: "4"
|
||||
}, "4"), /*#__PURE__*/React.createElement("option", {
|
||||
value: "1"
|
||||
}, "1"), /*#__PURE__*/React.createElement("option", {
|
||||
value: "1/2"
|
||||
@@ -4507,6 +4509,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
||||
else if (mode === '1/4') q = 1.0;
|
||||
else if (mode === '1/8') q = 0.5;
|
||||
else if (mode === '1/16') q = 0.25;
|
||||
else if (mode === '4') q = 4.0;
|
||||
else if (mode === '1/32') q = 0.125;
|
||||
return Math.round(beat / q) * q;
|
||||
};
|
||||
@@ -4518,6 +4521,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
||||
if (mode === '1/4') return 1.0;
|
||||
if (mode === '1/8') return 0.5;
|
||||
if (mode === '1/16') return 0.25;
|
||||
if (mode === '4') return 4.0;
|
||||
if (mode === '1/32') return 0.125;
|
||||
return 0.25;
|
||||
};
|
||||
@@ -4611,6 +4615,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
||||
else if (snapVal === '1/4') snapBeats = 1.0;
|
||||
else if (snapVal === '1/8') snapBeats = 0.5;
|
||||
else if (snapVal === '1/16') snapBeats = 0.25;
|
||||
else if (snapVal === '4') snapBeats = 4.0;
|
||||
else if (snapVal === '1/32') snapBeats = 0.125;
|
||||
|
||||
for (let beat = 0; beat <= viewBeats; beat += snapBeats) {
|
||||
@@ -5395,7 +5400,7 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, onClose, onUpdateNot
|
||||
value: snapVal,
|
||||
onChange: e => setSnapVal(e.target.value),
|
||||
className: "bg-zinc-800 border border-zinc-700 text-zinc-300 rounded px-1.5 py-0.5 outline-none focus:border-yellow-500"
|
||||
}, ['free', '1', '1/2', '1/4', '1/8', '1/16', '1/32'].map(v => /*#__PURE__*/React.createElement("option", {
|
||||
}, ['free', '4', '1', '1/2', '1/4', '1/8', '1/16', '1/32'].map(v => /*#__PURE__*/React.createElement("option", {
|
||||
key: v,
|
||||
value: v
|
||||
}, v)))), /*#__PURE__*/React.createElement("div", {
|
||||
@@ -5987,7 +5992,7 @@ const App = () => {
|
||||
if (snapVal === 'free') return time;
|
||||
const beatDuration = 60 / parseFloat(bpmVal || 120);
|
||||
let divisor = 1;
|
||||
if (snapVal === '1') divisor = 1; else if (snapVal === '1/2') divisor = 0.5; else if (snapVal === '1/4') divisor = 0.25; else if (snapVal === '1/8') divisor = 0.125; else if (snapVal === '1/16') divisor = 0.0625; else if (snapVal === '1/32') divisor = 0.03125;
|
||||
if (snapVal === '4') divisor = 4; else if (snapVal === '1') divisor = 1; else if (snapVal === '1/2') divisor = 0.5; else if (snapVal === '1/4') divisor = 0.25; else if (snapVal === '1/8') divisor = 0.125; else if (snapVal === '1/16') divisor = 0.0625; else if (snapVal === '1/32') divisor = 0.03125;
|
||||
const gridSpacing = beatDuration * divisor;
|
||||
return Math.round(time / gridSpacing) * gridSpacing;
|
||||
};
|
||||
@@ -13845,7 +13850,9 @@ const App = () => {
|
||||
value: "1/16"
|
||||
}, "1/16"), /*#__PURE__*/React.createElement("option", {
|
||||
value: "1/32"
|
||||
}, "1/32")), /*#__PURE__*/React.createElement("div", {
|
||||
}, "1/32"), /*#__PURE__*/React.createElement("option", {
|
||||
value: "4"
|
||||
}, "4")), /*#__PURE__*/React.createElement("div", {
|
||||
className: "w-[1px] h-6 bg-zinc-800 mx-1.5"
|
||||
}), /*#__PURE__*/React.createElement("span", {
|
||||
className: "text-[14px] text-zinc-500 font-bold"
|
||||
|
||||
Reference in New Issue
Block a user