revert(cursor): drop Windows-specific anchor overrides

This commit is contained in:
webadderall
2026-03-23 19:27:47 +11:00
parent 5523a7de4f
commit ddf229d797
2 changed files with 2 additions and 40 deletions
@@ -322,30 +322,6 @@ function getNormalizedAnchor(
};
}
function getPlatformCursorAnchor(uploadedAsset: {
fallbackAnchor: { x: number; y: number };
platformAnchors?: Partial<Record<"darwin" | "win32" | "linux", { x: number; y: number }>>;
}) {
if (typeof navigator === "undefined") {
return uploadedAsset.fallbackAnchor;
}
const platform = navigator.platform.toLowerCase();
if (platform.includes("win")) {
return uploadedAsset.platformAnchors?.win32 ?? uploadedAsset.fallbackAnchor;
}
if (platform.includes("mac")) {
return uploadedAsset.platformAnchors?.darwin ?? uploadedAsset.fallbackAnchor;
}
if (platform.includes("linux")) {
return uploadedAsset.platformAnchors?.linux ?? uploadedAsset.fallbackAnchor;
}
return uploadedAsset.fallbackAnchor;
}
/**
* Loads an SVG at `sampleSize × sampleSize`, crops the trim region out of it,
* and returns a PNG data-URL of the cropped result. This is required because
@@ -455,7 +431,6 @@ export async function preloadCursorAssets() {
if (uploadedAsset) {
const { trim } = uploadedAsset;
const fallbackAnchor = getPlatformCursorAnchor(uploadedAsset);
const rasterized = await rasterizeAndCropSvg(
assetUrl,
UPLOADED_CURSOR_SAMPLE_SIZE,
@@ -468,8 +443,8 @@ export async function preloadCursorAssets() {
width = rasterized.width;
height = rasterized.height;
normalizedAnchor = {
x: clamp((fallbackAnchor.x * trim.width) / width, 0, 1),
y: clamp((fallbackAnchor.y * trim.height) / height, 0, 1),
x: clamp((uploadedAsset.fallbackAnchor.x * trim.width) / width, 0, 1),
y: clamp((uploadedAsset.fallbackAnchor.y * trim.height) / height, 0, 1),
};
} else {
finalUrl = assetUrl;
@@ -22,7 +22,6 @@ export type UploadedCursorAsset = {
x: number;
y: number;
};
platformAnchors?: Partial<Record<"darwin" | "win32" | "linux", { x: number; y: number }>>;
};
export const UPLOADED_CURSOR_SAMPLE_SIZE = 1024;
@@ -32,9 +31,6 @@ export const uploadedCursorAssets: Partial<Record<CursorAssetKey, UploadedCursor
url: arrowUrl,
trim: { x: 480, y: 435, width: 333, height: 553 },
fallbackAnchor: { x: 0.18, y: 0.1 },
platformAnchors: {
win32: { x: 0.095, y: 0.056 },
},
},
text: {
url: textUrl,
@@ -45,9 +41,6 @@ export const uploadedCursorAssets: Partial<Record<CursorAssetKey, UploadedCursor
url: pointerUrl,
trim: { x: 352, y: 441, width: 466, height: 583 },
fallbackAnchor: { x: 0.37, y: 0.08 },
platformAnchors: {
win32: { x: 0.29, y: 0.07 },
},
},
crosshair: {
url: crosshairUrl,
@@ -58,17 +51,11 @@ export const uploadedCursorAssets: Partial<Record<CursorAssetKey, UploadedCursor
url: openHandUrl,
trim: { x: 288, y: 188, width: 512, height: 580 },
fallbackAnchor: { x: 0.5, y: 0.28 },
platformAnchors: {
win32: { x: 0.46, y: 0.2 },
},
},
"closed-hand": {
url: closedHandUrl,
trim: { x: 344, y: 365, width: 432, height: 403 },
fallbackAnchor: { x: 0.5, y: 0.28 },
platformAnchors: {
win32: { x: 0.47, y: 0.22 },
},
},
"resize-ew": {
url: resizeEwUrl,