mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-26 15:55:35 +00:00
Address webcam migration and fullscreen overlay review
This commit is contained in:
@@ -463,7 +463,6 @@ export function createHudOverlayWindow(): BrowserWindow {
|
||||
if (process.platform === "darwin") {
|
||||
win.setVisibleOnAllWorkspaces(true, {
|
||||
visibleOnFullScreen: true,
|
||||
skipTransformProcessType: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,20 @@ describe("normalizeProjectEditor", () => {
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(editor.webcam.roundness).toBeCloseTo(41.67, 1);
|
||||
expect(editor.webcam.roundness).toBeCloseTo(17.36, 1);
|
||||
expect(editor.webcam.cornerRadius).toBeUndefined();
|
||||
});
|
||||
|
||||
it("uses the legacy webcam size when migrating radius pixels", () => {
|
||||
const editor = normalizeProjectEditor({
|
||||
webcam: {
|
||||
cornerRadius: 90,
|
||||
size: 80,
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(editor.webcam.width).toBe(80);
|
||||
expect(editor.webcam.height).toBe(80);
|
||||
expect(editor.webcam.roundness).toBeCloseTo(4.34, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1052,8 +1052,16 @@ export function normalizeProjectEditor(editor: Partial<ProjectEditorState>): Pro
|
||||
: isFiniteNumber(webcam.cornerRadius)
|
||||
? convertLegacyWebcamRadiusToRoundness(
|
||||
webcam.cornerRadius,
|
||||
isFiniteNumber(webcam.width) ? webcam.width : DEFAULT_WEBCAM_SIZE,
|
||||
isFiniteNumber(webcam.height) ? webcam.height : DEFAULT_WEBCAM_SIZE,
|
||||
isFiniteNumber(webcam.width)
|
||||
? webcam.width
|
||||
: isFiniteNumber(webcam.size)
|
||||
? webcam.size
|
||||
: DEFAULT_WEBCAM_SIZE,
|
||||
isFiniteNumber(webcam.height)
|
||||
? webcam.height
|
||||
: isFiniteNumber(webcam.size)
|
||||
? webcam.size
|
||||
: DEFAULT_WEBCAM_SIZE,
|
||||
)
|
||||
: DEFAULT_WEBCAM_ROUNDNESS,
|
||||
shadow: isFiniteNumber(webcam.shadow)
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("webcam roundness", () => {
|
||||
});
|
||||
|
||||
it("converts legacy reference pixels without changing the approximate shape", () => {
|
||||
expect(convertLegacyWebcamRadiusToRoundness(90, 40, 40)).toBeCloseTo(41.67, 1);
|
||||
expect(convertLegacyWebcamRadiusToRoundness(90, 40, 40)).toBeCloseTo(17.36, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ export function convertLegacyWebcamRadiusToRoundness(
|
||||
const referenceShortSide =
|
||||
WEBCAM_REFERENCE_VIEWPORT_HEIGHT *
|
||||
(clamp(Math.min(widthPercent, heightPercent), 10, 100) / 100);
|
||||
return clamp((Math.max(0, radiusPixels) / (referenceShortSide / 2)) * 100, 0, 100);
|
||||
const normalizedRadius = clamp(Math.max(0, radiusPixels) / (referenceShortSide / 2), 0, 1);
|
||||
return normalizedRadius ** 2 * 100;
|
||||
}
|
||||
|
||||
export function getWebcamPositionForPreset(preset: WebcamPositionPreset): { x: number; y: number } {
|
||||
|
||||
Reference in New Issue
Block a user