mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: add reset zoom button (#777)
* feat: add reset zoom button Add zoom reset button. Button is shown only when zoom scale is different from 1 * change reset zoom icon * always show zoom reset * fix typo
This commit is contained in:
parent
74add8661a
commit
07336bb168
4 changed files with 29 additions and 3 deletions
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import { Action } from "./types";
|
||||
import { ColorPicker } from "../components/ColorPicker";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { trash, zoomIn, zoomOut } from "../components/icons";
|
||||
import { trash, zoomIn, zoomOut, resetZoom } from "../components/icons";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { t } from "../i18n";
|
||||
import { getNormalizedZoom } from "../scene";
|
||||
|
@ -131,6 +131,17 @@ export const actionResetZoom: Action = {
|
|||
},
|
||||
};
|
||||
},
|
||||
PanelComponent: ({ updateData }) => (
|
||||
<ToolButton
|
||||
type="button"
|
||||
icon={resetZoom}
|
||||
title={t("buttons.resetZoom")}
|
||||
aria-label={t("buttons.resetZoom")}
|
||||
onClick={() => {
|
||||
updateData(null);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
keyTest: event =>
|
||||
(event.code === KEY_CODES.ZERO || event.code === KEY_CODES.NUM_ZERO) &&
|
||||
(event[KEYS.META] || event.shiftKey),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue