diff options
Diffstat (limited to 'src/plugins/imageZoom')
-rw-r--r-- | src/plugins/imageZoom/index.tsx | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/src/plugins/imageZoom/index.tsx b/src/plugins/imageZoom/index.tsx index 6014756..d65df08 100644 --- a/src/plugins/imageZoom/index.tsx +++ b/src/plugins/imageZoom/index.tsx @@ -76,56 +76,54 @@ export const settings = definePluginSettings({ const imageContextMenuPatch: NavContextMenuPatchCallback = (children, _) => { - if (!children.some(child => child?.props?.id === "image-zoom")) { - children.push( - <Menu.MenuGroup id="image-zoom"> - {/* thanks SpotifyControls */} - <Menu.MenuControlItem - id="zoom" - label="Zoom" - control={(props, ref) => ( - <Menu.MenuSliderControl - ref={ref} - {...props} - minValue={1} - maxValue={50} - value={settings.store.zoom} - onChange={debounce((value: number) => settings.store.zoom = value, 100)} - /> - )} - /> - <Menu.MenuControlItem - id="size" - label="Lens Size" - control={(props, ref) => ( - <Menu.MenuSliderControl - ref={ref} - {...props} - minValue={50} - maxValue={1000} - value={settings.store.size} - onChange={debounce((value: number) => settings.store.size = value, 100)} - /> - )} - /> - <Menu.MenuControlItem - id="zoom-speed" - label="Zoom Speed" - control={(props, ref) => ( - <Menu.MenuSliderControl - ref={ref} - {...props} - minValue={0.1} - maxValue={5} - value={settings.store.zoomSpeed} - onChange={debounce((value: number) => settings.store.zoomSpeed = value, 100)} - renderValue={(value: number) => `${value.toFixed(3)}x`} - /> - )} - /> - </Menu.MenuGroup> - ); - } + children.push( + <Menu.MenuGroup id="image-zoom"> + {/* thanks SpotifyControls */} + <Menu.MenuControlItem + id="zoom" + label="Zoom" + control={(props, ref) => ( + <Menu.MenuSliderControl + ref={ref} + {...props} + minValue={1} + maxValue={50} + value={settings.store.zoom} + onChange={debounce((value: number) => settings.store.zoom = value, 100)} + /> + )} + /> + <Menu.MenuControlItem + id="size" + label="Lens Size" + control={(props, ref) => ( + <Menu.MenuSliderControl + ref={ref} + {...props} + minValue={50} + maxValue={1000} + value={settings.store.size} + onChange={debounce((value: number) => settings.store.size = value, 100)} + /> + )} + /> + <Menu.MenuControlItem + id="zoom-speed" + label="Zoom Speed" + control={(props, ref) => ( + <Menu.MenuSliderControl + ref={ref} + {...props} + minValue={0.1} + maxValue={5} + value={settings.store.zoomSpeed} + onChange={debounce((value: number) => settings.store.zoomSpeed = value, 100)} + renderValue={(value: number) => `${value.toFixed(3)}x`} + /> + )} + /> + </Menu.MenuGroup> + ); }; export default definePlugin({ |