aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/imageZoom/index.tsx
diff options
context:
space:
mode:
authorNuckyz <61953774+Nuckyz@users.noreply.github.com>2023-04-12 23:22:38 -0300
committerGitHub <noreply@github.com>2023-04-13 04:22:38 +0200
commite34da54271ed8027d337a484f0ec00749c71a53b (patch)
tree7d0e15f471bf1000ab7eb552350dff8648de0f05 /src/plugins/imageZoom/index.tsx
parentcfe41ef656085e3b3ed2e0ac68020b546045b55b (diff)
downloadVencord-e34da54271ed8027d337a484f0ec00749c71a53b.tar.gz
Vencord-e34da54271ed8027d337a484f0ec00749c71a53b.tar.bz2
Vencord-e34da54271ed8027d337a484f0ec00749c71a53b.zip
Option to transform emotes/stickers in compound messages (#876)
+ ContextMenu refactor to not call callbacks for same children multiple times Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/imageZoom/index.tsx')
-rw-r--r--src/plugins/imageZoom/index.tsx98
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({