Skip to content

Commit

Permalink
0.17.6-7, v2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed Oct 27, 2024
1 parent cbce41c commit edd276c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
7 changes: 5 additions & 2 deletions packages/excalidraw/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ import {
getMaxZoom,
hideFreedrawPenmodeCursor,
initializeObsidianUtils,
isTouchInPenMode,
} from "../obsidianUtils";
import {
hitElementBoundText,
Expand Down Expand Up @@ -5990,7 +5991,8 @@ class App extends React.Component<AppProps, AppState> {
isHoldingSpace ||
isPanning ||
isDraggingScrollBar ||
isHandToolActive(this.state)
isHandToolActive(this.state) ||
isTouchInPenMode(this.state, event) //zsviczian (single finger panning in pen mode)
) {
return;
}
Expand Down Expand Up @@ -7044,7 +7046,8 @@ class App extends React.Component<AppProps, AppState> {
(event.button === POINTER_BUTTON.WHEEL ||
(event.button === POINTER_BUTTON.MAIN && isHoldingSpace) ||
isHandToolActive(this.state) ||
//!isLastPointerActive added by zsviczian (but don't remember why....)
isTouchInPenMode(this.state, event) ||
//!isLaserPointerActive added by zsviczian (but don't remember why....)
(this.state.viewModeEnabled && !isLaserPointerActive(this.state)))
)
) {
Expand Down
9 changes: 9 additions & 0 deletions packages/excalidraw/obsidianUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NonDeletedExcalidrawElement } from "./element/types";
import { Fonts } from "./fonts";
import type { FontMetadata } from "./fonts/FontMetadata";
import { FONT_METADATA } from "./fonts/FontMetadata";
import { AppState } from "./types";

//zsviczian, my dirty little secrets. These are hacks I am not proud of...
export let hostPlugin: any = null;
Expand Down Expand Up @@ -146,4 +147,12 @@ export async function fetchFontFromVault(url: string | URL): Promise<ArrayBuffer
}
}
return;
}

//zsviczian (single finger panning in pen mode)
export function isTouchInPenMode(appState: AppState, event: React.PointerEvent<HTMLElement> | MouseEvent) {
const isReactPointerEvent = 'nativeEvent' in event;
return appState.penMode &&
(!isReactPointerEvent || (event.pointerType !== "pen")) &&
!["laser", "selection", "eraser", "hand"].includes(appState.activeTool.type);
}
2 changes: 1 addition & 1 deletion packages/excalidraw/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zsviczian/excalidraw",
"version": "0.17.6-6",
"version": "0.17.6-7",
"main": "main.js",
"types": "types/excalidraw/index.d.ts",
"files": [
Expand Down
18 changes: 1 addition & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9742,14 +9742,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -11062,15 +11055,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit edd276c

Please sign in to comment.