Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
e2a63eb315 build(deps): bump postcss from 8.4.8 to 8.4.31 in /src/packages/utils
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.8 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.8...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-05 15:05:55 +00:00
9 changed files with 27 additions and 119 deletions

View File

@@ -18,7 +18,6 @@ import {
getDefaultAppState,
isEraserActive,
isHandToolActive,
isLaserPointerActive,
} from "../appState";
import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
import { Bounds } from "../element/bounds";
@@ -440,44 +439,3 @@ export const actionToggleHandTool = register({
},
keyTest: (event) => event.key === KEYS.H,
});
export const actionToggleLaserPointer = register({
name: "toggleLaserPointerTool",
viewMode: true,
trackEvent: { category: "menu" },
perform(elements, appState, _, app) {
let activeTool: AppState["activeTool"];
if (isLaserPointerActive(appState)) {
activeTool = updateActiveTool(appState, {
...(appState.activeTool.lastActiveTool || {
type: appState.viewModeEnabled ? "hand" : "selection",
}),
lastActiveToolBeforeEraser: null,
});
setCursor(
app.interactiveCanvas,
appState.viewModeEnabled ? CURSOR_TYPE.GRAB : CURSOR_TYPE.POINTER,
);
} else {
activeTool = updateActiveTool(appState, {
type: "laser",
lastActiveToolBeforeEraser: appState.activeTool,
});
setCursor(app.interactiveCanvas, CURSOR_TYPE.CROSSHAIR);
}
return {
appState: {
...appState,
selectedElementIds: {},
selectedGroupIds: {},
activeEmbeddable: null,
activeTool,
},
commitToHistory: true,
};
},
checked: (appState) => appState.activeTool.type === "laser",
contextItemLabel: "labels.laser",
});

View File

