solid-pianoroll 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +471 -266
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +473 -268
- package/dist/esm/index.js.map +1 -1
- package/dist/source/HorizontalZoomControl.jsx +9 -0
- package/dist/source/PianoRoll.jsx +26 -261
- package/dist/source/PianoRollContext.jsx +48 -0
- package/dist/source/PianoRollGrid.jsx +60 -0
- package/dist/source/PianoRollKeys.jsx +29 -0
- package/dist/source/PianoRollNotes.jsx +86 -0
- package/dist/source/ScrollContainer.jsx +84 -0
- package/dist/source/VerticalZoomControl.jsx +12 -0
- package/dist/source/useBoundingClientRect.js +29 -0
- package/dist/types/HorizontalZoomControl.d.ts +2 -0
- package/dist/types/PianoRoll.d.ts +6 -3
- package/dist/types/PianoRollContext.d.ts +23 -0
- package/dist/types/PianoRollGrid.d.ts +2 -0
- package/dist/types/PianoRollKeys.d.ts +9 -0
- package/dist/types/PianoRollNotes.d.ts +5 -0
- package/dist/types/ScrollContainer.d.ts +5 -0
- package/dist/types/VerticalZoomControl.d.ts +2 -0
- package/dist/types/useBoundingClientRect.d.ts +3 -0
- package/dist/types/useViewPortScaler.d.ts +1 -0
- package/package.json +4 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
var web = require('solid-js/web');
|
|
4
4
|
var solidJs = require('solid-js');
|
|
5
|
+
var store = require('solid-js/store');
|
|
6
|
+
|
|
7
|
+
function styleInject(css, ref) {
|
|
8
|
+
if (ref === void 0) ref = {};
|
|
9
|
+
var insertAt = ref.insertAt;
|
|
10
|
+
if (!css || typeof document === 'undefined') {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
14
|
+
var style = document.createElement('style');
|
|
15
|
+
style.type = 'text/css';
|
|
16
|
+
if (insertAt === 'top') {
|
|
17
|
+
if (head.firstChild) {
|
|
18
|
+
head.insertBefore(style, head.firstChild);
|
|
19
|
+
} else {
|
|
20
|
+
head.appendChild(style);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
head.appendChild(style);
|
|
24
|
+
}
|
|
25
|
+
if (style.styleSheet) {
|
|
26
|
+
style.styleSheet.cssText = css;
|
|
27
|
+
} else {
|
|
28
|
+
style.appendChild(document.createTextNode(css));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var css_248z$1 = ".PianoRoll-module_PianoRoll__rkRYx {\n box-sizing: border-box;\n display: flex;\n overflow: hidden;\n flex-direction: column;\n padding: 16px;\n}\n\n.PianoRoll-module_PianoRollContainer__Oyxr7 {\n overflow: hidden;\n height: 100%;\n display: flex;\n flex-direction: row;\n}\n\n.PianoRoll-module_PianoRollInnerContainer__9wdIQ {\n position: relative;\n display: flex;\n overflow: hidden;\n flex: 1;\n}\n";
|
|
33
|
+
var styles$1 = {"PianoRoll":"PianoRoll-module_PianoRoll__rkRYx","PianoRollContainer":"PianoRoll-module_PianoRollContainer__Oyxr7","PianoRollInnerContainer":"PianoRoll-module_PianoRollInnerContainer__9wdIQ"};
|
|
34
|
+
styleInject(css_248z$1);
|
|
35
|
+
|
|
36
|
+
const defaultRect = {
|
|
37
|
+
left: 0,
|
|
38
|
+
width: 0,
|
|
39
|
+
top: 0,
|
|
40
|
+
height: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
right: 0,
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
};
|
|
46
|
+
function useBoundingClientRect(containerRef) {
|
|
47
|
+
const [boundingClientRect, setBoundingClientRect] = solidJs.createSignal(defaultRect);
|
|
48
|
+
solidJs.createEffect(() => {
|
|
49
|
+
const container = containerRef();
|
|
50
|
+
if (!container) return;
|
|
51
|
+
const updateBoundingClientRect = () => {
|
|
52
|
+
setBoundingClientRect(container.getBoundingClientRect() ?? defaultRect);
|
|
53
|
+
};
|
|
54
|
+
const resizeObserver = new ResizeObserver(updateBoundingClientRect);
|
|
55
|
+
resizeObserver.observe(container);
|
|
56
|
+
updateBoundingClientRect();
|
|
57
|
+
return () => {
|
|
58
|
+
resizeObserver.disconnect();
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return boundingClientRect;
|
|
62
|
+
}
|
|
5
63
|
|
|
6
64
|
const clamp = (value, min, max) => {
|
|
7
65
|
return Math.max(min, Math.min(max, value));
|
|
@@ -40,308 +98,355 @@ function useViewPortScaler(getState) {
|
|
|
40
98
|
};
|
|
41
99
|
}
|
|
42
100
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let notesContainerRef;
|
|
50
|
-
const [props, divProps] = solidJs.splitProps(allProps, ["ppq", "notes", "position", "duration", "zoom", "verticalPosition", "verticalZoom", "onVerticalZoomChange", "onVerticalPositionChange", "onZoomChange", "onPositionChange", "onNoteChange"]);
|
|
51
|
-
const [dimensions, setDimensions] = solidJs.createSignal({
|
|
52
|
-
left: 0,
|
|
53
|
-
width: 0,
|
|
54
|
-
top: 0,
|
|
55
|
-
height: 0
|
|
56
|
-
});
|
|
57
|
-
const resizeObserver = new ResizeObserver(event => {
|
|
58
|
-
const {
|
|
59
|
-
left,
|
|
60
|
-
top,
|
|
61
|
-
width,
|
|
62
|
-
height
|
|
63
|
-
} = scrollContainerRef?.getBoundingClientRect() ?? {
|
|
64
|
-
left: 0,
|
|
65
|
-
width: 0,
|
|
66
|
-
top: 0,
|
|
67
|
-
height: 0
|
|
68
|
-
};
|
|
69
|
-
setDimensions({
|
|
70
|
-
left,
|
|
71
|
-
top,
|
|
72
|
-
width,
|
|
73
|
-
height
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
solidJs.createEffect(() => {
|
|
77
|
-
console.log(props.notes);
|
|
78
|
-
});
|
|
79
|
-
solidJs.onMount(() => {
|
|
80
|
-
if (!scrollContainerRef) return;
|
|
81
|
-
resizeObserver.observe(scrollContainerRef);
|
|
82
|
-
});
|
|
83
|
-
solidJs.onCleanup(() => {
|
|
84
|
-
resizeObserver.disconnect();
|
|
85
|
-
});
|
|
101
|
+
const PianoRollContext = solidJs.createContext(undefined);
|
|
102
|
+
const PianoRollContextProvider = props => {
|
|
103
|
+
const [noteDragMode, setNoteDragMode] = solidJs.createSignal();
|
|
104
|
+
const [isDragging, setIsDragging] = solidJs.createSignal(false);
|
|
105
|
+
const [_ownProps, contextProps] = solidJs.splitProps(props, ["children", "scrollContainer"]);
|
|
106
|
+
const clientRect = useBoundingClientRect(() => props.scrollContainer);
|
|
86
107
|
const horizontalViewPort = useViewPortScaler(() => ({
|
|
87
|
-
viewPortOffset:
|
|
88
|
-
viewPortSize:
|
|
108
|
+
viewPortOffset: clientRect().left,
|
|
109
|
+
viewPortSize: clientRect().width,
|
|
89
110
|
virtualPosition: props.position,
|
|
90
111
|
virtualRange: props.duration,
|
|
91
112
|
zoom: props.zoom
|
|
92
113
|
}));
|
|
93
114
|
const verticalViewPort = useViewPortScaler(() => ({
|
|
94
|
-
viewPortOffset:
|
|
95
|
-
viewPortSize:
|
|
115
|
+
viewPortOffset: clientRect().top,
|
|
116
|
+
viewPortSize: clientRect().height,
|
|
96
117
|
virtualPosition: props.verticalPosition,
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
zoom: props.verticalZoom,
|
|
119
|
+
virtualRange: 128
|
|
99
120
|
}));
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} = dimensions();
|
|
112
|
-
const {
|
|
113
|
-
scrollTop,
|
|
114
|
-
scrollLeft,
|
|
115
|
-
scrollWidth,
|
|
116
|
-
scrollHeight
|
|
117
|
-
} = event.currentTarget;
|
|
118
|
-
const scrollTopAmount = scrollTop / (scrollHeight - height);
|
|
119
|
-
const scrollLeftAmount = scrollLeft / (scrollWidth - width);
|
|
120
|
-
props.onVerticalPositionChange?.(maxVerticalPosition * scrollTopAmount);
|
|
121
|
-
props.onPositionChange?.(maxPosition * scrollLeftAmount);
|
|
121
|
+
const getContextValue = () => {
|
|
122
|
+
return {
|
|
123
|
+
...contextProps,
|
|
124
|
+
horizontalViewPort,
|
|
125
|
+
verticalViewPort,
|
|
126
|
+
clientRect: clientRect(),
|
|
127
|
+
isDragging: isDragging(),
|
|
128
|
+
onIsDraggingChange: setIsDragging,
|
|
129
|
+
noteDragMode: noteDragMode(),
|
|
130
|
+
onNoteDragModeChange: setNoteDragMode
|
|
131
|
+
};
|
|
122
132
|
};
|
|
123
|
-
|
|
133
|
+
const [contextValue, setContextValue] = store.createStore(getContextValue());
|
|
124
134
|
solidJs.createEffect(() => {
|
|
125
|
-
|
|
126
|
-
const maxPosition = props.duration - props.duration / props.zoom;
|
|
127
|
-
const scrollTopAmount = maxVerticalPosition > 0 ? props.verticalPosition / maxVerticalPosition : 0;
|
|
128
|
-
const scrollLeftAmount = maxPosition > 0 ? props.position / maxPosition : 0;
|
|
129
|
-
const {
|
|
130
|
-
height,
|
|
131
|
-
width
|
|
132
|
-
} = dimensions();
|
|
133
|
-
if (!scrollContentRef?.parentElement) return;
|
|
134
|
-
const scrollDivHeight = clamp(props.verticalZoom * height, height, 10000);
|
|
135
|
-
const scrollTop = scrollTopAmount * (scrollDivHeight - height);
|
|
136
|
-
const scrollDivWidth = clamp(props.zoom * width, width, 10000);
|
|
137
|
-
const scrollLeft = scrollLeftAmount * (scrollDivWidth - width);
|
|
138
|
-
didUpdateScroll = true;
|
|
139
|
-
scrollContentRef.style.height = `${scrollDivHeight}px`;
|
|
140
|
-
scrollContentRef.style.width = `${scrollDivWidth}px`;
|
|
141
|
-
scrollContentRef.parentElement.scrollTo({
|
|
142
|
-
left: scrollLeft,
|
|
143
|
-
top: scrollTop
|
|
144
|
-
});
|
|
135
|
+
setContextValue(getContextValue());
|
|
145
136
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const rect = element.getBoundingClientRect();
|
|
151
|
-
return x >= rect.left && rect.left + rect.width > x && y >= rect.top && rect.top + rect.height > y;
|
|
152
|
-
});
|
|
153
|
-
if (elementUnderMouse) {
|
|
154
|
-
return elementUnderMouse.dispatchEvent(new MouseEvent(event.type, event));
|
|
137
|
+
return web.createComponent(PianoRollContext.Provider, {
|
|
138
|
+
value: contextValue,
|
|
139
|
+
get children() {
|
|
140
|
+
return props.children;
|
|
155
141
|
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
const usePianoRollContext = () => {
|
|
145
|
+
const context = solidJs.useContext(PianoRollContext);
|
|
146
|
+
if (!context) throw new Error("No PianoRollContext found");
|
|
147
|
+
return context;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const _tmpl$$6 = /*#__PURE__*/web.template(`<input type="range" max="500" min="1" step="0.01">`, 1);
|
|
151
|
+
const HorizontalZoomControl = () => {
|
|
152
|
+
const context = usePianoRollContext();
|
|
159
153
|
return (() => {
|
|
160
|
-
const _el$ = _tmpl
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
}), false, true);
|
|
183
|
-
_el$2.style.setProperty("overflow", "hidden");
|
|
184
|
-
_el$2.style.setProperty("height", "100%");
|
|
185
|
-
_el$2.style.setProperty("display", "flex");
|
|
186
|
-
_el$2.style.setProperty("flex-direction", "row");
|
|
187
|
-
_el$3.style.setProperty("position", "relative");
|
|
188
|
-
_el$3.style.setProperty("height", "100%");
|
|
189
|
-
_el$3.style.setProperty("width", "50px");
|
|
190
|
-
web.insert(_el$3, web.createComponent(solidJs.Index, {
|
|
154
|
+
const _el$ = _tmpl$$6.cloneNode(true);
|
|
155
|
+
_el$.$$input = event => context.onZoomChange?.(event.currentTarget.valueAsNumber);
|
|
156
|
+
_el$.style.setProperty("margin-left", "50px");
|
|
157
|
+
_el$.style.setProperty("margin-right", "16px");
|
|
158
|
+
web.effect(() => _el$.value = context.zoom);
|
|
159
|
+
return _el$;
|
|
160
|
+
})();
|
|
161
|
+
};
|
|
162
|
+
web.delegateEvents(["input"]);
|
|
163
|
+
|
|
164
|
+
var css_248z = ".PianoRollKeys-module_PianoRollKeys__5vnQ0 {\n position: relative;\n height: 100%;\n width: 50px;\n}\n\n.PianoRollKeys-module_PianoRollKeys-Key__xunQt {\n position: absolute;\n box-sizing: border-box;\n left: 0;\n width: 100%;\n border-color: #000;\n border-style: solid;\n}\n";
|
|
165
|
+
var styles = {"PianoRollKeys":"PianoRollKeys-module_PianoRollKeys__5vnQ0","PianoRollKeys-Key":"PianoRollKeys-module_PianoRollKeys-Key__xunQt"};
|
|
166
|
+
styleInject(css_248z);
|
|
167
|
+
|
|
168
|
+
const _tmpl$$5 = /*#__PURE__*/web.template(`<div></div>`, 2);
|
|
169
|
+
const PianoRollKeys = () => {
|
|
170
|
+
const context = usePianoRollContext();
|
|
171
|
+
return (() => {
|
|
172
|
+
const _el$ = _tmpl$$5.cloneNode(true);
|
|
173
|
+
web.insert(_el$, web.createComponent(solidJs.Index, {
|
|
191
174
|
each: keys,
|
|
192
175
|
children: key => {
|
|
193
|
-
const virtualDimensions = solidJs.createMemo(() => verticalViewPort.getVirtualDimensions(127 - key().number, 1));
|
|
176
|
+
const virtualDimensions = solidJs.createMemo(() => context.verticalViewPort.getVirtualDimensions(127 - key().number, 1));
|
|
194
177
|
return web.createComponent(solidJs.Show, {
|
|
195
178
|
get when() {
|
|
196
179
|
return virtualDimensions().size > 0;
|
|
197
180
|
},
|
|
198
181
|
get children() {
|
|
199
|
-
const _el$
|
|
200
|
-
_el$11.style.setProperty("position", "absolute");
|
|
201
|
-
_el$11.style.setProperty("box-sizing", "border-box");
|
|
202
|
-
_el$11.style.setProperty("left", "0");
|
|
203
|
-
_el$11.style.setProperty("width", "100%");
|
|
204
|
-
_el$11.style.setProperty("border-color", "#000");
|
|
205
|
-
_el$11.style.setProperty("border-style", "solid");
|
|
182
|
+
const _el$2 = _tmpl$$5.cloneNode(true);
|
|
206
183
|
web.effect(_p$ => {
|
|
207
|
-
const _v$
|
|
208
|
-
_v$
|
|
209
|
-
_v$
|
|
210
|
-
_v$
|
|
211
|
-
_v$
|
|
212
|
-
_v$
|
|
213
|
-
|
|
214
|
-
_v$
|
|
215
|
-
_v$
|
|
216
|
-
_v$
|
|
217
|
-
_v$
|
|
218
|
-
_v$
|
|
184
|
+
const _v$ = styles["PianoRollKeys-Key"],
|
|
185
|
+
_v$2 = key().name,
|
|
186
|
+
_v$3 = key().number % 12,
|
|
187
|
+
_v$4 = `${virtualDimensions().offset}px`,
|
|
188
|
+
_v$5 = `${virtualDimensions().size}px`,
|
|
189
|
+
_v$6 = key().isBlack ? "#000" : "#fff",
|
|
190
|
+
_v$7 = `${!key().isBlack && !blackKeys.includes((key().number + 1) % 12) ? "0.1px" : 0} 1px ${!key().isBlack && !blackKeys.includes((key().number - 1) % 12) ? "0.1px" : 0} 0`;
|
|
191
|
+
_v$ !== _p$._v$ && web.className(_el$2, _p$._v$ = _v$);
|
|
192
|
+
_v$2 !== _p$._v$2 && web.setAttribute(_el$2, "title", _p$._v$2 = _v$2);
|
|
193
|
+
_v$3 !== _p$._v$3 && web.setAttribute(_el$2, "data-index", _p$._v$3 = _v$3);
|
|
194
|
+
_v$4 !== _p$._v$4 && _el$2.style.setProperty("top", _p$._v$4 = _v$4);
|
|
195
|
+
_v$5 !== _p$._v$5 && _el$2.style.setProperty("height", _p$._v$5 = _v$5);
|
|
196
|
+
_v$6 !== _p$._v$6 && _el$2.style.setProperty("background-color", _p$._v$6 = _v$6);
|
|
197
|
+
_v$7 !== _p$._v$7 && _el$2.style.setProperty("border-width", _p$._v$7 = _v$7);
|
|
219
198
|
return _p$;
|
|
220
199
|
}, {
|
|
200
|
+
_v$: undefined,
|
|
201
|
+
_v$2: undefined,
|
|
202
|
+
_v$3: undefined,
|
|
203
|
+
_v$4: undefined,
|
|
221
204
|
_v$5: undefined,
|
|
222
205
|
_v$6: undefined,
|
|
223
|
-
_v$7: undefined
|
|
224
|
-
_v$8: undefined,
|
|
225
|
-
_v$9: undefined,
|
|
226
|
-
_v$10: undefined
|
|
206
|
+
_v$7: undefined
|
|
227
207
|
});
|
|
228
|
-
return _el$
|
|
208
|
+
return _el$2;
|
|
229
209
|
}
|
|
230
210
|
});
|
|
231
211
|
}
|
|
232
212
|
}));
|
|
233
|
-
|
|
234
|
-
_el
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
213
|
+
web.effect(() => web.className(_el$, styles.PianoRollKeys));
|
|
214
|
+
return _el$;
|
|
215
|
+
})();
|
|
216
|
+
};
|
|
217
|
+
const blackKeys = [1, 3, 6, 8, 10];
|
|
218
|
+
const keyNames = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
|
|
219
|
+
const keys = Array.from({
|
|
220
|
+
length: 128
|
|
221
|
+
}).map((_, index) => ({
|
|
222
|
+
number: index,
|
|
223
|
+
name: `${keyNames[index % 12]} ${Math.floor(index / 12) - 2}`,
|
|
224
|
+
isBlack: blackKeys.includes(index % 12)
|
|
225
|
+
}));
|
|
226
|
+
|
|
227
|
+
const _tmpl$$4 = /*#__PURE__*/web.template(`<div class="PianoRoll-Notes-Container"><div class="PianoRoll-Notes"></div></div>`, 4),
|
|
228
|
+
_tmpl$2$1 = /*#__PURE__*/web.template(`<div class="PianoRoll-Note"></div>`, 2);
|
|
229
|
+
const PianoRollNotes = props => {
|
|
230
|
+
const context = usePianoRollContext();
|
|
231
|
+
const gridDivisionTicks = solidJs.createMemo(() => context.ppq * 4 / context.gridDivision);
|
|
232
|
+
const snapValueToGridIfEnabled = (value, altKey) => context.snapToGrid && !altKey ? Math.round(value / gridDivisionTicks()) * gridDivisionTicks() : value;
|
|
233
|
+
return (() => {
|
|
234
|
+
const _el$ = _tmpl$$4.cloneNode(true),
|
|
235
|
+
_el$2 = _el$.firstChild;
|
|
236
|
+
_el$.style.setProperty("position", "absolute");
|
|
237
|
+
const _ref$ = props.ref;
|
|
238
|
+
typeof _ref$ === "function" ? web.use(_ref$, _el$2) : props.ref = _el$2;
|
|
239
|
+
_el$2.style.setProperty("position", "relative");
|
|
240
|
+
_el$2.style.setProperty("height", "100%");
|
|
241
|
+
web.insert(_el$2, web.createComponent(solidJs.Index, {
|
|
243
242
|
get each() {
|
|
244
|
-
return
|
|
243
|
+
return context.notes;
|
|
245
244
|
},
|
|
246
245
|
children: (note, index) => {
|
|
247
|
-
const horizontalVirtualDimensions = solidJs.createMemo(() => verticalViewPort.getVirtualDimensions(127 - note().midi, 1));
|
|
248
|
-
const verticalVirtualDimensions = solidJs.createMemo(() => horizontalViewPort.getVirtualDimensions(note().ticks, note().durationTicks));
|
|
246
|
+
const horizontalVirtualDimensions = solidJs.createMemo(() => context.verticalViewPort.getVirtualDimensions(127 - note().midi, 1));
|
|
247
|
+
const verticalVirtualDimensions = solidJs.createMemo(() => context.horizontalViewPort.getVirtualDimensions(note().ticks, note().durationTicks));
|
|
249
248
|
return web.createComponent(solidJs.Show, {
|
|
250
249
|
get when() {
|
|
251
250
|
return web.memo(() => !!!!horizontalVirtualDimensions().size)() && !!verticalVirtualDimensions().size;
|
|
252
251
|
},
|
|
253
252
|
get children() {
|
|
254
|
-
const _el$
|
|
255
|
-
_el$
|
|
256
|
-
|
|
257
|
-
const initialPosition = horizontalViewPort.getPosition(event.clientX);
|
|
253
|
+
const _el$3 = _tmpl$2$1.cloneNode(true);
|
|
254
|
+
_el$3.$$mousedown = event => {
|
|
255
|
+
context.onIsDraggingChange(true);
|
|
256
|
+
const initialPosition = context.horizontalViewPort.getPosition(event.clientX);
|
|
258
257
|
const diffPosition = initialPosition - note().ticks;
|
|
259
258
|
const handleMouseMove = mouseMoveEvent => {
|
|
260
|
-
const ticks = Math.max(horizontalViewPort.getPosition(mouseMoveEvent.clientX) - diffPosition, 0);
|
|
261
|
-
|
|
259
|
+
const ticks = snapValueToGridIfEnabled(Math.max(context.horizontalViewPort.getPosition(mouseMoveEvent.clientX) - diffPosition, 0), mouseMoveEvent.altKey);
|
|
260
|
+
context.onNoteChange?.(index, {
|
|
262
261
|
...note(),
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
...(context.noteDragMode === "move" && {
|
|
263
|
+
midi: Math.round(127 - context.verticalViewPort.getPosition(mouseMoveEvent.clientY))
|
|
264
|
+
}),
|
|
265
|
+
...((context.noteDragMode === "move" || context.noteDragMode === "trimStart") && {
|
|
265
266
|
ticks
|
|
266
267
|
}),
|
|
267
|
-
...(noteDragMode
|
|
268
|
+
...(context.noteDragMode === "trimStart" && {
|
|
268
269
|
durationTicks: note().durationTicks + note().ticks - ticks
|
|
269
270
|
}),
|
|
270
|
-
...(noteDragMode
|
|
271
|
-
durationTicks: horizontalViewPort.getPosition(mouseMoveEvent.clientX) - note().ticks
|
|
271
|
+
...(context.noteDragMode === "trimEnd" && {
|
|
272
|
+
durationTicks: snapValueToGridIfEnabled(context.horizontalViewPort.getPosition(mouseMoveEvent.clientX) - note().ticks, mouseMoveEvent.altKey)
|
|
272
273
|
})
|
|
273
274
|
});
|
|
274
275
|
};
|
|
275
276
|
const handleMouseUp = () => {
|
|
276
|
-
|
|
277
|
+
context.onIsDraggingChange(false);
|
|
277
278
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
278
279
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
279
280
|
};
|
|
280
281
|
window.addEventListener("mousemove", handleMouseMove);
|
|
281
282
|
window.addEventListener("mouseup", handleMouseUp);
|
|
282
283
|
};
|
|
283
|
-
_el$
|
|
284
|
-
if (isDragging
|
|
285
|
-
const relativeX = horizontalViewPort.getScaledValue(horizontalViewPort.getPosition(event.clientX));
|
|
286
|
-
const noteStartX = horizontalViewPort.getScaledValue(note().ticks);
|
|
287
|
-
const noteEndX = horizontalViewPort.getScaledValue(note().ticks + note().durationTicks);
|
|
288
|
-
|
|
284
|
+
_el$3.$$mousemove = event => {
|
|
285
|
+
if (context.isDragging) return;
|
|
286
|
+
const relativeX = context.horizontalViewPort.getScaledValue(context.horizontalViewPort.getPosition(event.clientX));
|
|
287
|
+
const noteStartX = context.horizontalViewPort.getScaledValue(note().ticks);
|
|
288
|
+
const noteEndX = context.horizontalViewPort.getScaledValue(note().ticks + note().durationTicks);
|
|
289
|
+
context.onNoteDragModeChange(relativeX - noteStartX < 3 ? "trimStart" : noteEndX - relativeX < 3 ? "trimEnd" : "move");
|
|
289
290
|
};
|
|
290
|
-
_el$
|
|
291
|
-
_el$
|
|
292
|
-
_el$
|
|
293
|
-
_el$
|
|
294
|
-
_el$
|
|
295
|
-
_el$
|
|
296
|
-
_el$12.style.setProperty("border-color", "#a00");
|
|
291
|
+
_el$3.style.setProperty("z-index", "1");
|
|
292
|
+
_el$3.style.setProperty("position", "absolute");
|
|
293
|
+
_el$3.style.setProperty("box-sizing", "border-box");
|
|
294
|
+
_el$3.style.setProperty("border-width", "0.5px");
|
|
295
|
+
_el$3.style.setProperty("border-style", "solid");
|
|
296
|
+
_el$3.style.setProperty("border-color", "#a00");
|
|
297
297
|
web.effect(_p$ => {
|
|
298
|
-
const _v$
|
|
299
|
-
_v$
|
|
300
|
-
_v$
|
|
301
|
-
_v$
|
|
302
|
-
|
|
303
|
-
_v$
|
|
304
|
-
_v$
|
|
305
|
-
_v$
|
|
298
|
+
const _v$4 = `${horizontalVirtualDimensions().offset}px`,
|
|
299
|
+
_v$5 = `${horizontalVirtualDimensions().size}px`,
|
|
300
|
+
_v$6 = `${verticalVirtualDimensions().offset}px`,
|
|
301
|
+
_v$7 = `${verticalVirtualDimensions().size}px`,
|
|
302
|
+
_v$8 = `rgba(255,0,0, ${(128 + note().velocity) / 256})`;
|
|
303
|
+
_v$4 !== _p$._v$4 && _el$3.style.setProperty("top", _p$._v$4 = _v$4);
|
|
304
|
+
_v$5 !== _p$._v$5 && _el$3.style.setProperty("height", _p$._v$5 = _v$5);
|
|
305
|
+
_v$6 !== _p$._v$6 && _el$3.style.setProperty("left", _p$._v$6 = _v$6);
|
|
306
|
+
_v$7 !== _p$._v$7 && _el$3.style.setProperty("width", _p$._v$7 = _v$7);
|
|
307
|
+
_v$8 !== _p$._v$8 && _el$3.style.setProperty("background-color", _p$._v$8 = _v$8);
|
|
306
308
|
return _p$;
|
|
307
309
|
}, {
|
|
308
|
-
_v$
|
|
309
|
-
_v$
|
|
310
|
-
_v$
|
|
311
|
-
_v$
|
|
310
|
+
_v$4: undefined,
|
|
311
|
+
_v$5: undefined,
|
|
312
|
+
_v$6: undefined,
|
|
313
|
+
_v$7: undefined,
|
|
314
|
+
_v$8: undefined
|
|
312
315
|
});
|
|
313
|
-
return _el$
|
|
316
|
+
return _el$3;
|
|
314
317
|
}
|
|
315
318
|
});
|
|
316
319
|
}
|
|
317
320
|
}));
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
web.effect(_p$ => {
|
|
322
|
+
const _v$ = `${context.clientRect.width}px`,
|
|
323
|
+
_v$2 = `${context.clientRect.height}px`,
|
|
324
|
+
_v$3 = `${context.clientRect.width}px`;
|
|
325
|
+
_v$ !== _p$._v$ && _el$.style.setProperty("width", _p$._v$ = _v$);
|
|
326
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("height", _p$._v$2 = _v$2);
|
|
327
|
+
_v$3 !== _p$._v$3 && _el$2.style.setProperty("width", _p$._v$3 = _v$3);
|
|
328
|
+
return _p$;
|
|
329
|
+
}, {
|
|
330
|
+
_v$: undefined,
|
|
331
|
+
_v$2: undefined,
|
|
332
|
+
_v$3: undefined
|
|
333
|
+
});
|
|
334
|
+
return _el$;
|
|
335
|
+
})();
|
|
336
|
+
};
|
|
337
|
+
web.delegateEvents(["mousemove", "mousedown"]);
|
|
338
|
+
|
|
339
|
+
const _tmpl$$3 = /*#__PURE__*/web.template(`<div class="PianoRoll-Vertical-Scroller"><div></div></div>`, 4);
|
|
340
|
+
const ScrollContainer = props => {
|
|
341
|
+
let scrollContentRef;
|
|
342
|
+
const context = usePianoRollContext();
|
|
343
|
+
const forwardEventToNote = event => {
|
|
344
|
+
const x = "clientX" in event ? event.clientX : event.touches[0]?.clientX;
|
|
345
|
+
const y = "clientY" in event ? event.clientY : event.touches[0]?.clientY;
|
|
346
|
+
const elementUnderMouse = [...(context.notesContainer?.querySelectorAll?.("div") ?? [])].find(element => {
|
|
347
|
+
const rect = element.getBoundingClientRect();
|
|
348
|
+
return x >= rect.left && rect.left + rect.width > x && y >= rect.top && rect.top + rect.height > y;
|
|
349
|
+
});
|
|
350
|
+
if (elementUnderMouse) {
|
|
351
|
+
return elementUnderMouse.dispatchEvent(new MouseEvent(event.type, event));
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
const handleScroll = event => {
|
|
355
|
+
event.preventDefault();
|
|
356
|
+
if (didUpdateScroll) {
|
|
357
|
+
didUpdateScroll = false;
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const maxVerticalPosition = 128 - 128 / context.verticalZoom;
|
|
361
|
+
const maxPosition = context.duration - context.duration / context.zoom;
|
|
362
|
+
const {
|
|
363
|
+
width,
|
|
364
|
+
height
|
|
365
|
+
} = context.clientRect;
|
|
366
|
+
const {
|
|
367
|
+
scrollTop,
|
|
368
|
+
scrollLeft,
|
|
369
|
+
scrollWidth,
|
|
370
|
+
scrollHeight
|
|
371
|
+
} = event.currentTarget;
|
|
372
|
+
const scrollTopAmount = scrollTop / (scrollHeight - height);
|
|
373
|
+
const scrollLeftAmount = scrollLeft / (scrollWidth - width);
|
|
374
|
+
context.onVerticalPositionChange?.(maxVerticalPosition * scrollTopAmount);
|
|
375
|
+
context.onPositionChange?.(maxPosition * scrollLeftAmount);
|
|
376
|
+
};
|
|
377
|
+
let didUpdateScroll = false;
|
|
378
|
+
solidJs.createEffect(() => {
|
|
379
|
+
const maxVerticalPosition = 128 - 128 / context.verticalZoom;
|
|
380
|
+
const maxPosition = context.duration - context.duration / context.zoom;
|
|
381
|
+
const scrollTopAmount = maxVerticalPosition > 0 ? context.verticalPosition / maxVerticalPosition : 0;
|
|
382
|
+
const scrollLeftAmount = maxPosition > 0 ? context.position / maxPosition : 0;
|
|
383
|
+
const {
|
|
384
|
+
height,
|
|
385
|
+
width
|
|
386
|
+
} = context.clientRect;
|
|
387
|
+
if (!scrollContentRef?.parentElement) return;
|
|
388
|
+
const scrollDivHeight = clamp(context.verticalZoom * height, height, 10000);
|
|
389
|
+
const scrollTop = scrollTopAmount * (scrollDivHeight - height);
|
|
390
|
+
const scrollDivWidth = clamp(context.zoom * width, width, 10000);
|
|
391
|
+
const scrollLeft = scrollLeftAmount * (scrollDivWidth - width);
|
|
392
|
+
didUpdateScroll = true;
|
|
393
|
+
scrollContentRef.style.height = `${scrollDivHeight}px`;
|
|
394
|
+
scrollContentRef.style.width = `${scrollDivWidth}px`;
|
|
395
|
+
scrollContentRef.parentElement.scrollTo({
|
|
396
|
+
left: scrollLeft,
|
|
397
|
+
top: scrollTop
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
return (() => {
|
|
401
|
+
const _el$ = _tmpl$$3.cloneNode(true),
|
|
402
|
+
_el$2 = _el$.firstChild;
|
|
403
|
+
_el$.addEventListener("dragend", forwardEventToNote);
|
|
404
|
+
_el$.addEventListener("drag", forwardEventToNote);
|
|
405
|
+
_el$.addEventListener("dragstart", forwardEventToNote);
|
|
406
|
+
_el$.addEventListener("touchcancel", forwardEventToNote);
|
|
407
|
+
_el$.$$touchend = forwardEventToNote;
|
|
408
|
+
_el$.$$touchmove = forwardEventToNote;
|
|
409
|
+
_el$.$$touchstart = forwardEventToNote;
|
|
410
|
+
_el$.$$mouseup = forwardEventToNote;
|
|
411
|
+
_el$.$$dblclick = event => {
|
|
327
412
|
if (!forwardEventToNote(event)) ;
|
|
328
413
|
};
|
|
329
|
-
_el
|
|
330
|
-
_el
|
|
414
|
+
_el$.$$click = forwardEventToNote;
|
|
415
|
+
_el$.$$mousemove = event => {
|
|
331
416
|
if (forwardEventToNote(event)) return;
|
|
332
|
-
if (isDragging
|
|
333
|
-
|
|
417
|
+
if (context.isDragging) return;
|
|
418
|
+
context.onNoteDragModeChange(undefined);
|
|
334
419
|
};
|
|
335
|
-
_el
|
|
336
|
-
_el
|
|
337
|
-
const _ref$
|
|
338
|
-
typeof _ref$
|
|
339
|
-
const _ref$
|
|
340
|
-
typeof _ref$
|
|
341
|
-
|
|
342
|
-
|
|
420
|
+
_el$.$$mousedown = forwardEventToNote;
|
|
421
|
+
_el$.addEventListener("scroll", handleScroll);
|
|
422
|
+
const _ref$ = props.ref;
|
|
423
|
+
typeof _ref$ === "function" ? web.use(_ref$, _el$) : props.ref = _el$;
|
|
424
|
+
const _ref$2 = scrollContentRef;
|
|
425
|
+
typeof _ref$2 === "function" ? web.use(_ref$2, _el$2) : scrollContentRef = _el$2;
|
|
426
|
+
web.effect(_$p => web.style(_el$, {
|
|
427
|
+
flex: 1,
|
|
428
|
+
...(context.noteDragMode && {
|
|
429
|
+
cursor: context.noteDragMode === "trimStart" ? "w-resize" : context.noteDragMode === "trimEnd" ? "e-resize" : "pointer"
|
|
430
|
+
}),
|
|
431
|
+
//"box-sizing": "border-box",
|
|
432
|
+
"z-index": 1,
|
|
433
|
+
overflow: "scroll",
|
|
434
|
+
"pointer-events": "auto"
|
|
435
|
+
}, _$p));
|
|
436
|
+
return _el$;
|
|
437
|
+
})();
|
|
438
|
+
};
|
|
439
|
+
web.delegateEvents(["mousedown", "mousemove", "click", "dblclick", "mouseup", "touchstart", "touchmove", "touchend"]);
|
|
440
|
+
|
|
441
|
+
const _tmpl$$2 = /*#__PURE__*/web.template(`<input type="range" min="1" max="11" step="0.01">`, 1);
|
|
442
|
+
const VerticalZoomControl = () => {
|
|
443
|
+
const context = usePianoRollContext();
|
|
444
|
+
return (() => {
|
|
445
|
+
const _el$ = _tmpl$$2.cloneNode(true);
|
|
446
|
+
_el$.$$input = event => context.onVerticalZoomChange?.(event.currentTarget.valueAsNumber);
|
|
447
|
+
web.spread(_el$, web.mergeProps({
|
|
343
448
|
get value() {
|
|
344
|
-
return
|
|
449
|
+
return context.verticalZoom;
|
|
345
450
|
}
|
|
346
451
|
}, {
|
|
347
452
|
orient: "vertical"
|
|
@@ -356,48 +461,148 @@ const PianoRoll = allProps => {
|
|
|
356
461
|
};
|
|
357
462
|
}
|
|
358
463
|
}), false, false);
|
|
359
|
-
_el
|
|
360
|
-
|
|
361
|
-
|
|
464
|
+
return _el$;
|
|
465
|
+
})();
|
|
466
|
+
};
|
|
467
|
+
web.delegateEvents(["input"]);
|
|
468
|
+
|
|
469
|
+
const _tmpl$$1 = /*#__PURE__*/web.template(`<div class="PianoRoll-Grid-Container"><div class="PianoRoll-Grid"></div></div>`, 4),
|
|
470
|
+
_tmpl$2 = /*#__PURE__*/web.template(`<div class="PianoRoll-Grid-Time"></div>`, 2),
|
|
471
|
+
_tmpl$3 = /*#__PURE__*/web.template(`<div class="PianoRoll-Grid-Key"></div>`, 2);
|
|
472
|
+
const PianoRollGrid = () => {
|
|
473
|
+
const context = usePianoRollContext();
|
|
474
|
+
const gridArray = solidJs.createMemo(() => {
|
|
475
|
+
const numberOfLines = context.duration / (context.ppq * 4 / context.gridDivision);
|
|
476
|
+
return Array.from({
|
|
477
|
+
length: numberOfLines
|
|
478
|
+
}).map((_, index) => ({
|
|
479
|
+
index,
|
|
480
|
+
tick: index * (context.ppq * 4 / context.gridDivision)
|
|
481
|
+
}));
|
|
482
|
+
});
|
|
483
|
+
const visibleDimensions = solidJs.createMemo(() => context.horizontalViewPort.getVirtualDimensions(context.position, context.duration / context.zoom));
|
|
484
|
+
return (() => {
|
|
485
|
+
const _el$ = _tmpl$$1.cloneNode(true),
|
|
486
|
+
_el$2 = _el$.firstChild;
|
|
487
|
+
_el$.style.setProperty("position", "absolute");
|
|
488
|
+
_el$2.style.setProperty("position", "relative");
|
|
489
|
+
_el$2.style.setProperty("height", "100%");
|
|
490
|
+
web.insert(_el$2, web.createComponent(solidJs.Index, {
|
|
491
|
+
get each() {
|
|
492
|
+
return gridArray();
|
|
493
|
+
},
|
|
494
|
+
children: gridline => {
|
|
495
|
+
const left = solidJs.createMemo(() => context.horizontalViewPort.getScaledValue(gridline().tick));
|
|
496
|
+
return web.createComponent(solidJs.Show, {
|
|
497
|
+
get when() {
|
|
498
|
+
return web.memo(() => left() >= visibleDimensions().offset)() && left() <= visibleDimensions().offset + visibleDimensions().size;
|
|
499
|
+
},
|
|
500
|
+
get children() {
|
|
501
|
+
const _el$3 = _tmpl$2.cloneNode(true);
|
|
502
|
+
_el$3.style.setProperty("z-index", "1");
|
|
503
|
+
_el$3.style.setProperty("position", "absolute");
|
|
504
|
+
_el$3.style.setProperty("box-sizing", "border-box");
|
|
505
|
+
_el$3.style.setProperty("top", "0px");
|
|
506
|
+
_el$3.style.setProperty("height", "100%");
|
|
507
|
+
_el$3.style.setProperty("width", "1px");
|
|
508
|
+
_el$3.style.setProperty("background-color", "gray");
|
|
509
|
+
web.effect(() => _el$3.style.setProperty("left", `${left()}px`));
|
|
510
|
+
return _el$3;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}), null);
|
|
515
|
+
web.insert(_el$2, web.createComponent(solidJs.Index, {
|
|
516
|
+
each: keys,
|
|
517
|
+
children: key => {
|
|
518
|
+
const virtualDimensions = solidJs.createMemo(() => context.verticalViewPort.getVirtualDimensions(127 - key().number, 1));
|
|
519
|
+
return web.createComponent(solidJs.Show, {
|
|
520
|
+
get when() {
|
|
521
|
+
return virtualDimensions().size > 0;
|
|
522
|
+
},
|
|
523
|
+
get children() {
|
|
524
|
+
const _el$4 = _tmpl$3.cloneNode(true);
|
|
525
|
+
_el$4.style.setProperty("position", "absolute");
|
|
526
|
+
_el$4.style.setProperty("width", "100%");
|
|
527
|
+
_el$4.style.setProperty("border-bottom", "0.5px black solid");
|
|
528
|
+
_el$4.style.setProperty("border-top", "0.5px black solid");
|
|
529
|
+
web.effect(_p$ => {
|
|
530
|
+
const _v$4 = `${virtualDimensions().offset}px`,
|
|
531
|
+
_v$5 = `${virtualDimensions().size}px`;
|
|
532
|
+
_v$4 !== _p$._v$4 && _el$4.style.setProperty("top", _p$._v$4 = _v$4);
|
|
533
|
+
_v$5 !== _p$._v$5 && _el$4.style.setProperty("height", _p$._v$5 = _v$5);
|
|
534
|
+
return _p$;
|
|
535
|
+
}, {
|
|
536
|
+
_v$4: undefined,
|
|
537
|
+
_v$5: undefined
|
|
538
|
+
});
|
|
539
|
+
return _el$4;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}), null);
|
|
362
544
|
web.effect(_p$ => {
|
|
363
|
-
const _v$ = `${
|
|
364
|
-
_v$2 = `${
|
|
365
|
-
_v$3 = `${
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
cursor: noteDragMode() === "trimStart" ? "w-resize" : noteDragMode() === "trimEnd" ? "e-resize" : "pointer"
|
|
370
|
-
}),
|
|
371
|
-
//"box-sizing": "border-box",
|
|
372
|
-
"z-index": 1,
|
|
373
|
-
overflow: "scroll",
|
|
374
|
-
"pointer-events": "auto"
|
|
375
|
-
};
|
|
376
|
-
_v$ !== _p$._v$ && _el$5.style.setProperty("width", _p$._v$ = _v$);
|
|
377
|
-
_v$2 !== _p$._v$2 && _el$5.style.setProperty("height", _p$._v$2 = _v$2);
|
|
378
|
-
_v$3 !== _p$._v$3 && _el$6.style.setProperty("width", _p$._v$3 = _v$3);
|
|
379
|
-
_p$._v$4 = web.style(_el$7, _v$4, _p$._v$4);
|
|
545
|
+
const _v$ = `${context.clientRect.width}px`,
|
|
546
|
+
_v$2 = `${context.clientRect.height}px`,
|
|
547
|
+
_v$3 = `${context.clientRect.width}px`;
|
|
548
|
+
_v$ !== _p$._v$ && _el$.style.setProperty("width", _p$._v$ = _v$);
|
|
549
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("height", _p$._v$2 = _v$2);
|
|
550
|
+
_v$3 !== _p$._v$3 && _el$2.style.setProperty("width", _p$._v$3 = _v$3);
|
|
380
551
|
return _p$;
|
|
381
552
|
}, {
|
|
382
553
|
_v$: undefined,
|
|
383
554
|
_v$2: undefined,
|
|
384
|
-
_v$3: undefined
|
|
385
|
-
_v$4: undefined
|
|
555
|
+
_v$3: undefined
|
|
386
556
|
});
|
|
387
|
-
web.effect(() => _el$10.value = props.zoom);
|
|
388
557
|
return _el$;
|
|
389
558
|
})();
|
|
390
559
|
};
|
|
391
|
-
|
|
392
|
-
const
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
560
|
+
|
|
561
|
+
const _tmpl$ = /*#__PURE__*/web.template(`<div><div><div></div></div></div>`, 6);
|
|
562
|
+
const PianoRoll = allProps => {
|
|
563
|
+
const [contextProps, divProps] = solidJs.splitProps(allProps, ["ppq", "notes", "position", "duration", "zoom", "verticalPosition", "verticalZoom", "onVerticalZoomChange", "onVerticalPositionChange", "onZoomChange", "onPositionChange", "onNoteChange", "gridDivision", "snapToGrid"]);
|
|
564
|
+
const [scrollContainer, setScrollContainer] = solidJs.createSignal();
|
|
565
|
+
const [notesContainer, setNotesContainer] = solidJs.createSignal();
|
|
566
|
+
return web.createComponent(PianoRollContextProvider, web.mergeProps(contextProps, {
|
|
567
|
+
get scrollContainer() {
|
|
568
|
+
return scrollContainer();
|
|
569
|
+
},
|
|
570
|
+
get notesContainer() {
|
|
571
|
+
return notesContainer();
|
|
572
|
+
},
|
|
573
|
+
get children() {
|
|
574
|
+
const _el$ = _tmpl$.cloneNode(true),
|
|
575
|
+
_el$2 = _el$.firstChild,
|
|
576
|
+
_el$3 = _el$2.firstChild;
|
|
577
|
+
web.spread(_el$, web.mergeProps(divProps, {
|
|
578
|
+
get ["class"]() {
|
|
579
|
+
return styles$1.PianoRoll;
|
|
580
|
+
}
|
|
581
|
+
}), false, true);
|
|
582
|
+
web.insert(_el$2, web.createComponent(PianoRollKeys, {}), _el$3);
|
|
583
|
+
web.insert(_el$3, web.createComponent(PianoRollNotes, {
|
|
584
|
+
ref: setNotesContainer
|
|
585
|
+
}), null);
|
|
586
|
+
web.insert(_el$3, web.createComponent(PianoRollGrid, {}), null);
|
|
587
|
+
web.insert(_el$3, web.createComponent(ScrollContainer, {
|
|
588
|
+
ref: setScrollContainer
|
|
589
|
+
}), null);
|
|
590
|
+
web.insert(_el$2, web.createComponent(VerticalZoomControl, {}), null);
|
|
591
|
+
web.insert(_el$, web.createComponent(HorizontalZoomControl, {}), null);
|
|
592
|
+
web.effect(_p$ => {
|
|
593
|
+
const _v$ = styles$1.PianoRollContainer,
|
|
594
|
+
_v$2 = styles$1.PianoRollInnerContainer;
|
|
595
|
+
_v$ !== _p$._v$ && web.className(_el$2, _p$._v$ = _v$);
|
|
596
|
+
_v$2 !== _p$._v$2 && web.className(_el$3, _p$._v$2 = _v$2);
|
|
597
|
+
return _p$;
|
|
598
|
+
}, {
|
|
599
|
+
_v$: undefined,
|
|
600
|
+
_v$2: undefined
|
|
601
|
+
});
|
|
602
|
+
return _el$;
|
|
603
|
+
}
|
|
604
|
+
}));
|
|
605
|
+
};
|
|
401
606
|
|
|
402
607
|
exports.PianoRoll = PianoRoll;
|
|
403
608
|
//# sourceMappingURL=index.js.map
|