Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | import React from "react"; import styled, { css } from "styled-components"; import { PatternCell } from "shared/lib/uge/song/PatternCell"; interface RollChannelProps { channelId: number; active: boolean; renderPattern: PatternCell[][]; renderSelectedPatternCells: number[]; cellSize: number; isDragging: boolean; } interface WrapperProps { $rows: number; $cols: number; $size: number; $active?: boolean; } const Wrapper = styled.div<WrapperProps>` position: absolute; top: 0; ${(props) => css` margin: 0 ${3 * props.$size}px ${2 * props.$size}px 10px; width: ${props.$cols * props.$size}px; height: ${props.$rows * props.$size}px; opacity: ${props.$active ? 1 : 0.3}; `} `; interface NoteProps { $size: number; } const Note = styled.div<NoteProps>` position: absolute; height: ${(props) => `${props.$size - 1}px`}; border: 1px solid black; text-align: center; line-height: 1.1em; `; export const RollChannelFwd = ({ channelId, active, renderPattern, renderSelectedPatternCells, cellSize, isDragging, }: RollChannelProps) => { return ( <Wrapper $active={active} $rows={12 * 6} $cols={64} $size={cellSize}> {renderPattern?.map((column: PatternCell[], columnIdx: number) => { const isSelected = active && renderSelectedPatternCells.indexOf(columnIdx) > -1; const cell = column[channelId]; Iif (cell && cell.note !== null) { return ( <React.Fragment key={`note_${columnIdx}_${channelId}`}> <Note data-type="note" data-note={cell.note} data-column={columnIdx} key={`note_${columnIdx}_${channelId}`} $size={cellSize} className={ cell.instrument !== null ? `label--instrument-${cell.instrument}` : "" } style={{ left: `${columnIdx * cellSize}px`, width: cellSize, bottom: `${(cell.note % (12 * 6)) * cellSize - 1}px`, pointerEvents: "none", boxShadow: isSelected && !isDragging ? "0 0 0px 2px #c92c61" : "", zIndex: isSelected ? 1 : 0, opacity: isSelected && isDragging ? 0.6 : 1, }} > {/* {cell.effectcode?.toString(16).toUpperCase()} */} </Note> {cell.effectcode === 0 ? ( <> <Note data-param={(cell.effectparam || 0) >> 4} key={`note_arpeggio_${columnIdx}_${channelId}_1`} $size={cellSize} className={ cell.instrument !== null ? `label--instrument-${cell.instrument}` : "" } style={{ opacity: 0.4, left: `${columnIdx * cellSize}px`, width: cellSize, bottom: `${ ((cell.note + ((cell.effectparam || 0) >> 4)) % (12 * 6)) * cellSize - 1 }px`, }} ></Note> <Note data-param={(cell.effectparam || 0) & 0xf} key={`note_arpeggio_${columnIdx}_${channelId}_2`} $size={cellSize} className={ cell.instrument !== null ? `label--instrument-${cell.instrument}` : "" } style={{ opacity: 0.4, left: `${columnIdx * cellSize}px`, width: cellSize, bottom: `${ ((cell.note + ((cell.effectparam || 0) & 0xf)) % (12 * 6)) * cellSize - 1 }px`, }} ></Note> </> ) : ( "" )} </React.Fragment> ); } return ""; })} </Wrapper> ); }; export const RollChannel = React.memo(RollChannelFwd); |