|
|
|
@ -569,7 +569,7 @@ export class DrawerContentProvider {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const queueDragProgress = () => {
|
|
|
|
const queueDragProgress = () => {
|
|
|
|
if (dragProgressFrame !== null) return;
|
|
|
|
if (dragProgressFrame !== null) return;
|
|
|
|
dragProgressFrame = requestAnimationFrame(flushDragProgress);
|
|
|
|
dragProgressFrame = this.provider.soma.dom.requestFrame(flushDragProgress, opts.ref.current);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let axialDragProgressFrame: number | null = null;
|
|
|
|
let axialDragProgressFrame: number | null = null;
|
|
|
|
const beginDrag = (e: PointerEvent, axisOffsetToward = 0) => {
|
|
|
|
const beginDrag = (e: PointerEvent, axisOffsetToward = 0) => {
|
|
|
|
@ -588,11 +588,11 @@ export class DrawerContentProvider {
|
|
|
|
const releaseDrag = () => {
|
|
|
|
const releaseDrag = () => {
|
|
|
|
if (!this.wasDragging) return;
|
|
|
|
if (!this.wasDragging) return;
|
|
|
|
if (dragProgressFrame !== null) {
|
|
|
|
if (dragProgressFrame !== null) {
|
|
|
|
cancelAnimationFrame(dragProgressFrame);
|
|
|
|
this.provider.soma.dom.cancelFrame(dragProgressFrame, opts.ref.current);
|
|
|
|
dragProgressFrame = null;
|
|
|
|
dragProgressFrame = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (axialDragProgressFrame !== null) {
|
|
|
|
if (axialDragProgressFrame !== null) {
|
|
|
|
cancelAnimationFrame(axialDragProgressFrame);
|
|
|
|
this.provider.soma.dom.cancelFrame(axialDragProgressFrame, opts.ref.current);
|
|
|
|
axialDragProgressFrame = null;
|
|
|
|
axialDragProgressFrame = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.wasDragging = false;
|
|
|
|
this.wasDragging = false;
|
|
|
|
@ -760,13 +760,13 @@ export class DrawerContentProvider {
|
|
|
|
if (captured) return;
|
|
|
|
if (captured) return;
|
|
|
|
const el = opts.ref.current;
|
|
|
|
const el = opts.ref.current;
|
|
|
|
if (!el) return;
|
|
|
|
if (!el) return;
|
|
|
|
const id = requestAnimationFrame(() => {
|
|
|
|
const id = this.provider.soma.dom.requestFrame(() => {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const axis = sideToAxis(this.provider.resolvedSide);
|
|
|
|
const axis = sideToAxis(this.provider.resolvedSide);
|
|
|
|
this.panelMaxSize = axis === 'x' ? rect.width : rect.height;
|
|
|
|
this.panelMaxSize = axis === 'x' ? rect.width : rect.height;
|
|
|
|
captured = true;
|
|
|
|
captured = true;
|
|
|
|
});
|
|
|
|
}, el);
|
|
|
|
return () => cancelAnimationFrame(id);
|
|
|
|
return () => this.provider.soma.dom.cancelFrame(id, el);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// ── AxialDrag (resize-on-drag, free or snapped) ──────────────────────
|
|
|
|
// ── AxialDrag (resize-on-drag, free or snapped) ──────────────────────
|
|
|
|
@ -777,7 +777,7 @@ export class DrawerContentProvider {
|
|
|
|
const axialReleaseDrag = () => releaseDrag();
|
|
|
|
const axialReleaseDrag = () => releaseDrag();
|
|
|
|
const queueAxialProgress = () => {
|
|
|
|
const queueAxialProgress = () => {
|
|
|
|
if (axialDragProgressFrame !== null) return;
|
|
|
|
if (axialDragProgressFrame !== null) return;
|
|
|
|
axialDragProgressFrame = requestAnimationFrame(() => {
|
|
|
|
axialDragProgressFrame = this.provider.soma.dom.requestFrame(() => {
|
|
|
|
axialDragProgressFrame = null;
|
|
|
|
axialDragProgressFrame = null;
|
|
|
|
if (!this.axial.isDragging) return;
|
|
|
|
if (!this.axial.isDragging) return;
|
|
|
|
void this.provider.runtime.trigger('drag-progress', {
|
|
|
|
void this.provider.runtime.trigger('drag-progress', {
|
|
|
|
@ -787,7 +787,7 @@ export class DrawerContentProvider {
|
|
|
|
this.axial.offsetPx
|
|
|
|
this.axial.offsetPx
|
|
|
|
)
|
|
|
|
)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, opts.ref.current);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.axial = new AxialDrag({
|
|
|
|
this.axial = new AxialDrag({
|
|
|
|
|