@@ -36,7 +36,6 @@ export type ShortcutName =
| "flipVertical"
| "hyperlink"
| "toggleElementLock"
| "toggleLaserPointerTool"
>
| "saveScene"
| "imageExport";
@@ -84,7 +83,6 @@ const shortcutMap: Record<ShortcutName, string[]> = {
viewMode: [getShortcutKey("Alt+R")],
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
toggleElementLock: [getShortcutKey("CtrlOrCmd+Shift+L")],
toggleLaserPointerTool: [getShortcutKey("K")],
};
export const getShortcutFromShortcutName = (name: ShortcutName) => {

View File

@@ -124,8 +124,7 @@ export type ActionName =
| "setFrameAsActiveTool"
| "setEmbeddableAsActiveTool"
| "createContainerFromText"
| "wrapTextInContainer"
| "toggleLaserPointerTool";
| "wrapTextInContainer";
export type PanelComponentProps = {
elements: readonly ExcalidrawElement[];

View File

@@ -266,11 +266,3 @@ export const isHandToolActive = ({
}) => {
return activeTool.type === "hand";
};
export const isLaserPointerActive = ({
activeTool,
}: {
activeTool: AppState["activeTool"];
}) => {
return activeTool.type === "laser";
};

View File

@@ -46,7 +46,6 @@ import {
getDefaultAppState,
isEraserActive,
isHandToolActive,
isLaserPointerActive,
} from "../appState";
import { parseClipboard } from "../clipboard";
import {
@@ -344,11 +343,7 @@ import {
actionRemoveAllElementsFromFrame,
actionSelectAllElementsInFrame,
} from "../actions/actionFrame";
import {
actionToggleHandTool,
zoomToFit,
actionToggleLaserPointer,
} from "../actions/actionCanvas";
import { actionToggleHandTool, zoomToFit } from "../actions/actionCanvas";
import { jotaiStore } from "../jotai";
import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
import {
@@ -2915,22 +2910,7 @@ class App extends React.Component<AppProps, AppState> {
return;
}
if (event.key === KEYS.K && !event.altKey && !event[KEYS.CTRL_OR_CMD]) {
if (isLaserPointerActive(this.state)) {
this.setActiveTool({
type: "selection",
});
} else {
this.setActiveTool({ type: "laser" });
}
return;
}
if (this.state.viewModeEnabled) {
//revert to hand in case a key is pressed (K is handled above)
if (event.key !== KEYS.K) {
this.setActiveTool({ type: "selection" });
}
return;
}
@@ -3080,6 +3060,15 @@ class App extends React.Component<AppProps, AppState> {
}
}
if (event.key === KEYS.K && !event.altKey && !event[KEYS.CTRL_OR_CMD]) {
if (this.state.activeTool.type === "laser") {
this.setActiveTool({ type: "selection" });
} else {
this.setActiveTool({ type: "laser" });
}
return;
}
if (
event[KEYS.CTRL_OR_CMD] &&
(event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE)
@@ -3623,18 +3612,6 @@ class App extends React.Component<AppProps, AppState> {
if (this.state.multiElement) {
return;
}
if (this.state.viewModeEnabled) {
if (this.state.activeTool.type === "laser") {
this.setActiveTool({ type: "selection" });
setCursor(this.interactiveCanvas, CURSOR_TYPE.GRAB);
} else {
this.setActiveTool({ type: "laser" });
setCursor(this.interactiveCanvas, CURSOR_TYPE.CROSSHAIR);
}
return;
}
// we should only be able to double click when mode is selection
if (this.state.activeTool.type !== "selection") {
return;
@@ -4762,7 +4739,7 @@ class App extends React.Component<AppProps, AppState> {
(event.button === POINTER_BUTTON.WHEEL ||
(event.button === POINTER_BUTTON.MAIN && isHoldingSpace) ||
isHandToolActive(this.state) ||
(this.state.viewModeEnabled && !isLaserPointerActive(this.state)))
this.state.viewModeEnabled)
) ||
isTextElement(this.state.editingElement)
) {
@@ -8166,7 +8143,6 @@ class App extends React.Component<AppProps, AppState> {
actionToggleZenMode,
actionToggleViewMode,
actionToggleStats,
actionToggleLaserPointer,
];
}

View File

@@ -91,7 +91,7 @@ export class LaserPathManager {
private collaboratorsState: Map<string, CollabolatorState> = new Map();
private rafId: number | undefined;
private isDrawing = false;
private lastUpdate = 0;
private container: SVGSVGElement | undefined;
constructor(private app: App) {
@@ -100,7 +100,7 @@ export class LaserPathManager {
destroy() {
this.stop();
this.isDrawing = false;
this.lastUpdate = 0;
this.ownState = instantiateCollabolatorState();
this.collaboratorsState = new Map();
}
@@ -127,7 +127,7 @@ export class LaserPathManager {
}
private updatePath(state: CollabolatorState) {
this.isDrawing = true;
this.lastUpdate = performance.now();
if (!this.isRunning) {
this.start();
@@ -160,7 +160,7 @@ export class LaserPathManager {
this.updateCollabolatorsState();
if (this.isDrawing) {
if (performance.now() - this.lastUpdate < DECAY_TIME * 2) {
this.update();
} else {
this.isRunning = false;
@@ -250,8 +250,6 @@ export class LaserPathManager {
return;
}
let somePathsExist = false;
for (const [key, state] of this.collaboratorsState.entries()) {
if (!this.app.state.collaborators.has(key)) {
state.svg.remove();
@@ -271,10 +269,6 @@ export class LaserPathManager {
paths += ` ${this.draw(state.currentPath)}`;
}
if (paths.trim()) {
somePathsExist = true;
}
state.svg.setAttribute("d", paths);
state.svg.setAttribute("fill", getClientColor(key));
}
@@ -293,17 +287,7 @@ export class LaserPathManager {
paths += ` ${this.draw(this.ownState.currentPath)}`;
}
paths = paths.trim();
if (paths) {
somePathsExist = true;
}
this.ownState.svg.setAttribute("d", paths);
this.ownState.svg.setAttribute("fill", "red");
if (!somePathsExist) {
this.isDrawing = false;
}
}
}

View File

@@ -155,7 +155,9 @@ const InteractiveCanvas = (props: InteractiveCanvasProps) => {
onPointerCancel={props.onPointerCancel}
onTouchMove={props.onTouchMove}
onPointerDown={props.onPointerDown}
onDoubleClick={props.onDoubleClick}
onDoubleClick={
props.appState.viewModeEnabled ? undefined : props.onDoubleClick
}
>
{t("labels.drawingCanvas")}
</canvas>

View File

@@ -1,6 +1,5 @@
{
"labels": {
"laser": "Toggle laser pointer",
"paste": "Paste",
"pasteAsPlaintext": "Paste as plaintext",
"pasteCharts": "Paste charts",

View File

@@ -1980,10 +1980,10 @@ ms@2.1.2:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nanoid@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35"
integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==
nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
neo-async@^2.6.2:
version "2.6.2"
@@ -2117,11 +2117,11 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==
postcss@^8.4.7:
version "8.4.8"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.8.tgz#dad963a76e82c081a0657d3a2f3602ce10c2e032"
integrity sha512-2tXEqGxrjvAO6U+CJzDL2Fk2kPHTv1jQsYkSoMeOis2SsYaXRO2COxTdQp99cYvif9JTXaAk9lYGc3VhJt7JPQ==
version "8.4.31"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d"
integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==
dependencies:
nanoid "^3.3.1"
nanoid "^3.3.6"
picocolors "^1.0.0"
source-map-js "^1.0.2"