mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 15:53:26 -10:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95c1ab81f3 | ||
|
|
7ae7bda3d3 | ||
|
|
1648e33c1f | ||
|
|
8a38af5be7 | ||
|
|
7c870d9426 | ||
|
|
0882637801 | ||
|
|
9626c047a4 | ||
|
|
3e674c939b | ||
|
|
2a3f1a12a8 | ||
|
|
6ee0239b96 | ||
|
|
244b25708d | ||
|
|
a979ccd5bd | ||
|
|
fa27d53b98 | ||
|
|
cc465d6f2a | ||
|
|
21bf290013 | ||
|
|
684496109a | ||
|
|
f3faefd460 | ||
|
|
6fb6e83d68 | ||
|
|
ebbbb6bd1b | ||
|
|
03c33dc784 | ||
|
|
57ee2b00ca | ||
|
|
1158d93bb4 | ||
|
|
c1fa8ba8da | ||
|
|
f798b48b83 | ||
|
|
b286e89746 | ||
|
|
d753ce26f7 | ||
|
|
a72ac39059 | ||
|
|
1f05000238 | ||
|
|
b45cc312dd |
No files matched your search
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
[build]
|
# Keep `--cfg=web_sys_unstable_apis` here so the wasm wrapper crates build with the same web-sys API signatures (e.g. `put_image_data`/`get_image_data` taking `i32` rather than `f64`) on both native and the wasm target.
|
||||||
# Keep `--cfg=web_sys_unstable_apis` here so the wasm wrapper crates build with the same web-sys API signatures (e.g. `put_image_data`/`get_image_data` taking `i32` rather than `f64`) on both native test builds and the wasm target. Cargo applies `[build]` rustflags only when no target-specific rustflags table matches, so the wasm-specific list below must continue to include this cfg.
|
[target.'cfg(not(target_family = "wasm"))']
|
||||||
rustflags = ["--cfg=web_sys_unstable_apis"]
|
rustflags = ["--cfg=web_sys_unstable_apis"]
|
||||||
|
|
||||||
[target.wasm32-unknown-unknown]
|
[target.'cfg(target_family = "wasm")']
|
||||||
rustflags = [
|
rustflags = [
|
||||||
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
||||||
# The current simd implementation leads to undefined behavior
|
# The current simd implementation leads to undefined behavior
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"ghcr.io/devcontainers/features/node:1": {}
|
"ghcr.io/devcontainers/features/node:1": {}
|
||||||
},
|
},
|
||||||
"onCreateCommand": "cargo install cargo-watch wasm-pack cargo-about && cargo install -f [email protected]",
|
"onCreateCommand": "cargo install cargo-about && cargo install -f [email protected]",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
||||||
|
|||||||
+32
-14
@@ -58,6 +58,8 @@ jobs:
|
|||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
RUSTC_WRAPPER: /usr/bin/sccache
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -65,19 +67,11 @@ jobs:
|
|||||||
repository: ${{ inputs.checkout_repo || github.repository }}
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
ref: ${{ inputs.checkout_ref || '' }}
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
|
||||||
run: rm -r ~/.cache/.wasm-pack || true
|
|
||||||
|
|
||||||
- name: 🟢 Install Node.js
|
- name: 🟢 Install Node.js
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version-file: .nvmrc
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
- name: 🚧 Install build dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm run setup
|
|
||||||
|
|
||||||
- name: 🦀 Install Rust
|
- name: 🦀 Install Rust
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
@@ -87,6 +81,19 @@ jobs:
|
|||||||
rustflags: ""
|
rustflags: ""
|
||||||
target: wasm32-unknown-unknown
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 🚧 Install wasm-bindgen-cli and Binaryen wasm-opt
|
||||||
|
run: |
|
||||||
|
if ! wasm-bindgen --version 2>/dev/null | grep -qF "$WASM_BINDGEN_CLI_VERSION"; then
|
||||||
|
cargo install -f "wasm-bindgen-cli@$WASM_BINDGEN_CLI_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-x86_64-linux.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
- name: 🔀 Choose production deployment environment and insert template
|
- name: 🔀 Choose production deployment environment and insert template
|
||||||
id: production-env
|
id: production-env
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
@@ -294,6 +301,8 @@ jobs:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.0"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone repository
|
- name: 📥 Clone repository
|
||||||
@@ -341,14 +350,16 @@ jobs:
|
|||||||
winget install --id LLVM.LLVM -e --accept-package-agreements --accept-source-agreements
|
winget install --id LLVM.LLVM -e --accept-package-agreements --accept-source-agreements
|
||||||
winget install --id Kitware.CMake -e --accept-package-agreements --accept-source-agreements
|
winget install --id Kitware.CMake -e --accept-package-agreements --accept-source-agreements
|
||||||
winget install --id OpenSSL.OpenSSL -e --accept-package-agreements --accept-source-agreements
|
winget install --id OpenSSL.OpenSSL -e --accept-package-agreements --accept-source-agreements
|
||||||
winget install --id WebAssembly.Binaryen -e --accept-package-agreements --accept-source-agreements
|
|
||||||
winget install --id GnuWin32.PkgConfig -e --accept-package-agreements --accept-source-agreements
|
winget install --id GnuWin32.PkgConfig -e --accept-package-agreements --accept-source-agreements
|
||||||
|
|
||||||
"OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
|
"OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
"PKG_CONFIG_PATH=C:\Program Files\OpenSSL-Win64\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append
|
"PKG_CONFIG_PATH=C:\Program Files\OpenSSL-Win64\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
|
||||||
cargo binstall --no-confirm --force wasm-pack
|
curl.exe -sSfL -o "$env:RUNNER_TEMP\binaryen.tar.gz" "https://github.com/WebAssembly/binaryen/releases/download/version_$env:BINARYEN_VERSION/binaryen-version_$env:BINARYEN_VERSION-x86_64-windows.tar.gz"
|
||||||
cargo binstall --no-confirm --force cargo-about
|
tar -xzf "$env:RUNNER_TEMP\binaryen.tar.gz" -C $env:RUNNER_TEMP
|
||||||
|
"$env:RUNNER_TEMP\binaryen-version_$env:BINARYEN_VERSION\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@$env:CARGO_ABOUT_VERSION"
|
||||||
cargo binstall --no-confirm --force "wasm-bindgen-cli@$env:WASM_BINDGEN_CLI_VERSION"
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@$env:WASM_BINDGEN_CLI_VERSION"
|
||||||
|
|
||||||
- name: 🏗 Build Windows bundle
|
- name: 🏗 Build Windows bundle
|
||||||
@@ -485,6 +496,8 @@ jobs:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.0"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone repository
|
- name: 📥 Clone repository
|
||||||
@@ -529,7 +542,6 @@ jobs:
|
|||||||
brew install \
|
brew install \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
openssl@3 \
|
openssl@3 \
|
||||||
binaryen \
|
|
||||||
llvm \
|
llvm \
|
||||||
cargo-binstall
|
cargo-binstall
|
||||||
|
|
||||||
@@ -537,8 +549,14 @@ jobs:
|
|||||||
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> $GITHUB_ENV
|
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> $GITHUB_ENV
|
||||||
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
|
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
cargo binstall --no-confirm --force wasm-pack
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
cargo binstall --no-confirm --force cargo-about
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-arm64-macos.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@${CARGO_ABOUT_VERSION}"
|
||||||
cargo binstall --no-confirm --force "wasm-bindgen-cli@${WASM_BINDGEN_CLI_VERSION}"
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@${WASM_BINDGEN_CLI_VERSION}"
|
||||||
|
|
||||||
- name: 🏗 Build Mac bundle
|
- name: 🏗 Build Mac bundle
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ pkgs.mkShell (
|
|||||||
pkgs.nodejs
|
pkgs.nodejs
|
||||||
pkgs.binaryen
|
pkgs.binaryen
|
||||||
pkgs.wasm-bindgen-cli_0_2_121
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
pkgs.wasm-pack
|
|
||||||
pkgs.cargo-about
|
pkgs.cargo-about
|
||||||
|
|
||||||
pkgs.rustc
|
pkgs.rustc
|
||||||
@@ -41,7 +40,6 @@ pkgs.mkShell (
|
|||||||
|
|
||||||
pkgs.git
|
pkgs.git
|
||||||
|
|
||||||
pkgs.cargo-watch
|
|
||||||
pkgs.cargo-nextest
|
pkgs.cargo-nextest
|
||||||
pkgs.cargo-expand
|
pkgs.cargo-expand
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "147.0.14+g76d2442+chromium-147.0.7727.138";
|
version = "149.0.5+g6770623+chromium-149.0.7827.197";
|
||||||
hashes = {
|
hashes = {
|
||||||
aarch64-linux = "sha256-Gy2Xs1NHwmIr+buzoqDso1QJVkKlA/UMXytHjNGqpNk=";
|
aarch64-linux = "sha256-cBAvcvs1rAg5EKJkCt81RZYupCWpUNIC/nLt3PJow7Q=";
|
||||||
x86_64-linux = "sha256-os7wAFJ+mVK65HCikvEjhMeQUj2ty7y+6Ad0OlOcbeA=";
|
x86_64-linux = "sha256-OPGMBJmvvLiLdBDniBQwx7LmTGGI59AcesJdILSeqcs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
selectSystem =
|
selectSystem =
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ deps.crane.lib.buildPackage (
|
|||||||
pkgs.nodejs
|
pkgs.nodejs
|
||||||
pkgs.binaryen
|
pkgs.binaryen
|
||||||
pkgs.wasm-bindgen-cli_0_2_121
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
pkgs.wasm-pack
|
|
||||||
pkgs.cargo-about
|
pkgs.cargo-about
|
||||||
pkgs.removeReferencesTo
|
pkgs.removeReferencesTo
|
||||||
pkgs.importNpmLock.npmConfigHook
|
pkgs.importNpmLock.npmConfigHook
|
||||||
@@ -94,7 +93,6 @@ deps.crane.lib.buildPackage (
|
|||||||
npmRoot = "${info.src}/frontend";
|
npmRoot = "${info.src}/frontend";
|
||||||
};
|
};
|
||||||
npmRoot = "frontend";
|
npmRoot = "frontend";
|
||||||
npmConfigScript = "setup";
|
|
||||||
makeCacheWritable = true;
|
makeCacheWritable = true;
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
@@ -111,7 +109,7 @@ deps.crane.lib.buildPackage (
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
# Prevent `package-installer.js` from trying to update npm dependencies
|
# Prevent `cargo-run`'s frontend setup from trying to update npm dependencies
|
||||||
touch -r frontend/package-lock.json -d '+1 year' frontend/node_modules/.install-timestamp
|
touch -r frontend/package-lock.json -d '+1 year' frontend/node_modules/.install-timestamp
|
||||||
|
|
||||||
export HOME="$TMPDIR"
|
export HOME="$TMPDIR"
|
||||||
|
|||||||
Generated
+257
-128
@@ -209,9 +209,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-rs"
|
name = "aws-lc-rs"
|
||||||
version = "1.16.2"
|
version = "1.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a054912289d18629dc78375ba2c3726a3afe3ff71b4edba9dedfca0e3446d1fc"
|
checksum = "d9a7b350e3bb1767102698302bc37256cbd48422809984b98d292c40e2579aa9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-sys",
|
"aws-lc-sys",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -219,9 +219,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-sys"
|
name = "aws-lc-sys"
|
||||||
version = "0.39.0"
|
version = "0.37.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fa7e52a4c5c547c741610a2c6f123f3881e409b714cd27e6798ef020c514f0a"
|
checksum = "b092fe214090261288111db7a2b2c2118e5a7f30dc2569f1732c4069a6840549"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cmake",
|
"cmake",
|
||||||
@@ -354,7 +354,7 @@ version = "0.6.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
|
checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -421,9 +421,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.11.1"
|
version = "1.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
|
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bzip2"
|
name = "bzip2"
|
||||||
@@ -505,9 +505,31 @@ dependencies = [
|
|||||||
name = "cargo-run"
|
name = "cargo-run"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"duct",
|
||||||
|
"semver",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo-run-internal-download"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"cargo-run",
|
||||||
|
"flate2",
|
||||||
|
"sha2",
|
||||||
|
"tar",
|
||||||
|
"ureq",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo-run-internal-watch"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"cargo-run",
|
||||||
|
"notify",
|
||||||
|
"notify-debouncer-full",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo-util-schemas"
|
name = "cargo-util-schemas"
|
||||||
version = "0.8.2"
|
version = "0.8.2"
|
||||||
@@ -572,8 +594,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cef"
|
name = "cef"
|
||||||
version = "148.1.0+147.0.14"
|
version = "149.2.0+149.0.5"
|
||||||
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite#b36fbe355fdb0cb101295da4554dbb285f2d91f2"
|
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite-149#877c9cd8f7776e6c52e365d501ad44c73e17117a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ash",
|
"ash",
|
||||||
@@ -582,7 +604,7 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.9.0",
|
"libloading 0.9.0",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-io-surface",
|
"objc2-io-surface",
|
||||||
"objc2-metal 0.3.2",
|
"objc2-metal 0.3.2",
|
||||||
@@ -593,14 +615,14 @@ dependencies = [
|
|||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"windows 0.62.2",
|
"windows",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cef-dll-sys"
|
name = "cef-dll-sys"
|
||||||
version = "148.1.0+147.0.14"
|
version = "149.2.0+149.0.5"
|
||||||
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite#b36fbe355fdb0cb101295da4554dbb285f2d91f2"
|
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite-149#877c9cd8f7776e6c52e365d501ad44c73e17117a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cmake",
|
"cmake",
|
||||||
@@ -1120,9 +1142,9 @@ checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deranged"
|
name = "deranged"
|
||||||
version = "0.5.8"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
|
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
]
|
]
|
||||||
@@ -1201,7 +1223,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"option-ext",
|
"option-ext",
|
||||||
"redox_users",
|
"redox_users",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1213,7 +1235,7 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1296,7 +1318,7 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "download-cef"
|
name = "download-cef"
|
||||||
version = "2.3.2"
|
version = "2.3.2"
|
||||||
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite#b36fbe355fdb0cb101295da4554dbb285f2d91f2"
|
source = "git+https://github.com/timon-schelling/cef-rs.git?branch=graphite-149#877c9cd8f7776e6c52e365d501ad44c73e17117a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1335,6 +1357,18 @@ dependencies = [
|
|||||||
"dtoa",
|
"dtoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "duct"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e66e9c0c03d094e1a0ba1be130b849034aa80c3a2ab8ee94316bc809f3fa684"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"os_pipe",
|
||||||
|
"shared_child",
|
||||||
|
"shared_thread",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dunce"
|
name = "dunce"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
@@ -1440,7 +1474,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1514,6 +1548,15 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "file-id"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e1fc6a637b6dc58414714eddd9170ff187ecb0933d4c7024d1abbd23a3cc26e9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filetime"
|
name = "filetime"
|
||||||
version = "0.2.26"
|
version = "0.2.26"
|
||||||
@@ -1637,6 +1680,15 @@ version = "1.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fsevent-sys"
|
||||||
|
version = "4.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futf"
|
name = "futf"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@@ -1879,7 +1931,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"presser",
|
"presser",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"windows 0.62.2",
|
"windows",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1994,6 +2046,8 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
"document-container",
|
||||||
|
"document-format",
|
||||||
"fern",
|
"fern",
|
||||||
"futures",
|
"futures",
|
||||||
"graph-craft",
|
"graph-craft",
|
||||||
@@ -2142,7 +2196,7 @@ dependencies = [
|
|||||||
"interprocess",
|
"interprocess",
|
||||||
"lzma-rust2",
|
"lzma-rust2",
|
||||||
"muda",
|
"muda",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-app-kit 0.3.2",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"open",
|
"open",
|
||||||
@@ -2157,7 +2211,7 @@ dependencies = [
|
|||||||
"vello",
|
"vello",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"window_clipboard",
|
"window_clipboard",
|
||||||
"windows 0.58.0",
|
"windows",
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2241,6 +2295,7 @@ dependencies = [
|
|||||||
"js-sys",
|
"js-sys",
|
||||||
"kurbo",
|
"kurbo",
|
||||||
"log",
|
"log",
|
||||||
|
"math-parser",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"preprocessor",
|
"preprocessor",
|
||||||
@@ -2283,7 +2338,6 @@ dependencies = [
|
|||||||
"graphite-editor",
|
"graphite-editor",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"math-parser",
|
|
||||||
"node-macro",
|
"node-macro",
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -2795,6 +2849,26 @@ dependencies = [
|
|||||||
"rustversion",
|
"rustversion",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inotify"
|
||||||
|
version = "0.11.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "533e68a5842e734946fe159fb03fc9bbbb254f590dd0d8ad321ae5ff7beca2c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.0",
|
||||||
|
"inotify-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inotify-sys"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "interpreted-executor"
|
name = "interpreted-executor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -2990,6 +3064,26 @@ version = "3.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kqueue"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5"
|
||||||
|
dependencies = [
|
||||||
|
"kqueue-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kqueue-sys"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.0",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kurbo"
|
name = "kurbo"
|
||||||
version = "0.13.1"
|
version = "0.13.1"
|
||||||
@@ -3075,9 +3169,9 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linesweeper"
|
name = "linesweeper"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8421b276e96af0ace5f3d8d2d165d0dea07fe764d2fe94ec06bb1acaf8a1e759"
|
checksum = "9c19728333c060c6569a53c9a0e56c4be0df52cb4e6e07a8fbe16084cecce769"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"kurbo",
|
"kurbo",
|
||||||
@@ -3255,6 +3349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
|
"log",
|
||||||
"wasi 0.11.1+wasi-snapshot-preview1",
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
@@ -3282,7 +3377,7 @@ dependencies = [
|
|||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dpi",
|
"dpi",
|
||||||
"keyboard-types",
|
"keyboard-types",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-app-kit 0.3.2",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
@@ -3431,6 +3526,46 @@ dependencies = [
|
|||||||
"syn 2.0.106",
|
"syn 2.0.106",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify"
|
||||||
|
version = "8.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.0",
|
||||||
|
"fsevent-sys",
|
||||||
|
"inotify",
|
||||||
|
"kqueue",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"mio",
|
||||||
|
"notify-types",
|
||||||
|
"walkdir",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify-debouncer-full"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c02b49179cfebc9932238d04d6079912d26de0379328872846118a0fa0dbb302"
|
||||||
|
dependencies = [
|
||||||
|
"file-id",
|
||||||
|
"log",
|
||||||
|
"notify",
|
||||||
|
"notify-types",
|
||||||
|
"walkdir",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify-types"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.50.1"
|
version = "0.50.1"
|
||||||
@@ -3451,9 +3586,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-conv"
|
name = "num-conv"
|
||||||
version = "0.2.0"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
|
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-derive"
|
name = "num-derive"
|
||||||
@@ -3525,9 +3660,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2"
|
name = "objc2"
|
||||||
version = "0.6.4"
|
version = "0.6.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"
|
checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2-encode",
|
"objc2-encode",
|
||||||
]
|
]
|
||||||
@@ -3556,7 +3691,7 @@ checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
@@ -3582,7 +3717,7 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3646,7 +3781,7 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3658,7 +3793,7 @@ checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"libc",
|
"libc",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
@@ -3684,7 +3819,7 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-io-surface",
|
"objc2-io-surface",
|
||||||
@@ -3710,7 +3845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
|
checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-metal 0.3.2",
|
"objc2-metal 0.3.2",
|
||||||
@@ -3723,7 +3858,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"
|
checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
]
|
]
|
||||||
@@ -3805,6 +3940,16 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_pipe"
|
||||||
|
version = "1.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.45.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "owned_ttf_parser"
|
name = "owned_ttf_parser"
|
||||||
version = "0.25.1"
|
version = "0.25.1"
|
||||||
@@ -4362,7 +4507,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4500,7 +4645,7 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
|
checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-quartz-core 0.3.2",
|
"objc2-quartz-core 0.3.2",
|
||||||
@@ -4699,7 +4844,7 @@ dependencies = [
|
|||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-app-kit 0.3.2",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
@@ -4838,14 +4983,14 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.37"
|
version = "0.23.31"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4"
|
checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"log",
|
"log",
|
||||||
@@ -4906,7 +5051,7 @@ dependencies = [
|
|||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
"webpki-root-certs",
|
"webpki-root-certs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4917,9 +5062,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.10"
|
version = "0.103.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef"
|
checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"ring",
|
"ring",
|
||||||
@@ -5205,12 +5350,60 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shared_child"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"sigchld",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shared_thread"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52b86057fcb5423f5018e331ac04623e32d6b5ce85e33300f92c79a1973928b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shlex"
|
name = "shlex"
|
||||||
version = "1.3.0"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sigchld"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"os_pipe",
|
||||||
|
"signal-hook",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook"
|
||||||
|
version = "0.3.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"signal-hook-registry",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook-registry"
|
||||||
|
version = "1.4.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
||||||
|
dependencies = [
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simd-adler32"
|
name = "simd-adler32"
|
||||||
version = "0.3.7"
|
version = "0.3.7"
|
||||||
@@ -5591,7 +5784,7 @@ dependencies = [
|
|||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5702,30 +5895,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.47"
|
version = "0.3.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
|
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"itoa",
|
"itoa",
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
"serde_core",
|
"serde",
|
||||||
"time-core",
|
"time-core",
|
||||||
"time-macros",
|
"time-macros",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-core"
|
name = "time-core"
|
||||||
version = "0.1.8"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
|
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-macros"
|
name = "time-macros"
|
||||||
version = "0.2.27"
|
version = "0.2.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
|
checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"time-core",
|
"time-core",
|
||||||
@@ -6784,7 +6977,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"ndk-sys",
|
"ndk-sys",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-metal 0.3.2",
|
"objc2-metal 0.3.2",
|
||||||
@@ -6806,7 +6999,7 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-naga-bridge",
|
"wgpu-naga-bridge",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
"windows 0.62.2",
|
"windows",
|
||||||
"windows-core 0.62.2",
|
"windows-core 0.62.2",
|
||||||
"windows-result 0.4.1",
|
"windows-result 0.4.1",
|
||||||
]
|
]
|
||||||
@@ -6863,7 +7056,7 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22"
|
checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6886,16 +7079,6 @@ dependencies = [
|
|||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows"
|
|
||||||
version = "0.58.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
|
||||||
dependencies = [
|
|
||||||
"windows-core 0.58.0",
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.62.2"
|
version = "0.62.2"
|
||||||
@@ -6917,27 +7100,14 @@ dependencies = [
|
|||||||
"windows-core 0.62.2",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-core"
|
|
||||||
version = "0.58.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
|
||||||
dependencies = [
|
|
||||||
"windows-implement 0.58.0",
|
|
||||||
"windows-interface 0.58.0",
|
|
||||||
"windows-result 0.2.0",
|
|
||||||
"windows-strings 0.1.0",
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-core"
|
name = "windows-core"
|
||||||
version = "0.61.2"
|
version = "0.61.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement 0.60.2",
|
"windows-implement",
|
||||||
"windows-interface 0.59.3",
|
"windows-interface",
|
||||||
"windows-link 0.1.3",
|
"windows-link 0.1.3",
|
||||||
"windows-result 0.3.4",
|
"windows-result 0.3.4",
|
||||||
"windows-strings 0.4.2",
|
"windows-strings 0.4.2",
|
||||||
@@ -6949,8 +7119,8 @@ version = "0.62.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement 0.60.2",
|
"windows-implement",
|
||||||
"windows-interface 0.59.3",
|
"windows-interface",
|
||||||
"windows-link 0.2.1",
|
"windows-link 0.2.1",
|
||||||
"windows-result 0.4.1",
|
"windows-result 0.4.1",
|
||||||
"windows-strings 0.5.1",
|
"windows-strings 0.5.1",
|
||||||
@@ -6967,17 +7137,6 @@ dependencies = [
|
|||||||
"windows-threading",
|
"windows-threading",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-implement"
|
|
||||||
version = "0.58.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.106",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-implement"
|
name = "windows-implement"
|
||||||
version = "0.60.2"
|
version = "0.60.2"
|
||||||
@@ -6989,17 +7148,6 @@ dependencies = [
|
|||||||
"syn 2.0.106",
|
"syn 2.0.106",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-interface"
|
|
||||||
version = "0.58.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.106",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-interface"
|
name = "windows-interface"
|
||||||
version = "0.59.3"
|
version = "0.59.3"
|
||||||
@@ -7044,15 +7192,6 @@ dependencies = [
|
|||||||
"windows-strings 0.4.2",
|
"windows-strings 0.4.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-result"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-result"
|
name = "windows-result"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
@@ -7071,16 +7210,6 @@ dependencies = [
|
|||||||
"windows-link 0.2.1",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-strings"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
|
||||||
dependencies = [
|
|
||||||
"windows-result 0.2.0",
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-strings"
|
name = "windows-strings"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
@@ -7390,7 +7519,7 @@ dependencies = [
|
|||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"dpi",
|
"dpi",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-app-kit 0.3.2",
|
"objc2-app-kit 0.3.2",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-core-graphics",
|
"objc2-core-graphics",
|
||||||
@@ -7409,7 +7538,7 @@ version = "0.30.12"
|
|||||||
source = "git+https://github.com/rust-windowing/winit.git#bd6fef1d80ba063cbe91e150b3fb343927cdc72b"
|
source = "git+https://github.com/rust-windowing/winit.git#bd6fef1d80ba063cbe91e150b3fb343927cdc72b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memmap2 0.9.10",
|
"memmap2 0.9.10",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -7457,7 +7586,7 @@ dependencies = [
|
|||||||
"block2 0.6.2",
|
"block2 0.6.2",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"dpi",
|
"dpi",
|
||||||
"objc2 0.6.4",
|
"objc2 0.6.3",
|
||||||
"objc2-core-foundation",
|
"objc2-core-foundation",
|
||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit",
|
||||||
|
|||||||
+8
-7
@@ -7,8 +7,8 @@ members = [
|
|||||||
"desktop/platform/linux",
|
"desktop/platform/linux",
|
||||||
"desktop/platform/mac",
|
"desktop/platform/mac",
|
||||||
"desktop/platform/win",
|
"desktop/platform/win",
|
||||||
"document/container",
|
|
||||||
"document/graph-storage",
|
"document/graph-storage",
|
||||||
|
"document/container",
|
||||||
"document/document-format",
|
"document/document-format",
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wrapper",
|
"frontend/wrapper",
|
||||||
@@ -27,6 +27,7 @@ members = [
|
|||||||
"node-graph/preprocessor",
|
"node-graph/preprocessor",
|
||||||
"proc-macros",
|
"proc-macros",
|
||||||
"tools/cargo-run",
|
"tools/cargo-run",
|
||||||
|
"tools/cargo-run/internal/*",
|
||||||
"tools/crate-hierarchy-viz",
|
"tools/crate-hierarchy-viz",
|
||||||
"tools/third-party-licenses",
|
"tools/third-party-licenses",
|
||||||
"tools/editor-message-tree",
|
"tools/editor-message-tree",
|
||||||
@@ -106,6 +107,7 @@ rustc-hash = "2.0"
|
|||||||
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
rmp-serde = "1.3"
|
||||||
serde_bytes = "0.11"
|
serde_bytes = "0.11"
|
||||||
serde-wasm-bindgen = "0.6"
|
serde-wasm-bindgen = "0.6"
|
||||||
reqwest = { version = "0.13", features = ["blocking", "json"] }
|
reqwest = { version = "0.13", features = ["blocking", "json"] }
|
||||||
@@ -172,7 +174,6 @@ color = "0.3"
|
|||||||
# Linebender ecosystem (END)
|
# Linebender ecosystem (END)
|
||||||
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
||||||
rand_chacha = "0.9"
|
rand_chacha = "0.9"
|
||||||
rmp-serde = "1.3"
|
|
||||||
glam = { version = "0.32.1", default-features = false, features = [
|
glam = { version = "0.32.1", default-features = false, features = [
|
||||||
"nostd-libm",
|
"nostd-libm",
|
||||||
"scalar-math",
|
"scalar-math",
|
||||||
@@ -213,8 +214,8 @@ gungraun = { version = "0.18" }
|
|||||||
ndarray = "0.16"
|
ndarray = "0.16"
|
||||||
strum = { version = "0.27", features = ["derive"] }
|
strum = { version = "0.27", features = ["derive"] }
|
||||||
dirs = "6.0"
|
dirs = "6.0"
|
||||||
cef = "148"
|
cef = "149"
|
||||||
cef-dll-sys = "148"
|
cef-dll-sys = "149"
|
||||||
include_dir = "0.7"
|
include_dir = "0.7"
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
@@ -227,7 +228,7 @@ cargo-gpu-install = { version = "0.10.0-alpha.1", default-features = false }
|
|||||||
qrcodegen = "1.8"
|
qrcodegen = "1.8"
|
||||||
lzma-rust2 = { version = "0.16", default-features = false, features = ["std", "encoder", "optimization", "xz"] }
|
lzma-rust2 = { version = "0.16", default-features = false, features = ["std", "encoder", "optimization", "xz"] }
|
||||||
scraper = "0.25"
|
scraper = "0.25"
|
||||||
linesweeper = "0.3"
|
linesweeper = "0.4"
|
||||||
smallvec = "1.13.2"
|
smallvec = "1.13.2"
|
||||||
zip = { version = "8", default-features = false }
|
zip = { version = "8", default-features = false }
|
||||||
|
|
||||||
@@ -256,5 +257,5 @@ debug = true
|
|||||||
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
|
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
|
||||||
dpi = { git = "https://github.com/rust-windowing/winit.git" }
|
dpi = { git = "https://github.com/rust-windowing/winit.git" }
|
||||||
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
|
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
|
||||||
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
|
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-149" }
|
||||||
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
|
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-149" }
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[26023588519449590,{"inputs":[{"Node":{"node_id":4002029424845293600,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true},{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[0.09778450863315612,0.7264556766766779],"end":[0.09778450863315612,0.3634234796342139],"spread_method":"Pad"}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[213744308682803360,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::graphic::Graphic>"}},"exposed":true}},{"Node":{"node_id":10463288500489480000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[366962978353611840,{"inputs":[{"Node":{"node_id":8366826746721323000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[799182088624980700,{"inputs":[{"Node":{"node_id":7386572856931342000,"output_index":0}},{"Value":{"tagged_value":{"F64":100.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"math_nodes::DivideNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1250460246919467000,{"inputs":[{"Node":{"node_id":4742778578215475000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1789832635968548900,{"inputs":[{"Node":{"node_id":1924303400883620400,"output_index"Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[26023588519449590,{"inputs":[{"Node":{"node_id":4002029424845293600,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true},{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[9.606221358397944,-69.72678572415595],"end":[9.606221358397944,-162.2641409381776],"spread_method":"Pad","absolute":true,"transform":[1.0,0.0,0.0,1.0,0.0,0.0]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[213744308682803360,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::graphic::Graphic>"}},"exposed":true}},{"Node":{"node_id":10463288500489480000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[366962978353611840,{"inputs":[{"Node":{"node_id":8366826746721323000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[799182088624980700,{"inputs":[{"Node":{"node_id":7386572856931342000,"output_index":0}},{"Value":{"tagged_value":{"F64":100.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"math_nodes::DivideNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1250460246919467000,{"inputs":[{"Node":{"node_id":4742778578215475000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1789832635968548900,{"inputs":[{"NLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[57904581517036791,{"inputs":[{"Node":{"node_id":9393309733761233513,"output_index":0}},{"Node":{"node_id":15300421479077882117,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[70804263053697201,{"inputs":[{"Node":{"node_id":13942787566051910019,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[3.410605131648481e-13,3.410605131648481e-13]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1268.999999999999,634.9999999999992]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183952488591282082,{"inputs":[{"Node":{"node_id":17965270694495451178,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,-6.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exportsLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[57904581517036791,{"inputs":[{"Node":{"node_id":9393309733761233513,"output_index":0}},{"Node":{"node_id":15300421479077882117,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[70804263053697201,{"inputs":[{"Node":{"node_id":13942787566051910019,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[3.410605131648481e-13,3.410605131648481e-13]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1268.999999999999,634.9999999999992]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183952488591282082,{"inputs":[{"Node":{"node_id":17965270694495451178,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,-6.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exportsLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[57390435731316553,{"inputs":[{"Node":{"node_id":8460565235419043665,"output_index":0}},{"Node":{"node_id":13838011362258067867,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[140396870212231820,{"inputs":[{"Node":{"node_id":18095952297474762348,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Intersect"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[294265135510952894,{"inputs":[{"Node":{"node_id":11264395591110193456,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.83076996,"green":0.32314324,"blue":0.027320892,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.6938719,"green":0.048171822,"blue":0.028426038,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5],"spread_method":"Pad"}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[392274448837115448,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::artboard::Artboard>"}},"exposed":true}},{"Node":{"node_id":6787585796949551500,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1536.0,768.0]},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.8549927,"green":0.71569365,"blue":0.48514998,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":4}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":5}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::artboard::CreateArtboardNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"NoLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[57390435731316553,{"inputs":[{"Node":{"node_id":8460565235419043665,"output_index":0}},{"Node":{"node_id":13838011362258067867,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2"}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[140396870212231820,{"inputs":[{"Node":{"node_id":18095952297474762348,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Intersect"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[294265135510952894,{"inputs":[{"Node":{"node_id":11264395591110193456,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.83076996,"green":0.32314324,"blue":0.027320892,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.6938719,"green":0.048171822,"blue":0.028426038,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[-10.0,0.0],"end":[10.0,0.0],"spread_method":"Pad","absolute":true,"transform":[1.0,0.0,0.0,1.0,0.0,0.0]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[392274448837115448,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::artboard::Artboard>"}},"exposed":true}},{"Node":{"node_id":6787585796949551500,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1536.0,768.0]},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.8549927,"green":0.71569365,"blue":0.48514998,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":4}},{"Import":{"import_type":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}},"import_index":5}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::artboard::CreateArtboardNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_Line truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[239716716021064150,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::graphic::Graphic>"}},"exposed":true}},{"Node":{"node_id":7711570794020903773,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1801066723091712434,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"red":0.036889445,"green":0.038204364,"blue":0.043735027,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"F64":1744.31393592},"exposed":false}},{"Value":{"tagged_value":{"F64":63.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"red":0.9911022,"green":0.6514057,"blue":0.39157256,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5],"spread_method":"Pad"}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNodLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[239716716021064150,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<graphic_types::graphic::Graphic>"}},"exposed":true}},{"Node":{"node_id":7711570794020903773,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1801066723091712434,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"red":0.036889445,"green":0.038204364,"blue":0.043735027,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"F64":1744.31393592},"exposed":false}},{"Value":{"tagged_value":{"F64":63.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"red":0.9911022,"green":0.6514057,"blue":0.39157256,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5],"spread_method":"Pad","absolute":true,"transform":[1.0,0.0,0.0,1.0,0.0,0.0]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::contLine truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[169695252050218443,{"inputs":[{"Node":{"node_id":6559102076450693000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.75,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}]},"gradient_type":"Radial","start":[0.4915209831246563,0.36613756613756576],"end":[0.49551110871305326,0.9947089947089944],"spread_method":"Pad"}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.7734375,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}]},"gradient_type":"Radial","start":[0.4915209831246563,0.36613756613756576],"end":[0.49551110871305326,0.9947089947089944],"spread_method":"Pad"}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[655907162126315400,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11],"remove":[],"delta":[[1,[416.0,270.9999999999999]],[2,[587.0,291.9999999999999]],[3,[373.0,372.9999999999999]],[4,[484.0,446.9999999999999]],[5,[639.0,438.9999999999999]],[6,[495.0,533.9999999999999]],[7,[304.0,611.9999999999999]],[8,[475.0,671.9999999999999]],[9,[750.0,703.9999999999999]],[10,[455.0,824.9999999999999]],[11,[186.0,824.9999999999999]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10],[10,11]],"handle_primary":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]],[5,[0.0,0.0]],[6,[0.0,0.0]],[7,[0.0,0.0]],[8,[0.0,0.0]],[9,[0.0,0.0]],[10,[0.0,0.0]]],"handle_end":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]],[5,[0.0,0.Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[169695252050218443,{"inputs":[{"Node":{"node_id":6559102076450693000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.75,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}]},"gradient_type":"Radial","start":[-0.22577926355610423,34.981204988590605],"end":[-0.11953019835323353,66.53737705977504],"spread_method":"Pad","absolute":true,"transform":[0.0033669629737862325,-0.9999943317641021,0.9999943317641021,0.0033669629737862325,-35.2060257800042,34.63764658282962]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.7734375,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}]},"gradient_type":"Radial","start":[-0.22577926355610423,34.981204988590605],"end":[-0.11953019835323353,66.53737705977504],"spread_method":"Pad","absolute":true,"transform":[0.0033669629737862325,-0.9999943317641021,0.9999943317641021,0.0033669629737862325,-35.2060257800042,34.63764658282962]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[655907162126315400,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11],"remove":[],"delta":[[1,[416.0,270.9999999999999]],[2,[587.0,291.9999999999999]],[3,[373.0,372.9999999999999]],[4,[484.0,446.9999999999999]],[5,[639.0,438.9999999999999]],[6,[495.0,533.9999999999999]],[7,[304.0,611.9999999999999]],[8,[475.0,671.9999999999999]],[9,[750.0,703.9999999999999]],[10,[455.0,824.9999999999999]],[11,[186.0,824.9999999999999]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],"end_point":[[1,2Line truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[1378578509112405,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5],"remove":[],"delta":[[1,[602.6886145404666,50.91906721536352]],[2,[599.5281207133061,50.3923182441701]],[3,[590.4855967078191,66.80932784636488]],[4,[594.6410608139003,75.57872275567746]],[5,[593.3924706599604,60.59564090839812]]]},"segments":{"add":[1,2,3,4,5],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,1]],"handle_primary":[[1,[0.0,0.0]],[2,[-1.843621399176982,0.5267489711934203]],[3,[1.9314128943758533,7.3257125438195345]],[4,[0.0,0.0]],[5,[1.248590153939972,-3.9798811156835896]]],"handle_end":[[1,[1.843621399176982,-0.5267489711934203]],[2,[-2.7532629181224593,-10.4429315732828]],[3,[0.0,0.0]],[4,[-1.704168058538812,5.432035686592322]],[5,[-4.379820149367788,0.9754610577655498]]],"stroke":[[1,0],[2,0],[3,0],[4,0],[5,0]]},"regions":{"add":[0],"remove":[],"segment_range":[[0,{"start":1,"end":5}]],"fill":[[0,0]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[172538270105470471,{"inputs":[{"Node":{"node_id":9276497172451351253,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5],"spread_method":"Pad"}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[314278016428495768,{"inputs":[{"Node":{"node_id":6282972142629473139,"output_index":0}},{"Node":{"node_id":5020096817747898028,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedCoLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[1378578509112405,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5],"remove":[],"delta":[[1,[602.6886145404666,50.91906721536352]],[2,[599.5281207133061,50.3923182441701]],[3,[590.4855967078191,66.80932784636488]],[4,[594.6410608139003,75.57872275567746]],[5,[593.3924706599604,60.59564090839812]]]},"segments":{"add":[1,2,3,4,5],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,1]],"handle_primary":[[1,[0.0,0.0]],[2,[-1.843621399176982,0.5267489711934203]],[3,[1.9314128943758533,7.3257125438195345]],[4,[0.0,0.0]],[5,[1.248590153939972,-3.9798811156835896]]],"handle_end":[[1,[1.843621399176982,-0.5267489711934203]],[2,[-2.7532629181224593,-10.4429315732828]],[3,[0.0,0.0]],[4,[-1.704168058538812,5.432035686592322]],[5,[-4.379820149367788,0.9754610577655498]]],"stroke":[[1,0],[2,0],[3,0],[4,0],[5,0]]},"regions":{"add":[0],"remove":[],"segment_range":[[0,{"start":1,"end":5}]],"fill":[[0,0]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"core_types::list::List<vector_types::vector::vector_types::Vector>"}},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[172538270105470471,{"inputs":[{"Node":{"node_id":9276497172451351253,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"FillGradient":{"stops":{"position":[0.0,1.0],"midpoint":[0.5,0.5],"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}]},"gradient_type":"Linear","start":[604.9565968314213,108.54930650815423],"end":[607.1269623532997,108.54930650815423],"spread_method":"Pad","absolute":true,"transform":[1.0,0.0,0.0,1.0,0.0,0.0]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[314278016428495768,{"inputs":[{"Node":{"node_id":6282972142629473139,"output_index":0}},{"Node":{"node_id":5020096817747898028,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_indLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[74,{"inputs":[{"Node":{"node_id":75,"output_index":0}},{"Node":{"node_id":81,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[75,{"inputs":[{"Node":{"node_id":76,"output_index":0}},{"Node":{"node_id":161,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[74,{"inputs":[{"Node":{"node_id":75,"output_index":0}},{"Node":{"node_id":81,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[75,{"inputs":[{"Node":{"node_id":76,"output_index":0}},{"Node":{"node_id":161,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scLine truncated
|
||||||
+1
-1
@@ -55,7 +55,7 @@ window_clipboard = "0.5"
|
|||||||
|
|
||||||
# Windows-specific dependencies
|
# Windows-specific dependencies
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
windows = { version = "0.58.0", features = [
|
windows = { version = "0.62.2", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_Graphics_Dwm",
|
"Win32_Graphics_Dwm",
|
||||||
"Win32_Graphics_Gdi",
|
"Win32_Graphics_Gdi",
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
|
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
|
||||||
|
|
||||||
pub(super) async fn create_wgpu_context() -> WgpuContext {
|
pub(super) async fn create_wgpu_context() -> WgpuContext {
|
||||||
let wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::IMMEDIATES);
|
let mut wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::IMMEDIATES);
|
||||||
|
|
||||||
|
// TODO: make this configurable via cli flags instead
|
||||||
|
if let Some(index) = std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
|
||||||
|
tracing::info!("Overriding WGPU adapter selection with adapter index {index}");
|
||||||
|
wgpu_context_builder = wgpu_context_builder.with_selection(index);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: add a cli flag to list adapters and exit instead of always printing
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
|
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
|
||||||
|
|
||||||
// TODO: make this configurable via cli flags instead
|
let wgpu_context = wgpu_context_builder.build().await.expect("Failed to create WGPU context");
|
||||||
let wgpu_context = match std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
|
|
||||||
None => wgpu_context_builder.build().await,
|
|
||||||
Some(adapter_index) => {
|
|
||||||
tracing::info!("Overriding WGPU adapter selection with adapter index {adapter_index}");
|
|
||||||
wgpu_context_builder.build_with_adapter_selection(|_| Some(adapter_index)).await
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.expect("Failed to create WGPU context");
|
|
||||||
|
|
||||||
// TODO: add a cli flag to list adapters and exit instead of always printing
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
|
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ impl NativeWindowHandle {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
main,
|
Some(main),
|
||||||
|
None,
|
||||||
None,
|
None,
|
||||||
HINSTANCE(std::ptr::null_mut()),
|
|
||||||
// Pass the main window's HWND to WM_NCCREATE so the helper can store it.
|
// Pass the main window's HWND to WM_NCCREATE so the helper can store it.
|
||||||
Some(&main as *const _ as _),
|
Some(&main as *const _ as _),
|
||||||
)
|
)
|
||||||
@@ -103,18 +103,36 @@ impl NativeWindowHandle {
|
|||||||
};
|
};
|
||||||
let _ = unsafe { DwmExtendFrameIntoClientArea(main, &margins) };
|
let _ = unsafe { DwmExtendFrameIntoClientArea(main, &margins) };
|
||||||
|
|
||||||
let hinst = unsafe { GetModuleHandleW(None) }.unwrap();
|
let hinst: HINSTANCE = unsafe { GetModuleHandleW(None) }.unwrap().into();
|
||||||
|
|
||||||
// Set taskbar icon
|
// Set taskbar icon
|
||||||
if let Ok(big) = unsafe { LoadImageW(hinst, PCWSTR(1usize as *const u16), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_SHARED) } {
|
if let Ok(big) = unsafe {
|
||||||
|
LoadImageW(
|
||||||
|
Some(hinst),
|
||||||
|
PCWSTR(1usize as *const u16),
|
||||||
|
IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXICON),
|
||||||
|
GetSystemMetrics(SM_CYICON),
|
||||||
|
LR_SHARED,
|
||||||
|
)
|
||||||
|
} {
|
||||||
unsafe { SetClassLongPtrW(main, GCLP_HICON, big.0 as isize) };
|
unsafe { SetClassLongPtrW(main, GCLP_HICON, big.0 as isize) };
|
||||||
unsafe { SendMessageW(main, WM_SETICON, WPARAM(ICON_BIG as usize), LPARAM(big.0 as isize)) };
|
unsafe { SendMessageW(main, WM_SETICON, Some(WPARAM(ICON_BIG as usize)), Some(LPARAM(big.0 as isize))) };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set window icon
|
// Set window icon
|
||||||
if let Ok(small) = unsafe { LoadImageW(hinst, PCWSTR(1usize as *const u16), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) } {
|
if let Ok(small) = unsafe {
|
||||||
|
LoadImageW(
|
||||||
|
Some(hinst),
|
||||||
|
PCWSTR(1usize as *const u16),
|
||||||
|
IMAGE_ICON,
|
||||||
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
|
LR_SHARED,
|
||||||
|
)
|
||||||
|
} {
|
||||||
unsafe { SetClassLongPtrW(main, GCLP_HICONSM, small.0 as isize) };
|
unsafe { SetClassLongPtrW(main, GCLP_HICONSM, small.0 as isize) };
|
||||||
unsafe { SendMessageW(main, WM_SETICON, WPARAM(ICON_SMALL as usize), LPARAM(small.0 as isize)) };
|
unsafe { SendMessageW(main, WM_SETICON, Some(WPARAM(ICON_SMALL as usize)), Some(LPARAM(small.0 as isize))) };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force window update
|
// Force window update
|
||||||
@@ -197,7 +215,7 @@ unsafe fn ensure_helper_class() {
|
|||||||
lpfnWndProc: Some(helper_window_handle_message),
|
lpfnWndProc: Some(helper_window_handle_message),
|
||||||
hInstance: unsafe { GetModuleHandleW(None).unwrap().into() },
|
hInstance: unsafe { GetModuleHandleW(None).unwrap().into() },
|
||||||
hIcon: HICON::default(),
|
hIcon: HICON::default(),
|
||||||
hCursor: unsafe { LoadCursorW(HINSTANCE(std::ptr::null_mut()), IDC_ARROW).unwrap() },
|
hCursor: unsafe { LoadCursorW(None, IDC_ARROW).unwrap() },
|
||||||
// No painting; the ring is invisible.
|
// No painting; the ring is invisible.
|
||||||
hbrBackground: HBRUSH::default(),
|
hbrBackground: HBRUSH::default(),
|
||||||
lpszClassName: PCWSTR(class_name.as_ptr()),
|
lpszClassName: PCWSTR(class_name.as_ptr()),
|
||||||
@@ -292,7 +310,7 @@ unsafe extern "system" fn helper_window_handle_message(hwnd: HWND, msg: u32, wpa
|
|||||||
// Extract the main window's HWND from GWLP_USERDATA that we saved earlier.
|
// Extract the main window's HWND from GWLP_USERDATA that we saved earlier.
|
||||||
let main_ptr = unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) } as *mut std::ffi::c_void;
|
let main_ptr = unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) } as *mut std::ffi::c_void;
|
||||||
let main = HWND(main_ptr);
|
let main = HWND(main_ptr);
|
||||||
if unsafe { IsWindow(main).as_bool() } {
|
if unsafe { IsWindow(Some(main)).as_bool() } {
|
||||||
let Some(wmsz) = (unsafe { calculate_resize_direction(hwnd, lparam) }) else {
|
let Some(wmsz) = (unsafe { calculate_resize_direction(hwnd, lparam) }) else {
|
||||||
return LRESULT(0);
|
return LRESULT(0);
|
||||||
};
|
};
|
||||||
@@ -301,7 +319,7 @@ unsafe extern "system" fn helper_window_handle_message(hwnd: HWND, msg: u32, wpa
|
|||||||
let _ = unsafe { SetForegroundWindow(main) };
|
let _ = unsafe { SetForegroundWindow(main) };
|
||||||
|
|
||||||
// Start sizing on the main window in the calculated direction. (SC_SIZE + WMSZ_*)
|
// Start sizing on the main window in the calculated direction. (SC_SIZE + WMSZ_*)
|
||||||
let _ = unsafe { PostMessageW(main, WM_SYSCOMMAND, WPARAM((SC_SIZE + wmsz) as usize), lparam) };
|
let _ = unsafe { PostMessageW(Some(main), WM_SYSCOMMAND, WPARAM((SC_SIZE + wmsz) as usize), lparam) };
|
||||||
}
|
}
|
||||||
return LRESULT(0);
|
return LRESULT(0);
|
||||||
}
|
}
|
||||||
@@ -325,7 +343,7 @@ unsafe fn position_helper(main: HWND, helper: HWND) {
|
|||||||
let w = (r.right - r.left) + RESIZE_BAND_THICKNESS * 2;
|
let w = (r.right - r.left) + RESIZE_BAND_THICKNESS * 2;
|
||||||
let h = (r.bottom - r.top) + RESIZE_BAND_THICKNESS * 2;
|
let h = (r.bottom - r.top) + RESIZE_BAND_THICKNESS * 2;
|
||||||
|
|
||||||
let _ = unsafe { SetWindowPos(helper, main, x, y, w, h, SWP_NOACTIVATE | SWP_NOSENDCHANGING) };
|
let _ = unsafe { SetWindowPos(helper, Some(main), x, y, w, h, SWP_NOACTIVATE | SWP_NOSENDCHANGING) };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn calculate_hit(helper: HWND, lparam: LPARAM) -> u32 {
|
unsafe fn calculate_hit(helper: HWND, lparam: LPARAM) -> u32 {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
pub use graph_craft::application_io::resource::MmapResourceStorage;
|
pub use graph_craft::application_io::resource::MmapResourceStorage;
|
||||||
pub use graphite_editor::consts::{DOUBLE_CLICK_MILLISECONDS, FILE_EXTENSION};
|
pub use graphite_editor::consts::{DOUBLE_CLICK_MILLISECONDS, FILE_EXTENSION};
|
||||||
|
pub use wgpu_executor::WgpuBackends;
|
||||||
pub use wgpu_executor::WgpuContext;
|
pub use wgpu_executor::WgpuContext;
|
||||||
pub use wgpu_executor::WgpuContextBuilder;
|
pub use wgpu_executor::WgpuContextBuilder;
|
||||||
pub use wgpu_executor::WgpuExecutor;
|
pub use wgpu_executor::WgpuExecutor;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ graphene-hash = { workspace = true }
|
|||||||
interpreted-executor = { workspace = true }
|
interpreted-executor = { workspace = true }
|
||||||
graphene-std = { workspace = true } # NOTE: `core-types` should not be added here because `graphene-std` re-exports its contents
|
graphene-std = { workspace = true } # NOTE: `core-types` should not be added here because `graphene-std` re-exports its contents
|
||||||
preprocessor = { workspace = true }
|
preprocessor = { workspace = true }
|
||||||
|
math-parser = { workspace = true }
|
||||||
|
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
js-sys = { workspace = true }
|
js-sys = { workspace = true }
|
||||||
|
|||||||
+8
-136
@@ -186,7 +186,14 @@ impl Dispatcher {
|
|||||||
self.message_handlers.future_message_handler.process_message(message, &mut queue, FutureMessageContext {});
|
self.message_handlers.future_message_handler.process_message(message, &mut queue, FutureMessageContext {});
|
||||||
}
|
}
|
||||||
Message::Broadcast(message) => self.message_handlers.broadcast_message_handler.process_message(message, &mut queue, ()),
|
Message::Broadcast(message) => self.message_handlers.broadcast_message_handler.process_message(message, &mut queue, ()),
|
||||||
Message::Clipboard(message) => self.message_handlers.clipboard_message_handler.process_message(message, &mut queue, ()),
|
Message::Clipboard(message) => {
|
||||||
|
let context = ClipboardMessageContext {
|
||||||
|
portfolio: &mut self.message_handlers.portfolio_message_handler,
|
||||||
|
current_tool: &self.message_handlers.tool_message_handler.tool_state.tool_data.active_tool_type,
|
||||||
|
resource_storage: &self.message_handlers.resource_storage_message_handler,
|
||||||
|
};
|
||||||
|
self.message_handlers.clipboard_message_handler.process_message(message, &mut queue, context);
|
||||||
|
}
|
||||||
Message::ColorPicker(message) => self.message_handlers.color_picker_message_handler.process_message(message, &mut queue, ()),
|
Message::ColorPicker(message) => self.message_handlers.color_picker_message_handler.process_message(message, &mut queue, ()),
|
||||||
Message::Debug(message) => {
|
Message::Debug(message) => {
|
||||||
self.message_handlers.debug_message_handler.process_message(message, &mut queue, ());
|
self.message_handlers.debug_message_handler.process_message(message, &mut queue, ());
|
||||||
@@ -419,141 +426,6 @@ impl Dispatcher {
|
|||||||
mod test {
|
mod test {
|
||||||
pub use crate::test_utils::test_prelude::*;
|
pub use crate::test_utils::test_prelude::*;
|
||||||
|
|
||||||
/// Create an editor with three layers
|
|
||||||
/// 1. A red rectangle
|
|
||||||
/// 2. A blue shape
|
|
||||||
/// 3. A green ellipse
|
|
||||||
async fn create_editor_with_three_layers() -> EditorTestUtils {
|
|
||||||
let mut editor = EditorTestUtils::create();
|
|
||||||
|
|
||||||
editor.new_document().await;
|
|
||||||
|
|
||||||
editor.select_primary_color(Color::RED).await;
|
|
||||||
editor.draw_rect(100., 200., 300., 400.).await;
|
|
||||||
|
|
||||||
editor.select_primary_color(Color::BLUE).await;
|
|
||||||
editor.draw_polygon(10., 1200., 1300., 400.).await;
|
|
||||||
|
|
||||||
editor.select_primary_color(Color::GREEN).await;
|
|
||||||
editor.draw_ellipse(104., 1200., 1300., 400.).await;
|
|
||||||
|
|
||||||
editor
|
|
||||||
}
|
|
||||||
|
|
||||||
/// - create rect, shape and ellipse
|
|
||||||
/// - copy
|
|
||||||
/// - paste
|
|
||||||
/// - assert that ellipse was copied
|
|
||||||
#[tokio::test]
|
|
||||||
async fn copy_paste_single_layer() {
|
|
||||||
let mut editor = create_editor_with_three_layers().await;
|
|
||||||
|
|
||||||
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
editor.handle_message(PortfolioMessage::Copy { clipboard: Clipboard::Internal }).await;
|
|
||||||
editor
|
|
||||||
.handle_message(PortfolioMessage::PasteIntoFolder {
|
|
||||||
clipboard: Clipboard::Internal,
|
|
||||||
parent: LayerNodeIdentifier::ROOT_PARENT,
|
|
||||||
insert_index: 0,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
|
|
||||||
assert_eq!(layers_before_copy.len(), 3);
|
|
||||||
assert_eq!(layers_after_copy.len(), 4);
|
|
||||||
|
|
||||||
// Existing layers are unaffected
|
|
||||||
for i in 0..=2 {
|
|
||||||
assert_eq!(layers_before_copy[i], layers_after_copy[i + 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(miri, ignore)]
|
|
||||||
/// - create rect, shape and ellipse
|
|
||||||
/// - select shape
|
|
||||||
/// - copy
|
|
||||||
/// - paste
|
|
||||||
/// - assert that shape was copied
|
|
||||||
#[tokio::test]
|
|
||||||
async fn copy_paste_single_layer_from_middle() {
|
|
||||||
let mut editor = create_editor_with_three_layers().await;
|
|
||||||
|
|
||||||
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
let shape_id = editor.active_document().metadata().all_layers().nth(1).unwrap();
|
|
||||||
|
|
||||||
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![shape_id.to_node()] }).await;
|
|
||||||
editor.handle_message(PortfolioMessage::Copy { clipboard: Clipboard::Internal }).await;
|
|
||||||
editor
|
|
||||||
.handle_message(PortfolioMessage::PasteIntoFolder {
|
|
||||||
clipboard: Clipboard::Internal,
|
|
||||||
parent: LayerNodeIdentifier::ROOT_PARENT,
|
|
||||||
insert_index: 0,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
|
|
||||||
assert_eq!(layers_before_copy.len(), 3);
|
|
||||||
assert_eq!(layers_after_copy.len(), 4);
|
|
||||||
|
|
||||||
// Existing layers are unaffected
|
|
||||||
for i in 0..=2 {
|
|
||||||
assert_eq!(layers_before_copy[i], layers_after_copy[i + 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(miri, ignore)]
|
|
||||||
/// - create rect, shape and ellipse
|
|
||||||
/// - select ellipse and rect
|
|
||||||
/// - copy
|
|
||||||
/// - delete
|
|
||||||
/// - create another rect
|
|
||||||
/// - paste
|
|
||||||
/// - paste
|
|
||||||
#[tokio::test]
|
|
||||||
async fn copy_paste_deleted_layers() {
|
|
||||||
let mut editor = create_editor_with_three_layers().await;
|
|
||||||
assert_eq!(editor.active_document().metadata().all_layers().count(), 3);
|
|
||||||
|
|
||||||
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
let rect_id = layers_before_copy[0];
|
|
||||||
let shape_id = layers_before_copy[1];
|
|
||||||
let ellipse_id = layers_before_copy[2];
|
|
||||||
|
|
||||||
editor
|
|
||||||
.handle_message(NodeGraphMessage::SelectedNodesSet {
|
|
||||||
nodes: vec![rect_id.to_node(), ellipse_id.to_node()],
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
editor.handle_message(PortfolioMessage::Copy { clipboard: Clipboard::Internal }).await;
|
|
||||||
editor.handle_message(NodeGraphMessage::DeleteSelectedNodes { delete_children: true }).await;
|
|
||||||
editor.draw_rect(0., 800., 12., 200.).await;
|
|
||||||
editor
|
|
||||||
.handle_message(PortfolioMessage::PasteIntoFolder {
|
|
||||||
clipboard: Clipboard::Internal,
|
|
||||||
parent: LayerNodeIdentifier::ROOT_PARENT,
|
|
||||||
insert_index: 0,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
editor
|
|
||||||
.handle_message(PortfolioMessage::PasteIntoFolder {
|
|
||||||
clipboard: Clipboard::Internal,
|
|
||||||
parent: LayerNodeIdentifier::ROOT_PARENT,
|
|
||||||
insert_index: 0,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
|
||||||
|
|
||||||
assert_eq!(layers_before_copy.len(), 3);
|
|
||||||
assert_eq!(layers_after_copy.len(), 6);
|
|
||||||
|
|
||||||
println!("{layers_after_copy:?} {layers_before_copy:?}");
|
|
||||||
|
|
||||||
assert_eq!(layers_after_copy[5], shape_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
/// This test will fail when you make changes to the underlying serialization format for a document.
|
/// This test will fail when you make changes to the underlying serialization format for a document.
|
||||||
async fn check_if_demo_art_opens() {
|
async fn check_if_demo_art_opens() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::messages::clipboard::utility_types::{ClipboardContent, ClipboardContentRaw};
|
use crate::messages::clipboard::utility_types::{ClipboardContent, ClipboardContentRaw, ClipboardItem, ClipboardLayer, ClipboardVectorEntry};
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
|
||||||
#[impl_message(Message, Clipboard)]
|
#[impl_message(Message, Clipboard)]
|
||||||
@@ -10,4 +10,11 @@ pub enum ClipboardMessage {
|
|||||||
ReadClipboard { content: ClipboardContentRaw },
|
ReadClipboard { content: ClipboardContentRaw },
|
||||||
ReadSelection { content: Option<String>, cut: bool },
|
ReadSelection { content: Option<String>, cut: bool },
|
||||||
Write { content: ClipboardContent },
|
Write { content: ClipboardContent },
|
||||||
|
|
||||||
|
CopyLayers,
|
||||||
|
CutLayers,
|
||||||
|
WriteItems { items: Vec<ClipboardItem> },
|
||||||
|
PasteItems { data: String },
|
||||||
|
PasteLayers { entries: Vec<ClipboardLayer> },
|
||||||
|
PasteVectors { paths: Vec<ClipboardVectorEntry> },
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,58 @@
|
|||||||
use crate::messages::clipboard::utility_types::{ClipboardContent, ClipboardContentRaw};
|
use crate::consts::DEFAULT_STROKE_WIDTH;
|
||||||
|
use crate::messages::clipboard::utility_types::{ClipboardContent, ClipboardContentRaw, ClipboardItem, ClipboardLayer, ClipboardResource, ResourceData};
|
||||||
|
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
||||||
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
||||||
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
|
use crate::messages::portfolio::document::utility_types::network_interface;
|
||||||
|
use crate::messages::portfolio::document::utility_types::nodes::SelectedNodes;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
|
use crate::messages::tool::utility_types::ToolType;
|
||||||
|
use graph_craft::application_io::resource::{DataSource, ResourceHash};
|
||||||
|
use graph_craft::document::NodeId;
|
||||||
|
use graphene_std::Color;
|
||||||
use graphene_std::raster::Image;
|
use graphene_std::raster::Image;
|
||||||
|
use graphene_std::subpath::BezierHandles;
|
||||||
|
use graphene_std::vector::misc::HandleId;
|
||||||
|
use graphene_std::vector::{PointId, SegmentId, VectorModificationType};
|
||||||
use graphite_proc_macros::{ExtractField, message_handler_data};
|
use graphite_proc_macros::{ExtractField, message_handler_data};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
const CLIPBOARD_PREFIX_LAYER: &str = "graphite/layer: ";
|
const CLIPBOARD_PREFIX: &str = "graphite: ";
|
||||||
const CLIPBOARD_PREFIX_NODES: &str = "graphite/nodes: ";
|
|
||||||
const CLIPBOARD_PREFIX_VECTOR: &str = "graphite/vector: ";
|
#[derive(ExtractField)]
|
||||||
|
pub struct ClipboardMessageContext<'a> {
|
||||||
|
pub portfolio: &'a mut PortfolioMessageHandler,
|
||||||
|
pub current_tool: &'a ToolType,
|
||||||
|
pub resource_storage: &'a ResourceStorageMessageHandler,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, ExtractField)]
|
#[derive(Debug, Clone, Default, ExtractField)]
|
||||||
pub struct ClipboardMessageHandler {}
|
pub struct ClipboardMessageHandler {}
|
||||||
|
|
||||||
#[message_handler_data]
|
#[message_handler_data]
|
||||||
impl MessageHandler<ClipboardMessage, ()> for ClipboardMessageHandler {
|
impl MessageHandler<ClipboardMessage, ClipboardMessageContext<'_>> for ClipboardMessageHandler {
|
||||||
fn process_message(&mut self, message: ClipboardMessage, responses: &mut std::collections::VecDeque<Message>, _: ()) {
|
fn process_message(&mut self, message: ClipboardMessage, responses: &mut std::collections::VecDeque<Message>, context: ClipboardMessageContext) {
|
||||||
|
let ClipboardMessageContext {
|
||||||
|
portfolio,
|
||||||
|
current_tool,
|
||||||
|
resource_storage,
|
||||||
|
} = context;
|
||||||
|
|
||||||
match message {
|
match message {
|
||||||
ClipboardMessage::Cut => responses.add(FrontendMessage::TriggerSelectionRead { cut: true }),
|
ClipboardMessage::Cut => responses.add(FrontendMessage::TriggerSelectionRead { cut: true }),
|
||||||
ClipboardMessage::Copy => responses.add(FrontendMessage::TriggerSelectionRead { cut: false }),
|
ClipboardMessage::Copy => responses.add(FrontendMessage::TriggerSelectionRead { cut: false }),
|
||||||
ClipboardMessage::Paste => responses.add(FrontendMessage::TriggerClipboardRead),
|
ClipboardMessage::Paste => responses.add(FrontendMessage::TriggerClipboardRead),
|
||||||
ClipboardMessage::ReadClipboard { content } => match content {
|
ClipboardMessage::ReadClipboard { content } => match content {
|
||||||
ClipboardContentRaw::Text(text) => {
|
ClipboardContentRaw::Text(text) => {
|
||||||
if let Some(layer) = text.strip_prefix(CLIPBOARD_PREFIX_LAYER) {
|
if let Some(graphite) = text.strip_prefix(CLIPBOARD_PREFIX) {
|
||||||
responses.add(PortfolioMessage::PasteSerializedData { data: layer.to_string() });
|
responses.add(ClipboardMessage::PasteItems { data: graphite.to_string() });
|
||||||
} else if let Some(nodes) = text.strip_prefix(CLIPBOARD_PREFIX_NODES) {
|
|
||||||
responses.add(NodeGraphMessage::PasteNodes { serialized_nodes: nodes.to_string() });
|
|
||||||
} else if let Some(vector) = text.strip_prefix(CLIPBOARD_PREFIX_VECTOR) {
|
|
||||||
responses.add(PortfolioMessage::PasteSerializedVector { data: vector.to_string() });
|
|
||||||
} else {
|
} else {
|
||||||
responses.add(FrontendMessage::TriggerSelectionWrite { content: text });
|
responses.add(FrontendMessage::TriggerSelectionWrite { content: text });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClipboardContentRaw::Svg(svg) => {
|
ClipboardContentRaw::Svg(svg) => {
|
||||||
responses.add(PortfolioMessage::PasteSvg {
|
responses.add(PortfolioMessage::InsertSvg {
|
||||||
svg,
|
svg,
|
||||||
name: None,
|
name: None,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -38,7 +60,7 @@ impl MessageHandler<ClipboardMessage, ()> for ClipboardMessageHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
ClipboardContentRaw::Image { data, width, height } => {
|
ClipboardContentRaw::Image { data, width, height } => {
|
||||||
responses.add(PortfolioMessage::PasteImage {
|
responses.add(PortfolioMessage::InsertImage {
|
||||||
image: Image::from_image_data(&data, width, height),
|
image: Image::from_image_data(&data, width, height),
|
||||||
name: None,
|
name: None,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -47,15 +69,14 @@ impl MessageHandler<ClipboardMessage, ()> for ClipboardMessageHandler {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ClipboardMessage::ReadSelection { content, cut } => {
|
ClipboardMessage::ReadSelection { content, cut } => {
|
||||||
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
|
||||||
if let Some(text) = content {
|
if let Some(text) = content {
|
||||||
responses.add(ClipboardMessage::Write {
|
responses.add(ClipboardMessage::Write {
|
||||||
content: ClipboardContent::Text(text),
|
content: ClipboardContent::Text(text),
|
||||||
});
|
});
|
||||||
} else if cut {
|
} else if cut {
|
||||||
responses.add(PortfolioMessage::Cut { clipboard: Clipboard::Device });
|
responses.add(ClipboardMessage::CutLayers);
|
||||||
} else {
|
} else {
|
||||||
responses.add(PortfolioMessage::Copy { clipboard: Clipboard::Device });
|
responses.add(ClipboardMessage::CopyLayers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClipboardMessage::Write { content } => {
|
ClipboardMessage::Write { content } => {
|
||||||
@@ -68,13 +89,381 @@ impl MessageHandler<ClipboardMessage, ()> for ClipboardMessageHandler {
|
|||||||
log::error!("Image copying is not yet supported");
|
log::error!("Image copying is not yet supported");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ClipboardContent::Layer(layer) => format!("{CLIPBOARD_PREFIX_LAYER}{layer}"),
|
ClipboardContent::Graphite(graphite) => format!("{CLIPBOARD_PREFIX}{graphite}"),
|
||||||
ClipboardContent::Nodes(nodes) => format!("{CLIPBOARD_PREFIX_NODES}{nodes}"),
|
|
||||||
ClipboardContent::Vector(vector) => format!("{CLIPBOARD_PREFIX_VECTOR}{vector}"),
|
|
||||||
ClipboardContent::Text(text) => text,
|
ClipboardContent::Text(text) => text,
|
||||||
};
|
};
|
||||||
responses.add(FrontendMessage::TriggerClipboardWrite { content: text });
|
responses.add(FrontendMessage::TriggerClipboardWrite { content: text });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClipboardMessage::CopyLayers => {
|
||||||
|
if current_tool == &ToolType::Path {
|
||||||
|
responses.add(PathToolMessage::Copy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(active_document) = portfolio.active_document_id.and_then(|id| portfolio.documents.get_mut(&id)) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
if active_document.graph_view_overlay_open() {
|
||||||
|
responses.add(NodeGraphMessage::Copy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut buffer = Vec::new();
|
||||||
|
|
||||||
|
let mut ordered_last_elements = active_document.network_interface.shallowest_unique_layers(&[]).collect::<Vec<_>>();
|
||||||
|
ordered_last_elements.sort_by_key(|layer| {
|
||||||
|
let Some(parent) = layer.parent(active_document.metadata()) else { return usize::MAX };
|
||||||
|
DocumentMessageHandler::get_calculated_insert_index(active_document.metadata(), &SelectedNodes(vec![layer.to_node()]), parent)
|
||||||
|
});
|
||||||
|
|
||||||
|
for layer in ordered_last_elements.into_iter() {
|
||||||
|
let layer_node_id = layer.to_node();
|
||||||
|
|
||||||
|
let mut copy_ids = HashMap::new();
|
||||||
|
copy_ids.insert(layer_node_id, NodeId(0));
|
||||||
|
|
||||||
|
active_document
|
||||||
|
.network_interface
|
||||||
|
.upstream_flow_back_from_nodes(vec![layer_node_id], &[], network_interface::FlowType::LayerChildrenUpstreamFlow)
|
||||||
|
.enumerate()
|
||||||
|
.for_each(|(index, node_id)| {
|
||||||
|
copy_ids.insert(node_id, NodeId((index + 1) as u64));
|
||||||
|
});
|
||||||
|
|
||||||
|
// The layer panel keys collapse state on the top-down path of node IDs down to the layer
|
||||||
|
let mut tree_path = layer
|
||||||
|
.ancestors(active_document.metadata())
|
||||||
|
.filter(|ancestor| *ancestor != LayerNodeIdentifier::ROOT_PARENT)
|
||||||
|
.map(|ancestor| ancestor.to_node())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
tree_path.reverse();
|
||||||
|
|
||||||
|
buffer.push(ClipboardLayer {
|
||||||
|
nodes: active_document.network_interface.copy_nodes(©_ids, &[]).collect(),
|
||||||
|
visible: active_document.network_interface.selected_nodes().layer_visible(layer, &active_document.network_interface),
|
||||||
|
locked: active_document.network_interface.selected_nodes().layer_locked(layer, &active_document.network_interface),
|
||||||
|
collapsed: active_document.collapsed.0.contains(&tree_path),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.add(ClipboardMessage::WriteItems {
|
||||||
|
items: buffer.into_iter().map(ClipboardItem::Layer).collect(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ClipboardMessage::CutLayers => {
|
||||||
|
if current_tool == &ToolType::Path {
|
||||||
|
responses.add(PathToolMessage::Cut);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(active_document) = portfolio.active_document()
|
||||||
|
&& active_document.graph_view_overlay_open()
|
||||||
|
{
|
||||||
|
responses.add(NodeGraphMessage::Cut);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.add(ClipboardMessage::CopyLayers);
|
||||||
|
responses.add(DocumentMessage::DeleteSelectedLayers);
|
||||||
|
}
|
||||||
|
ClipboardMessage::WriteItems { items } => {
|
||||||
|
let has_content = items.iter().any(|item| match item {
|
||||||
|
ClipboardItem::Layer(entry) => !entry.nodes.is_empty(),
|
||||||
|
ClipboardItem::Nodes(nodes) => !nodes.is_empty(),
|
||||||
|
ClipboardItem::Vector(vector) => !vector.is_empty(),
|
||||||
|
ClipboardItem::Resource(_) => true,
|
||||||
|
});
|
||||||
|
if !has_content {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut resource_ids = HashSet::new();
|
||||||
|
for item in &items {
|
||||||
|
match item {
|
||||||
|
ClipboardItem::Layer(entry) => entry
|
||||||
|
.nodes
|
||||||
|
.iter()
|
||||||
|
.for_each(|(_, template)| network_interface::collect_node_resources(&template.document_node, &mut resource_ids)),
|
||||||
|
ClipboardItem::Nodes(nodes) => nodes
|
||||||
|
.iter()
|
||||||
|
.for_each(|(_, template)| network_interface::collect_node_resources(&template.document_node, &mut resource_ids)),
|
||||||
|
ClipboardItem::Vector(_) | ClipboardItem::Resource(_) => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snapshot each resource's registry entry; embedded ones also need their bytes
|
||||||
|
let mut resources = Vec::new();
|
||||||
|
let mut bytes_to_load = Vec::new();
|
||||||
|
if let Some(document) = portfolio.active_document() {
|
||||||
|
for id in resource_ids {
|
||||||
|
let Some(info) = document.resources.registry.info(&id) else { continue };
|
||||||
|
if let Some(hash) = info.hash
|
||||||
|
&& info.sources.contains(&DataSource::Embedded)
|
||||||
|
{
|
||||||
|
bytes_to_load.push((resources.len(), *hash));
|
||||||
|
}
|
||||||
|
resources.push(ClipboardResource {
|
||||||
|
id,
|
||||||
|
hash: info.hash.copied(),
|
||||||
|
sources: info.sources.to_vec(),
|
||||||
|
data: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if bytes_to_load.is_empty() {
|
||||||
|
let mut items = items;
|
||||||
|
items.extend(resources.into_iter().map(ClipboardItem::Resource));
|
||||||
|
if let Some(content) = serialize_clipboard(&items) {
|
||||||
|
responses.add(ClipboardMessage::Write { content });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Load the embedded bytes from the resource storage, then write
|
||||||
|
let load_handle = resource_storage.resources();
|
||||||
|
responses.add(async move {
|
||||||
|
let mut resources = resources;
|
||||||
|
for (index, hash) in bytes_to_load {
|
||||||
|
if let Some(resource) = load_handle.load(hash).await {
|
||||||
|
resources[index].data = Some(ResourceData(resource.as_ref().to_vec()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut items = items;
|
||||||
|
items.extend(resources.into_iter().map(ClipboardItem::Resource));
|
||||||
|
match serialize_clipboard(&items) {
|
||||||
|
Some(content) => ClipboardMessage::Write { content }.into(),
|
||||||
|
None => Message::NoOp,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ClipboardMessage::PasteItems { data } => {
|
||||||
|
let items = match serde_json::from_str::<Vec<ClipboardItem>>(&data) {
|
||||||
|
Ok(items) => items,
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("Failed to deserialize clipboard payload: {error}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut layers = Vec::new();
|
||||||
|
let mut node_groups = Vec::new();
|
||||||
|
let mut vectors = Vec::new();
|
||||||
|
let mut resources = Vec::new();
|
||||||
|
for item in items {
|
||||||
|
match item {
|
||||||
|
ClipboardItem::Layer(entry) => layers.push(entry),
|
||||||
|
ClipboardItem::Nodes(nodes) => node_groups.push(nodes),
|
||||||
|
ClipboardItem::Vector(vector) => vectors.push(vector),
|
||||||
|
ClipboardItem::Resource(resource) => resources.push(resource),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-register the carried resources and store their bytes
|
||||||
|
let mut needs_resolve = false;
|
||||||
|
if !resources.is_empty()
|
||||||
|
&& let Some(document) = portfolio.active_document_mut()
|
||||||
|
{
|
||||||
|
for resource in resources {
|
||||||
|
if document.resources.registry.contains(&resource.id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for source in resource.sources {
|
||||||
|
document.resources.registry.push_source_back(&resource.id, source);
|
||||||
|
}
|
||||||
|
match resource.data {
|
||||||
|
Some(data) => match resource.hash {
|
||||||
|
Some(hash) if ResourceHash::from(data.0.as_slice()) == hash => {
|
||||||
|
document.resources.registry.resolve(&resource.id, hash);
|
||||||
|
responses.add(ResourceStorageMessage::Store { data: Arc::from(data.0) });
|
||||||
|
}
|
||||||
|
_ => warn!("Discarding pasted resource {:?}: embedded bytes do not match its advertised hash", resource.id),
|
||||||
|
},
|
||||||
|
None => needs_resolve = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paste the content through the existing per-type handlers
|
||||||
|
if !layers.is_empty() {
|
||||||
|
responses.add(ClipboardMessage::PasteLayers { entries: layers });
|
||||||
|
}
|
||||||
|
for nodes in node_groups {
|
||||||
|
responses.add(NodeGraphMessage::InsertNodes { nodes });
|
||||||
|
}
|
||||||
|
for paths in vectors {
|
||||||
|
responses.add(ClipboardMessage::PasteVectors { paths });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-resolve resources that carried no bytes (URL- or font-backed)
|
||||||
|
if needs_resolve && let Some(document_id) = portfolio.active_document_id {
|
||||||
|
responses.add(PortfolioMessage::ResolveDocumentResources { document_id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ClipboardMessage::PasteLayers { entries } => {
|
||||||
|
if let Some(document) = portfolio.active_document() {
|
||||||
|
let parent = document.new_layer_parent(false);
|
||||||
|
|
||||||
|
// Top-down node ID path of the destination parent, used to derive each pasted layer's collapse path
|
||||||
|
let mut parent_tree_path = parent
|
||||||
|
.ancestors(document.metadata())
|
||||||
|
.filter(|ancestor| *ancestor != LayerNodeIdentifier::ROOT_PARENT)
|
||||||
|
.map(|ancestor| ancestor.to_node())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
parent_tree_path.reverse();
|
||||||
|
|
||||||
|
let mut all_new_ids = Vec::new();
|
||||||
|
let mut layers = Vec::new();
|
||||||
|
|
||||||
|
let mut added_nodes = false;
|
||||||
|
|
||||||
|
for entry in entries.into_iter().rev() {
|
||||||
|
let new_ids: HashMap<_, _> = entry.nodes.iter().map(|(id, _)| (*id, NodeId::new())).collect();
|
||||||
|
let Some(&root_id) = new_ids.get(&NodeId(0)) else {
|
||||||
|
warn!("Skipping pasted layer missing its root node");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let layer = LayerNodeIdentifier::new_unchecked(root_id);
|
||||||
|
|
||||||
|
if !added_nodes {
|
||||||
|
responses.add(DocumentMessage::DeselectAllLayers);
|
||||||
|
responses.add(DocumentMessage::AddTransaction);
|
||||||
|
added_nodes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
all_new_ids.extend(new_ids.values().copied());
|
||||||
|
|
||||||
|
responses.add(NodeGraphMessage::AddNodes { nodes: entry.nodes, new_ids });
|
||||||
|
responses.add(NodeGraphMessage::MoveLayerToStack { layer, parent, insert_index: 0 });
|
||||||
|
|
||||||
|
// Restore the copied layer's visibility, lock, and collapse state
|
||||||
|
if !entry.visible {
|
||||||
|
responses.add(NodeGraphMessage::SetVisibility {
|
||||||
|
node_id: root_id,
|
||||||
|
network_path: Vec::new(),
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if entry.locked {
|
||||||
|
responses.add(NodeGraphMessage::SetLocked {
|
||||||
|
node_id: root_id,
|
||||||
|
network_path: Vec::new(),
|
||||||
|
locked: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if entry.collapsed {
|
||||||
|
let mut tree_path = parent_tree_path.clone();
|
||||||
|
tree_path.push(root_id);
|
||||||
|
responses.add(DocumentMessage::ToggleLayerExpansion { tree_path, recursive: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
layers.push(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
|
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: all_new_ids });
|
||||||
|
responses.add(DeferMessage::AfterGraphRun {
|
||||||
|
messages: vec![PortfolioMessage::CenterLayers { layers }.into()],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ClipboardMessage::PasteVectors { paths } => {
|
||||||
|
// If using Path tool then send the operation to Path tool
|
||||||
|
// TODO: Consider if this is actually the correct place to put this logic
|
||||||
|
// TODO: Consider making paste in general go through the current tool, so that the tool can decide what to do
|
||||||
|
if *current_tool == ToolType::Path {
|
||||||
|
responses.add(PathToolMessage::Paste { paths });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not using Path tool, create new layers and add paths into those
|
||||||
|
if let Some(document) = portfolio.active_document() {
|
||||||
|
let mut layers = Vec::new();
|
||||||
|
|
||||||
|
for (_, new_vector, transform) in paths {
|
||||||
|
let Some(node_type) = resolve_network_node_type("Path") else {
|
||||||
|
error!("Path node does not exist");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let nodes = vec![(NodeId(0), node_type.default_node_template())];
|
||||||
|
|
||||||
|
let parent = document.new_layer_parent(false);
|
||||||
|
|
||||||
|
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||||
|
layers.push(layer);
|
||||||
|
|
||||||
|
// Adding the transform back into the layer
|
||||||
|
responses.add(GraphOperationMessage::TransformSet {
|
||||||
|
layer,
|
||||||
|
transform,
|
||||||
|
transform_in: TransformIn::Local,
|
||||||
|
skip_rerender: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add default fill and stroke to the layer
|
||||||
|
let fill = graphene_std::vector::style::Fill::solid(Color::WHITE);
|
||||||
|
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
||||||
|
|
||||||
|
let stroke = graphene_std::vector::style::Stroke::new(Some(Color::BLACK), DEFAULT_STROKE_WIDTH);
|
||||||
|
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
|
||||||
|
|
||||||
|
// Create new point ids and add those into the existing Vector path
|
||||||
|
let mut points_map = HashMap::new();
|
||||||
|
for (point, position) in new_vector.point_domain.iter() {
|
||||||
|
let new_point_id = PointId::generate();
|
||||||
|
points_map.insert(point, new_point_id);
|
||||||
|
let modification_type = VectorModificationType::InsertPoint { id: new_point_id, position };
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new segment ids and add the segments into the existing Vector path
|
||||||
|
let mut segments_map = HashMap::new();
|
||||||
|
for (segment_id, bezier, start, end) in new_vector.segment_bezier_iter() {
|
||||||
|
let (Some(&start_point), Some(&end_point)) = (points_map.get(&start), points_map.get(&end)) else {
|
||||||
|
warn!("Skipping pasted vector segment with an unknown endpoint");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
let new_segment_id = SegmentId::generate();
|
||||||
|
segments_map.insert(segment_id, new_segment_id);
|
||||||
|
|
||||||
|
let handles = match bezier.handles {
|
||||||
|
BezierHandles::Linear => [None, None],
|
||||||
|
BezierHandles::Quadratic { handle } => [Some(handle - bezier.start), None],
|
||||||
|
BezierHandles::Cubic { handle_start, handle_end } => [Some(handle_start - bezier.start), Some(handle_end - bezier.end)],
|
||||||
|
};
|
||||||
|
|
||||||
|
let points = [start_point, end_point];
|
||||||
|
let modification_type = VectorModificationType::InsertSegment { id: new_segment_id, points, handles };
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set G1 continuity
|
||||||
|
for handles in new_vector.colinear_manipulators {
|
||||||
|
let to_new_handle = |handle: HandleId| -> Option<HandleId> {
|
||||||
|
Some(HandleId {
|
||||||
|
ty: handle.ty,
|
||||||
|
segment: *segments_map.get(&handle.segment)?,
|
||||||
|
})
|
||||||
|
};
|
||||||
|
let (Some(first), Some(second)) = (to_new_handle(handles[0]), to_new_handle(handles[1])) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let modification_type = VectorModificationType::SetG1Continuous {
|
||||||
|
handles: [first, second],
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
|
responses.add(Message::Defer(DeferMessage::AfterGraphRun {
|
||||||
|
messages: vec![PortfolioMessage::CenterLayers { layers }.into()],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
advertise_actions!(ClipboardMessageDiscriminant;
|
advertise_actions!(ClipboardMessageDiscriminant;
|
||||||
@@ -83,3 +472,183 @@ impl MessageHandler<ClipboardMessage, ()> for ClipboardMessageHandler {
|
|||||||
Paste,
|
Paste,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Serialize the clipboard items, logging on failure.
|
||||||
|
fn serialize_clipboard(items: &[ClipboardItem]) -> Option<ClipboardContent> {
|
||||||
|
match serde_json::to_string(items) {
|
||||||
|
Ok(data) => Some(ClipboardContent::Graphite(data)),
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("Failed to serialize clipboard payload: {error}");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::messages::clipboard::utility_types::{ClipboardItem, ClipboardResource, ResourceData};
|
||||||
|
use crate::test_utils::test_prelude::*;
|
||||||
|
use graph_craft::application_io::resource::{DataSource, ResourceHash, ResourceId};
|
||||||
|
|
||||||
|
/// Create an editor with three layers
|
||||||
|
/// 1. A red rectangle
|
||||||
|
/// 2. A blue shape
|
||||||
|
/// 3. A green ellipse
|
||||||
|
async fn create_editor_with_three_layers() -> EditorTestUtils {
|
||||||
|
let mut editor = EditorTestUtils::create();
|
||||||
|
|
||||||
|
editor.new_document().await;
|
||||||
|
|
||||||
|
editor.select_primary_color(Color::RED).await;
|
||||||
|
editor.draw_rect(100., 200., 300., 400.).await;
|
||||||
|
|
||||||
|
editor.select_primary_color(Color::BLUE).await;
|
||||||
|
editor.draw_polygon(10., 1200., 1300., 400.).await;
|
||||||
|
|
||||||
|
editor.select_primary_color(Color::GREEN).await;
|
||||||
|
editor.draw_ellipse(104., 1200., 1300., 400.).await;
|
||||||
|
|
||||||
|
editor
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Copies the layer selection and returns the written clipboard payload.
|
||||||
|
async fn copy_layers_to_clipboard(editor: &mut EditorTestUtils) -> String {
|
||||||
|
editor
|
||||||
|
.handle_message(ClipboardMessage::CopyLayers)
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.find_map(|message| match message {
|
||||||
|
FrontendMessage::TriggerClipboardWrite { content } => Some(content),
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.expect("copying layers should write a payload to the clipboard")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pastes a clipboard string as if read from the system clipboard.
|
||||||
|
async fn paste_from_clipboard(editor: &mut EditorTestUtils, clipboard: &str) {
|
||||||
|
editor
|
||||||
|
.handle_message(ClipboardMessage::ReadClipboard {
|
||||||
|
content: ClipboardContentRaw::Text(clipboard.to_string()),
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// - create rect, shape and ellipse
|
||||||
|
/// - copy
|
||||||
|
/// - paste
|
||||||
|
/// - assert that ellipse was copied
|
||||||
|
#[tokio::test]
|
||||||
|
async fn copy_paste_single_layer() {
|
||||||
|
let mut editor = create_editor_with_three_layers().await;
|
||||||
|
|
||||||
|
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
let clipboard = copy_layers_to_clipboard(&mut editor).await;
|
||||||
|
paste_from_clipboard(&mut editor, &clipboard).await;
|
||||||
|
|
||||||
|
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
|
||||||
|
assert_eq!(layers_before_copy.len(), 3);
|
||||||
|
assert_eq!(layers_after_copy.len(), 4);
|
||||||
|
|
||||||
|
// Existing layers are unaffected
|
||||||
|
for i in 0..=2 {
|
||||||
|
assert_eq!(layers_before_copy[i], layers_after_copy[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(miri, ignore)]
|
||||||
|
/// - create rect, shape and ellipse
|
||||||
|
/// - select shape
|
||||||
|
/// - copy
|
||||||
|
/// - paste
|
||||||
|
/// - assert that shape was copied
|
||||||
|
#[tokio::test]
|
||||||
|
async fn copy_paste_single_layer_from_middle() {
|
||||||
|
let mut editor = create_editor_with_three_layers().await;
|
||||||
|
|
||||||
|
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
let shape_id = editor.active_document().metadata().all_layers().nth(1).unwrap();
|
||||||
|
|
||||||
|
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![shape_id.to_node()] }).await;
|
||||||
|
let clipboard = copy_layers_to_clipboard(&mut editor).await;
|
||||||
|
paste_from_clipboard(&mut editor, &clipboard).await;
|
||||||
|
|
||||||
|
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
|
||||||
|
assert_eq!(layers_before_copy.len(), 3);
|
||||||
|
assert_eq!(layers_after_copy.len(), 4);
|
||||||
|
|
||||||
|
// Existing layers are unaffected
|
||||||
|
for i in 0..=2 {
|
||||||
|
assert_eq!(layers_before_copy[i], layers_after_copy[i + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(miri, ignore)]
|
||||||
|
/// - create rect, shape and ellipse
|
||||||
|
/// - select ellipse and rect
|
||||||
|
/// - copy
|
||||||
|
/// - delete
|
||||||
|
/// - create another rect
|
||||||
|
/// - paste
|
||||||
|
/// - paste
|
||||||
|
#[tokio::test]
|
||||||
|
async fn copy_paste_deleted_layers() {
|
||||||
|
let mut editor = create_editor_with_three_layers().await;
|
||||||
|
assert_eq!(editor.active_document().metadata().all_layers().count(), 3);
|
||||||
|
|
||||||
|
let layers_before_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
let rect_id = layers_before_copy[0];
|
||||||
|
let shape_id = layers_before_copy[1];
|
||||||
|
let ellipse_id = layers_before_copy[2];
|
||||||
|
|
||||||
|
editor
|
||||||
|
.handle_message(NodeGraphMessage::SelectedNodesSet {
|
||||||
|
nodes: vec![rect_id.to_node(), ellipse_id.to_node()],
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
let clipboard = copy_layers_to_clipboard(&mut editor).await;
|
||||||
|
editor.handle_message(NodeGraphMessage::DeleteSelectedNodes { delete_children: true }).await;
|
||||||
|
editor.draw_rect(0., 800., 12., 200.).await;
|
||||||
|
paste_from_clipboard(&mut editor, &clipboard).await;
|
||||||
|
paste_from_clipboard(&mut editor, &clipboard).await;
|
||||||
|
|
||||||
|
let layers_after_copy = editor.active_document().metadata().all_layers().collect::<Vec<_>>();
|
||||||
|
|
||||||
|
assert_eq!(layers_before_copy.len(), 3);
|
||||||
|
assert_eq!(layers_after_copy.len(), 6);
|
||||||
|
|
||||||
|
assert_eq!(layers_after_copy[5], shape_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A pasted `graphite:` payload re-registers the resources it carries into the active document.
|
||||||
|
#[tokio::test]
|
||||||
|
async fn paste_carries_embedded_resource() {
|
||||||
|
let mut editor = EditorTestUtils::create();
|
||||||
|
editor.new_document().await;
|
||||||
|
|
||||||
|
let id = ResourceId::new();
|
||||||
|
assert!(!editor.active_document().resources.registry.contains(&id));
|
||||||
|
|
||||||
|
// Carry the resource and its bytes through the clipboard
|
||||||
|
let bytes = b"a pretend png".to_vec();
|
||||||
|
let hash = ResourceHash::from(bytes.as_slice());
|
||||||
|
let items = vec![ClipboardItem::Resource(ClipboardResource {
|
||||||
|
id,
|
||||||
|
hash: Some(hash),
|
||||||
|
sources: vec![DataSource::Embedded],
|
||||||
|
data: Some(ResourceData(bytes)),
|
||||||
|
})];
|
||||||
|
let payload = format!("graphite: {}", serde_json::to_string(&items).unwrap());
|
||||||
|
|
||||||
|
editor
|
||||||
|
.handle_message(ClipboardMessage::ReadClipboard {
|
||||||
|
content: ClipboardContentRaw::Text(payload),
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let registry = &editor.active_document().resources.registry;
|
||||||
|
assert!(registry.contains(&id), "the carried resource should be registered after paste");
|
||||||
|
assert_eq!(registry.hash(&id), Some(hash), "the carried resource should resolve to the carried bytes' hash");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,4 +5,4 @@ pub mod utility_types;
|
|||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use clipboard_message::{ClipboardMessage, ClipboardMessageDiscriminant};
|
pub use clipboard_message::{ClipboardMessage, ClipboardMessageDiscriminant};
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use clipboard_message_handler::ClipboardMessageHandler;
|
pub use clipboard_message_handler::{ClipboardMessageContext, ClipboardMessageHandler};
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
|
use crate::messages::portfolio::document::utility_types::network_interface::NodeTemplate;
|
||||||
|
use base64::Engine;
|
||||||
|
use base64::engine::general_purpose::STANDARD as BASE64;
|
||||||
|
use glam::DAffine2;
|
||||||
|
use graph_craft::application_io::resource::{DataSource, ResourceHash, ResourceId};
|
||||||
|
use graph_craft::document::NodeId;
|
||||||
|
use graphene_std::vector::Vector;
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum ClipboardContentRaw {
|
pub enum ClipboardContentRaw {
|
||||||
Text(String),
|
Text(String),
|
||||||
@@ -7,10 +16,55 @@ pub enum ClipboardContentRaw {
|
|||||||
|
|
||||||
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum ClipboardContent {
|
pub enum ClipboardContent {
|
||||||
Layer(String),
|
Graphite(String),
|
||||||
Nodes(String),
|
|
||||||
Vector(String),
|
|
||||||
Text(String),
|
Text(String),
|
||||||
Svg(String),
|
Svg(String),
|
||||||
Image { data: Vec<u8>, width: u32, height: u32 },
|
Image { data: Vec<u8>, width: u32, height: u32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type ClipboardVectorEntry = (LayerNodeIdentifier, Vector, DAffine2);
|
||||||
|
|
||||||
|
/// An entry in the `graphite:` clipboard payload.
|
||||||
|
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum ClipboardItem {
|
||||||
|
Layer(ClipboardLayer),
|
||||||
|
Nodes(Vec<(NodeId, NodeTemplate)>),
|
||||||
|
Vector(Vec<ClipboardVectorEntry>),
|
||||||
|
Resource(ClipboardResource),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub struct ClipboardLayer {
|
||||||
|
pub nodes: Vec<(NodeId, NodeTemplate)>,
|
||||||
|
pub visible: bool,
|
||||||
|
pub locked: bool,
|
||||||
|
pub collapsed: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub struct ClipboardResource {
|
||||||
|
pub id: ResourceId,
|
||||||
|
pub hash: Option<ResourceHash>,
|
||||||
|
pub sources: Vec<DataSource>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub data: Option<ResourceData>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Clone)]
|
||||||
|
pub struct ResourceData(pub Vec<u8>);
|
||||||
|
impl std::fmt::Debug for ResourceData {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.debug_struct("ResourceData").field("len", &self.0.len()).finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl serde::Serialize for ResourceData {
|
||||||
|
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||||
|
serializer.serialize_str(&BASE64.encode(&self.0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<'de> serde::Deserialize<'de> for ResourceData {
|
||||||
|
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||||
|
let encoded = String::deserialize(deserializer)?;
|
||||||
|
Ok(Self(BASE64.decode(&encoded).map_err(serde::de::Error::custom)?))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -339,6 +339,31 @@ impl ColorPickerMessageHandler {
|
|||||||
self.snapshot_old();
|
self.snapshot_old();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SpectrumInputUpdate::InsertDuplicate { index, position } => {
|
||||||
|
let source = index as usize;
|
||||||
|
let Some(insert_index) = gradient.duplicate_stop(source, position) else { return };
|
||||||
|
// The dragged stop (the duplication source) stays active. Its index shifts up if the frozen copy landed at or before it.
|
||||||
|
let dragged_index = if insert_index <= source { source + 1 } else { source };
|
||||||
|
self.active_marker_index = Some(dragged_index as u32);
|
||||||
|
self.active_marker_is_midpoint = false;
|
||||||
|
}
|
||||||
|
SpectrumInputUpdate::RemoveDuplicate { index } => {
|
||||||
|
let anchor = index as usize;
|
||||||
|
if anchor >= gradient.position.len() || gradient.position.len() <= 2 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Never remove the active (dragged) stop itself, this should only ever target the frozen copy.
|
||||||
|
if self.active_marker_index == Some(anchor as u32) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gradient.remove(anchor);
|
||||||
|
// Keep the dragged stop active. Its index shifts down if the removed copy came before it.
|
||||||
|
if let Some(active) = self.active_marker_index
|
||||||
|
&& (anchor as u32) < active
|
||||||
|
{
|
||||||
|
self.active_marker_index = Some(active - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
SpectrumInputUpdate::DeleteMarker { index } => {
|
SpectrumInputUpdate::DeleteMarker { index } => {
|
||||||
// Enforce minimum stop count. The gradient editor needs at least 2 stops to remain meaningful.
|
// Enforce minimum stop count. The gradient editor needs at least 2 stops to remain meaningful.
|
||||||
if gradient.position.len() <= 2 || (index as usize) >= gradient.position.len() {
|
if gradient.position.len() <= 2 || (index as usize) >= gradient.position.len() {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ use crate::messages::input_mapper::utility_types::macros::*;
|
|||||||
use crate::messages::input_mapper::utility_types::misc::MappingEntry;
|
use crate::messages::input_mapper::utility_types::misc::MappingEntry;
|
||||||
use crate::messages::input_mapper::utility_types::misc::{KeyMappingEntries, Mapping};
|
use crate::messages::input_mapper::utility_types::misc::{KeyMappingEntries, Mapping};
|
||||||
use crate::messages::portfolio::document::node_graph::utility_types::Direction;
|
use crate::messages::portfolio::document::node_graph::utility_types::Direction;
|
||||||
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
|
||||||
use crate::messages::portfolio::document::utility_types::misc::GroupFolderType;
|
use crate::messages::portfolio::document::utility_types::misc::GroupFolderType;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use crate::messages::tool::tool_messages::brush_tool::BrushToolMessageOptionsUpdate;
|
use crate::messages::tool::tool_messages::brush_tool::BrushToolMessageOptionsUpdate;
|
||||||
@@ -224,8 +223,8 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
|
|||||||
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=PathToolMessage::DeleteAndBreakPath),
|
entry!(KeyDown(Backspace); modifiers=[Accel], action_dispatch=PathToolMessage::DeleteAndBreakPath),
|
||||||
entry!(KeyDown(Delete); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
|
entry!(KeyDown(Delete); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
|
||||||
entry!(KeyDown(Backspace); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
|
entry!(KeyDown(Backspace); modifiers=[Shift], action_dispatch=PathToolMessage::BreakPath),
|
||||||
entry!(KeyDown(KeyX); modifiers=[Accel], action_dispatch=PathToolMessage::Cut { clipboard: Clipboard::Device }),
|
entry!(KeyDown(KeyX); modifiers=[Accel], action_dispatch=PathToolMessage::Cut),
|
||||||
entry!(KeyDown(KeyC); modifiers=[Accel], action_dispatch=PathToolMessage::Copy { clipboard: Clipboard::Device }),
|
entry!(KeyDown(KeyC); modifiers=[Accel], action_dispatch=PathToolMessage::Copy),
|
||||||
entry!(KeyDown(KeyD); modifiers=[Accel], action_dispatch=PathToolMessage::Duplicate),
|
entry!(KeyDown(KeyD); modifiers=[Accel], action_dispatch=PathToolMessage::Duplicate),
|
||||||
entry!(KeyDownNoRepeat(Tab); action_dispatch=PathToolMessage::SwapSelectedHandles),
|
entry!(KeyDownNoRepeat(Tab); action_dispatch=PathToolMessage::SwapSelectedHandles),
|
||||||
entry!(KeyDown(MouseLeft); action_dispatch=PathToolMessage::MouseDown { extend_selection: Shift, lasso_select: Control, handle_drag_from_anchor: Alt, drag_restore_handle: Control, segment_editing_modifier: Control }),
|
entry!(KeyDown(MouseLeft); action_dispatch=PathToolMessage::MouseDown { extend_selection: Shift, lasso_select: Control, handle_drag_from_anchor: Alt, drag_restore_handle: Control, segment_editing_modifier: Control }),
|
||||||
@@ -447,8 +446,6 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
|
|||||||
entry!(KeyDown(KeyW); modifiers=[Accel, Alt], action_dispatch=PortfolioMessage::CloseAllDocumentsWithConfirmation),
|
entry!(KeyDown(KeyW); modifiers=[Accel, Alt], action_dispatch=PortfolioMessage::CloseAllDocumentsWithConfirmation),
|
||||||
entry!(KeyDown(KeyO); modifiers=[Accel], action_dispatch=PortfolioMessage::Open),
|
entry!(KeyDown(KeyO); modifiers=[Accel], action_dispatch=PortfolioMessage::Open),
|
||||||
entry!(KeyDown(KeyI); modifiers=[Accel], action_dispatch=PortfolioMessage::Import),
|
entry!(KeyDown(KeyI); modifiers=[Accel], action_dispatch=PortfolioMessage::Import),
|
||||||
entry!(KeyDown(KeyX); modifiers=[Accel], action_dispatch=PortfolioMessage::Cut { clipboard: Clipboard::Device }),
|
|
||||||
entry!(KeyDown(KeyC); modifiers=[Accel], action_dispatch=PortfolioMessage::Copy { clipboard: Clipboard::Device }),
|
|
||||||
entry!(KeyDown(KeyR); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleRulers),
|
entry!(KeyDown(KeyR); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleRulers),
|
||||||
entry!(KeyDown(KeyD); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleDataPanelOpen),
|
entry!(KeyDown(KeyD); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleDataPanelOpen),
|
||||||
entry!(KeyDown(Enter); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleFocusDocument),
|
entry!(KeyDown(Enter); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleFocusDocument),
|
||||||
|
|||||||
@@ -310,11 +310,25 @@ impl LayoutMessageHandler {
|
|||||||
let callback_message = (number_input.on_update.callback)(number_input);
|
let callback_message = (number_input.on_update.callback)(number_input);
|
||||||
responses.add(callback_message);
|
responses.add(callback_message);
|
||||||
}
|
}
|
||||||
// TODO: This crashes when the cursor is in a text box, such as in the Text node, and the transform node is clicked (https://github.com/GraphiteEditor/Graphite/issues/1761)
|
// A text-field commit sends the user's raw entry as a math expression to evaluate and validate.
|
||||||
Value::String(str) => match str.as_str() {
|
Value::String(expression) => {
|
||||||
"Increment" => responses.add((number_input.increment_callback_increase.callback)(number_input)),
|
let Some(evaluated) = evaluate_and_validate_number_input(&expression, number_input) else { return };
|
||||||
"Decrement" => responses.add((number_input.increment_callback_decrease.callback)(number_input)),
|
|
||||||
_ => panic!("Invalid string found when updating `NumberInput`"),
|
// Skip the update (and its history transaction) when the value is unchanged, since the network interface would short-circuit it anyway.
|
||||||
|
if number_input.value == Some(evaluated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snapshot the pre-change state for undo via `on_commit`, then apply the new value via `on_update`.
|
||||||
|
responses.add((number_input.on_commit.callback)(&()));
|
||||||
|
number_input.value = Some(evaluated);
|
||||||
|
responses.add((number_input.on_update.callback)(number_input));
|
||||||
|
}
|
||||||
|
// The increment arrows send `{ "increment": "Increase" | "Decrease" }` to invoke the backend's directional step callback.
|
||||||
|
Value::Object(ref command) => match command.get("increment").and_then(Value::as_str) {
|
||||||
|
Some("Increase") => responses.add((number_input.increment_callback_increase.callback)(number_input)),
|
||||||
|
Some("Decrease") => responses.add((number_input.increment_callback_decrease.callback)(number_input)),
|
||||||
|
_ => error!("NumberInput received an unrecognized command: {value:?}"),
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
@@ -524,3 +538,32 @@ fn populate_computed_display_fields(layout: &mut Layout) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Evaluates a math expression committed in a `NumberInput`'s text field, then clamps and rounds it to the widget's constraints.
|
||||||
|
/// Returns `None` if the expression fails to parse, fails to evaluate, or yields a non-real number (such as `sqrt(-1)`).
|
||||||
|
fn evaluate_and_validate_number_input(expression: &str, number_input: &NumberInput) -> Option<f64> {
|
||||||
|
let value = math_parser::evaluate(expression)
|
||||||
|
.inspect_err(|err| error!("Math parser error on \"{expression}\": {err}"))
|
||||||
|
.ok()?
|
||||||
|
.0
|
||||||
|
.inspect_err(|err| error!("Math evaluate error on \"{expression}\": {err}"))
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
let real = value.as_real()?;
|
||||||
|
if real.is_nan() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut validated = real;
|
||||||
|
if let Some(min) = number_input.min {
|
||||||
|
validated = validated.max(min);
|
||||||
|
}
|
||||||
|
if let Some(max) = number_input.max {
|
||||||
|
validated = validated.min(max);
|
||||||
|
}
|
||||||
|
if number_input.is_integer {
|
||||||
|
validated = validated.round();
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(validated)
|
||||||
|
}
|
||||||
@@ -370,14 +370,25 @@ pub struct WidgetTable {
|
|||||||
pub unstyled: bool,
|
pub unstyled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A collapsible Properties panel section for a single node: a header with its name and pin, delete, and visibility controls, above its input parameter widgets.
|
||||||
#[cfg_attr(feature = "wasm", derive(tsify::Tsify), tsify(large_number_types_as_bigints))]
|
#[cfg_attr(feature = "wasm", derive(tsify::Tsify), tsify(large_number_types_as_bigints))]
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct WidgetSection {
|
pub struct WidgetSection {
|
||||||
|
/// The node's name shown in the section header: its given alias with the implementation name in parentheses, or just the implementation name.
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
/// The node definition's description, shown as the header's tooltip (empty when it has none).
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
/// Whether the node is visible rather than hidden (shown as the eye icon).
|
||||||
pub visible: bool,
|
pub visible: bool,
|
||||||
|
/// Whether the node is pinned, keeping its section shown in the Properties panel when nothing is selected (shown as the pin icon).
|
||||||
pub pinned: bool,
|
pub pinned: bool,
|
||||||
|
/// Whether this section can be dragged to reorder it within its layer's chain of nodes (true for a layer chain's nodes, but not its terminal layer node).
|
||||||
|
pub draggable: bool,
|
||||||
|
/// Whether this section is expanded to show its contents, as opposed to being collapsed down to just its header.
|
||||||
|
pub expanded: bool,
|
||||||
|
/// The ID of the node whose properties this section displays.
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
|
/// The node's properties content, rendered as the section's body when expanded.
|
||||||
pub layout: Layout,
|
pub layout: Layout,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,12 +416,14 @@ impl LayoutGroup {
|
|||||||
Self::Table(WidgetTable { rows, unstyled })
|
Self::Table(WidgetTable { rows, unstyled })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn section(name: impl Into<String>, description: impl Into<String>, visible: bool, pinned: bool, id: u64, layout: Layout) -> Self {
|
pub fn section(name: impl Into<String>, description: impl Into<String>, visible: bool, pinned: bool, expanded: bool, id: u64, layout: Layout) -> Self {
|
||||||
Self::Section(WidgetSection {
|
Self::Section(WidgetSection {
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
description: description.into(),
|
description: description.into(),
|
||||||
visible,
|
visible,
|
||||||
pinned,
|
pinned,
|
||||||
|
draggable: false,
|
||||||
|
expanded,
|
||||||
id,
|
id,
|
||||||
layout,
|
layout,
|
||||||
})
|
})
|
||||||
@@ -507,6 +520,8 @@ impl Diffable for LayoutGroup {
|
|||||||
description: current_description,
|
description: current_description,
|
||||||
visible: current_visible,
|
visible: current_visible,
|
||||||
pinned: current_pinned,
|
pinned: current_pinned,
|
||||||
|
draggable: current_draggable,
|
||||||
|
expanded: current_expanded,
|
||||||
id: current_id,
|
id: current_id,
|
||||||
layout: current_layout,
|
layout: current_layout,
|
||||||
}),
|
}),
|
||||||
@@ -515,6 +530,8 @@ impl Diffable for LayoutGroup {
|
|||||||
description: new_description,
|
description: new_description,
|
||||||
visible: new_visible,
|
visible: new_visible,
|
||||||
pinned: new_pinned,
|
pinned: new_pinned,
|
||||||
|
draggable: new_draggable,
|
||||||
|
expanded: new_expanded,
|
||||||
id: new_id,
|
id: new_id,
|
||||||
layout: new_layout,
|
layout: new_layout,
|
||||||
}),
|
}),
|
||||||
@@ -526,6 +543,8 @@ impl Diffable for LayoutGroup {
|
|||||||
|| *current_description != new_description
|
|| *current_description != new_description
|
||||||
|| *current_visible != new_visible
|
|| *current_visible != new_visible
|
||||||
|| *current_pinned != new_pinned
|
|| *current_pinned != new_pinned
|
||||||
|
|| *current_draggable != new_draggable
|
||||||
|
|| *current_expanded != new_expanded
|
||||||
|| *current_id != new_id
|
|| *current_id != new_id
|
||||||
{
|
{
|
||||||
// Update self to reflect new changes
|
// Update self to reflect new changes
|
||||||
@@ -533,6 +552,8 @@ impl Diffable for LayoutGroup {
|
|||||||
current_description.clone_from(&new_description);
|
current_description.clone_from(&new_description);
|
||||||
*current_visible = new_visible;
|
*current_visible = new_visible;
|
||||||
*current_pinned = new_pinned;
|
*current_pinned = new_pinned;
|
||||||
|
*current_draggable = new_draggable;
|
||||||
|
*current_expanded = new_expanded;
|
||||||
*current_id = new_id;
|
*current_id = new_id;
|
||||||
current_layout.clone_from(&new_layout);
|
current_layout.clone_from(&new_layout);
|
||||||
|
|
||||||
@@ -542,6 +563,8 @@ impl Diffable for LayoutGroup {
|
|||||||
description: new_description,
|
description: new_description,
|
||||||
visible: new_visible,
|
visible: new_visible,
|
||||||
pinned: new_pinned,
|
pinned: new_pinned,
|
||||||
|
draggable: new_draggable,
|
||||||
|
expanded: new_expanded,
|
||||||
id: new_id,
|
id: new_id,
|
||||||
layout: new_layout,
|
layout: new_layout,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -612,6 +612,16 @@ pub enum SpectrumInputUpdate {
|
|||||||
DeleteMarker {
|
DeleteMarker {
|
||||||
index: u32,
|
index: u32,
|
||||||
},
|
},
|
||||||
|
/// Insert a copy (same color and midpoint) of the marker at `index` at `position`, keeping the marker at `index` active.
|
||||||
|
InsertDuplicate {
|
||||||
|
index: u32,
|
||||||
|
position: f64,
|
||||||
|
},
|
||||||
|
/// Remove the marker at `index` while keeping the currently active marker active (renumbered to account for the removal).
|
||||||
|
/// Used to un-duplicate when Alt is released mid-drag, deleting the frozen copy left by [`InsertDuplicate`](Self::InsertDuplicate).
|
||||||
|
RemoveDuplicate {
|
||||||
|
index: u32,
|
||||||
|
},
|
||||||
/// Emitted when the user double-clicks a marker. The consumer decides what (if anything) to reset the marker to.
|
/// Emitted when the user double-clicks a marker. The consumer decides what (if anything) to reset the marker to.
|
||||||
ResetMarker {
|
ResetMarker {
|
||||||
index: u32,
|
index: u32,
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ pub enum DocumentMessage {
|
|||||||
parent: LayerNodeIdentifier,
|
parent: LayerNodeIdentifier,
|
||||||
insert_index: usize,
|
insert_index: usize,
|
||||||
},
|
},
|
||||||
|
ReorderPropertiesSection {
|
||||||
|
node_id: NodeId,
|
||||||
|
insert_index: usize,
|
||||||
|
},
|
||||||
MoveSelectedLayersToGroup {
|
MoveSelectedLayersToGroup {
|
||||||
parent: LayerNodeIdentifier,
|
parent: LayerNodeIdentifier,
|
||||||
},
|
},
|
||||||
@@ -112,7 +116,7 @@ pub enum DocumentMessage {
|
|||||||
resize: Key,
|
resize: Key,
|
||||||
resize_opposite: Key,
|
resize_opposite: Key,
|
||||||
},
|
},
|
||||||
PasteImage {
|
InsertImage {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
image: Image<Color>,
|
image: Image<Color>,
|
||||||
mouse: Option<(f64, f64)>,
|
mouse: Option<(f64, f64)>,
|
||||||
@@ -121,7 +125,7 @@ pub enum DocumentMessage {
|
|||||||
/// can wrap it without a content Transform node. When false, place at the cursor or viewport center.
|
/// can wrap it without a content Transform node. When false, place at the cursor or viewport center.
|
||||||
place_at_origin: bool,
|
place_at_origin: bool,
|
||||||
},
|
},
|
||||||
PasteSvg {
|
InsertSvg {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
svg: String,
|
svg: String,
|
||||||
mouse: Option<(f64, f64)>,
|
mouse: Option<(f64, f64)>,
|
||||||
@@ -212,6 +216,9 @@ pub enum DocumentMessage {
|
|||||||
tree_path: Vec<NodeId>,
|
tree_path: Vec<NodeId>,
|
||||||
recursive: bool,
|
recursive: bool,
|
||||||
},
|
},
|
||||||
|
ToggleNodePropertiesSectionExpanded {
|
||||||
|
node_id: NodeId,
|
||||||
|
},
|
||||||
ToggleSelectedVisibility,
|
ToggleSelectedVisibility,
|
||||||
ToggleSelectedLocked,
|
ToggleSelectedLocked,
|
||||||
ToggleGridVisibility,
|
ToggleGridVisibility,
|
||||||
@@ -225,8 +232,6 @@ pub enum DocumentMessage {
|
|||||||
UpdateClickTargets {
|
UpdateClickTargets {
|
||||||
click_targets: HashMap<NodeId, Vec<Arc<ClickTarget>>>,
|
click_targets: HashMap<NodeId, Vec<Arc<ClickTarget>>>,
|
||||||
},
|
},
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
MigrateLegacyGradients,
|
|
||||||
UpdateOutlines {
|
UpdateOutlines {
|
||||||
outlines: HashMap<NodeId, Vec<Arc<ClickTarget>>>,
|
outlines: HashMap<NodeId, Vec<Arc<ClickTarget>>>,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ pub struct DocumentMessageHandler {
|
|||||||
/// Tracks which layer occurrences are collapsed in the Layers panel, keyed by tree path.
|
/// Tracks which layer occurrences are collapsed in the Layers panel, keyed by tree path.
|
||||||
#[serde(deserialize_with = "deserialize_collapsed_layers", default)]
|
#[serde(deserialize_with = "deserialize_collapsed_layers", default)]
|
||||||
pub collapsed: CollapsedLayers,
|
pub collapsed: CollapsedLayers,
|
||||||
|
/// The node IDs whose section is collapsed in the Properties panel.
|
||||||
|
#[serde(default)]
|
||||||
|
pub properties_panel_collapsed_sections: Vec<NodeId>,
|
||||||
/// The full Git commit hash of the Graphite repository that was used to build the editor.
|
/// The full Git commit hash of the Graphite repository that was used to build the editor.
|
||||||
/// We save this to provide a hint about which version of the editor was used to create the document.
|
/// We save this to provide a hint about which version of the editor was used to create the document.
|
||||||
pub commit_hash: String,
|
pub commit_hash: String,
|
||||||
@@ -173,6 +176,7 @@ impl Default for DocumentMessageHandler {
|
|||||||
network_interface: default_document_network_interface(),
|
network_interface: default_document_network_interface(),
|
||||||
resources: ResourceMessageHandler::default(),
|
resources: ResourceMessageHandler::default(),
|
||||||
collapsed: CollapsedLayers::default(),
|
collapsed: CollapsedLayers::default(),
|
||||||
|
properties_panel_collapsed_sections: Vec::new(),
|
||||||
commit_hash: GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
commit_hash: GRAPHITE_GIT_COMMIT_HASH.to_string(),
|
||||||
document_ptz: PTZ::default(),
|
document_ptz: PTZ::default(),
|
||||||
render_mode: RenderMode::default(),
|
render_mode: RenderMode::default(),
|
||||||
@@ -248,6 +252,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
document_name: self.name.as_str(),
|
document_name: self.name.as_str(),
|
||||||
fonts,
|
fonts,
|
||||||
properties_panel_open,
|
properties_panel_open,
|
||||||
|
properties_panel_collapsed_sections: &self.properties_panel_collapsed_sections,
|
||||||
};
|
};
|
||||||
self.properties_panel_message_handler.process_message(message, responses, context);
|
self.properties_panel_message_handler.process_message(message, responses, context);
|
||||||
}
|
}
|
||||||
@@ -271,6 +276,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
breadcrumb_network_path: &self.breadcrumb_network_path,
|
breadcrumb_network_path: &self.breadcrumb_network_path,
|
||||||
document_id,
|
document_id,
|
||||||
collapsed: &mut self.collapsed,
|
collapsed: &mut self.collapsed,
|
||||||
|
properties_panel_collapsed_sections: &mut self.properties_panel_collapsed_sections,
|
||||||
ipp,
|
ipp,
|
||||||
graph_view_overlay_open: self.graph_view_overlay_open,
|
graph_view_overlay_open: self.graph_view_overlay_open,
|
||||||
graph_fade_artwork_percentage: self.graph_fade_artwork_percentage,
|
graph_fade_artwork_percentage: self.graph_fade_artwork_percentage,
|
||||||
@@ -726,6 +732,39 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
DocumentMessage::MoveSelectedLayersTo { parent, insert_index } => {
|
DocumentMessage::MoveSelectedLayersTo { parent, insert_index } => {
|
||||||
self.move_selected_layers_to(parent, insert_index, responses);
|
self.move_selected_layers_to(parent, insert_index, responses);
|
||||||
}
|
}
|
||||||
|
DocumentMessage::ReorderPropertiesSection { node_id, insert_index } => {
|
||||||
|
// The Properties panel shows draggable sections in two cases, disambiguated by the current selection:
|
||||||
|
// a single selected layer (reorder within its node chain) or no selection (reorder the pinned nodes).
|
||||||
|
let selected_nodes = self.network_interface.selected_nodes_in_nested_network(&self.selection_network_path);
|
||||||
|
let Some(selected_nodes) = selected_nodes else { return };
|
||||||
|
|
||||||
|
let (mut layers, mut nodes) = (Vec::new(), Vec::new());
|
||||||
|
|
||||||
|
for selected in selected_nodes.selected_nodes() {
|
||||||
|
if self.network_interface.is_layer(selected, &self.selection_network_path) {
|
||||||
|
layers.push(*selected);
|
||||||
|
} else {
|
||||||
|
nodes.push(*selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layers.sort();
|
||||||
|
layers.dedup();
|
||||||
|
|
||||||
|
if layers.len() == 1 {
|
||||||
|
// Reorder a node within the selected layer's chain by rewiring the graph
|
||||||
|
responses.add(DocumentMessage::AddTransaction);
|
||||||
|
responses.add(NodeGraphMessage::ReorderChainNode { node_id, insert_index });
|
||||||
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
|
responses.add(NodeGraphMessage::SendGraph);
|
||||||
|
responses.add(PropertiesPanelMessage::Refresh);
|
||||||
|
} else if layers.is_empty() && nodes.is_empty() {
|
||||||
|
// Reorder a pinned node, which is purely a Properties panel display order (no graph rerender needed)
|
||||||
|
responses.add(DocumentMessage::AddTransaction);
|
||||||
|
responses.add(NodeGraphMessage::ReorderPinnedNode { node_id, insert_index });
|
||||||
|
responses.add(PropertiesPanelMessage::Refresh);
|
||||||
|
}
|
||||||
|
}
|
||||||
DocumentMessage::MoveSelectedLayersToGroup { parent } => {
|
DocumentMessage::MoveSelectedLayersToGroup { parent } => {
|
||||||
// Group all shallowest unique selected layers in order
|
// Group all shallowest unique selected layers in order
|
||||||
let all_layers_to_group_sorted = self.network_interface.shallowest_unique_layers_sorted(&self.selection_network_path);
|
let all_layers_to_group_sorted = self.network_interface.shallowest_unique_layers_sorted(&self.selection_network_path);
|
||||||
@@ -753,7 +792,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
let resize_opposite = ipp.keyboard.key(resize_opposite);
|
let resize_opposite = ipp.keyboard.key(resize_opposite);
|
||||||
self.nudge_selected_layers(delta_x, delta_y, resize, resize_opposite, responses);
|
self.nudge_selected_layers(delta_x, delta_y, resize, resize_opposite, responses);
|
||||||
}
|
}
|
||||||
DocumentMessage::PasteImage {
|
DocumentMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -817,7 +856,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
// Force chosen tool to be Select Tool after importing image.
|
// Force chosen tool to be Select Tool after importing image.
|
||||||
responses.add(ToolMessage::ActivateTool { tool_type: ToolType::Select });
|
responses.add(ToolMessage::ActivateTool { tool_type: ToolType::Select });
|
||||||
}
|
}
|
||||||
DocumentMessage::PasteSvg {
|
DocumentMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -1330,6 +1369,14 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
|
|
||||||
responses.add(NodeGraphMessage::SendGraph);
|
responses.add(NodeGraphMessage::SendGraph);
|
||||||
}
|
}
|
||||||
|
DocumentMessage::ToggleNodePropertiesSectionExpanded { node_id } => {
|
||||||
|
if let Some(index) = self.properties_panel_collapsed_sections.iter().position(|id| *id == node_id) {
|
||||||
|
self.properties_panel_collapsed_sections.remove(index);
|
||||||
|
} else {
|
||||||
|
self.properties_panel_collapsed_sections.push(node_id);
|
||||||
|
}
|
||||||
|
responses.add(PropertiesPanelMessage::Refresh);
|
||||||
|
}
|
||||||
DocumentMessage::ToggleSelectedLocked => responses.add(NodeGraphMessage::ToggleSelectedLocked),
|
DocumentMessage::ToggleSelectedLocked => responses.add(NodeGraphMessage::ToggleSelectedLocked),
|
||||||
DocumentMessage::ToggleSelectedVisibility => {
|
DocumentMessage::ToggleSelectedVisibility => {
|
||||||
responses.add(NodeGraphMessage::ToggleSelectedVisibility);
|
responses.add(NodeGraphMessage::ToggleSelectedVisibility);
|
||||||
@@ -1372,38 +1419,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
|||||||
.collect();
|
.collect();
|
||||||
self.network_interface.update_click_targets(layer_click_targets);
|
self.network_interface.update_click_targets(layer_click_targets);
|
||||||
}
|
}
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
DocumentMessage::MigrateLegacyGradients => {
|
|
||||||
if self.pending_gradient_migration {
|
|
||||||
self.pending_gradient_migration = false;
|
|
||||||
|
|
||||||
// Read each layer's legacy gradient and compute its absolute form from the now-available local bounds
|
|
||||||
let layers: Vec<_> = self.metadata().all_layers().collect();
|
|
||||||
let conversions: Vec<(NodeId, Fill)> = layers
|
|
||||||
.into_iter()
|
|
||||||
.filter_map(|layer| {
|
|
||||||
let gradient = graph_modification_utils::get_gradient(layer, &self.network_interface)?;
|
|
||||||
if gradient.absolute {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let fill_node_id = graph_modification_utils::get_fill_node_id(layer, &self.network_interface)?;
|
|
||||||
let bounds = self.metadata().nonzero_bounding_box(layer);
|
|
||||||
let bounding_box = DAffine2::from_scale_angle_translation(bounds[1] - bounds[0], 0., bounds[0]);
|
|
||||||
let layer_transform = self.metadata().upstream_transform(layer.to_node());
|
|
||||||
Some((fill_node_id, Fill::Gradient(gradient.to_absolute(bounding_box, layer_transform))))
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let converted_any = !conversions.is_empty();
|
|
||||||
for (fill_node_id, fill) in conversions {
|
|
||||||
self.network_interface
|
|
||||||
.set_input(&InputConnector::node(fill_node_id, 1), NodeInput::value(TaggedValue::Fill(fill), false), &[]);
|
|
||||||
}
|
|
||||||
if converted_any {
|
|
||||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DocumentMessage::UpdateOutlines { outlines } => {
|
DocumentMessage::UpdateOutlines { outlines } => {
|
||||||
let layer_outlines = outlines
|
let layer_outlines = outlines
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ pub struct NodePropertiesContext<'a> {
|
|||||||
pub fonts: &'a FontsMessageHandler,
|
pub fonts: &'a FontsMessageHandler,
|
||||||
pub selection_network_path: &'a [NodeId],
|
pub selection_network_path: &'a [NodeId],
|
||||||
pub document_name: &'a str,
|
pub document_name: &'a str,
|
||||||
|
/// The node IDs whose Properties panel sections the user has collapsed.
|
||||||
|
pub properties_panel_collapsed_sections: &'a [NodeId],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodePropertiesContext<'_> {
|
impl NodePropertiesContext<'_> {
|
||||||
|
|||||||
@@ -94,11 +94,19 @@ pub enum NodeGraphMessage {
|
|||||||
node_id: NodeId,
|
node_id: NodeId,
|
||||||
parent: LayerNodeIdentifier,
|
parent: LayerNodeIdentifier,
|
||||||
},
|
},
|
||||||
|
ReorderChainNode {
|
||||||
|
node_id: NodeId,
|
||||||
|
insert_index: usize,
|
||||||
|
},
|
||||||
|
ReorderPinnedNode {
|
||||||
|
node_id: NodeId,
|
||||||
|
insert_index: usize,
|
||||||
|
},
|
||||||
SetChainPosition {
|
SetChainPosition {
|
||||||
node_id: NodeId,
|
node_id: NodeId,
|
||||||
},
|
},
|
||||||
PasteNodes {
|
InsertNodes {
|
||||||
serialized_nodes: String,
|
nodes: Vec<(NodeId, NodeTemplate)>,
|
||||||
},
|
},
|
||||||
PointerDown {
|
PointerDown {
|
||||||
shift_click: bool,
|
shift_click: bool,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::node_properties;
|
use super::node_properties;
|
||||||
use super::utility_types::{BoxSelection, ContextMenuInformation, DragStart, FrontendNode};
|
use super::utility_types::{BoxSelection, ContextMenuInformation, DragStart, FrontendNode};
|
||||||
use crate::consts::GRID_SIZE;
|
use crate::consts::GRID_SIZE;
|
||||||
use crate::messages::clipboard::utility_types::ClipboardContent;
|
use crate::messages::clipboard::utility_types::ClipboardItem;
|
||||||
use crate::messages::input_mapper::utility_types::macros::{action_shortcut, action_shortcut_manual};
|
use crate::messages::input_mapper::utility_types::macros::{action_shortcut, action_shortcut_manual};
|
||||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||||
use crate::messages::portfolio::document::document_message_handler::navigation_controls;
|
use crate::messages::portfolio::document::document_message_handler::navigation_controls;
|
||||||
@@ -12,9 +12,7 @@ use crate::messages::portfolio::document::node_graph::document_node_definitions:
|
|||||||
use crate::messages::portfolio::document::node_graph::utility_types::{ContextMenuData, Direction, FrontendGraphDataType, NodeGraphErrorDiagnostic};
|
use crate::messages::portfolio::document::node_graph::utility_types::{ContextMenuData, Direction, FrontendGraphDataType, NodeGraphErrorDiagnostic};
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::misc::GroupFolderType;
|
use crate::messages::portfolio::document::utility_types::misc::GroupFolderType;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{
|
use crate::messages::portfolio::document::utility_types::network_interface::{self, FlowType, InputConnector, NodeNetworkInterface, NodeTypePersistentMetadata, OutputConnector, Previewing};
|
||||||
self, FlowType, InputConnector, NodeNetworkInterface, NodeTemplate, NodeTypePersistentMetadata, OutputConnector, Previewing,
|
|
||||||
};
|
|
||||||
use crate::messages::portfolio::document::utility_types::nodes::{CollapsedLayers, LayerPanelEntry};
|
use crate::messages::portfolio::document::utility_types::nodes::{CollapsedLayers, LayerPanelEntry};
|
||||||
use crate::messages::portfolio::document::utility_types::wires::{GraphWireStyle, WirePath, WirePathUpdate, build_vector_wire};
|
use crate::messages::portfolio::document::utility_types::wires::{GraphWireStyle, WirePath, WirePathUpdate, build_vector_wire};
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
@@ -41,6 +39,7 @@ pub struct NodeGraphMessageContext<'a> {
|
|||||||
pub breadcrumb_network_path: &'a [NodeId],
|
pub breadcrumb_network_path: &'a [NodeId],
|
||||||
pub document_id: DocumentId,
|
pub document_id: DocumentId,
|
||||||
pub collapsed: &'a mut CollapsedLayers,
|
pub collapsed: &'a mut CollapsedLayers,
|
||||||
|
pub properties_panel_collapsed_sections: &'a mut Vec<NodeId>,
|
||||||
pub ipp: &'a InputPreprocessorMessageHandler,
|
pub ipp: &'a InputPreprocessorMessageHandler,
|
||||||
pub graph_view_overlay_open: bool,
|
pub graph_view_overlay_open: bool,
|
||||||
pub graph_fade_artwork_percentage: f64,
|
pub graph_fade_artwork_percentage: f64,
|
||||||
@@ -112,6 +111,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
breadcrumb_network_path,
|
breadcrumb_network_path,
|
||||||
document_id,
|
document_id,
|
||||||
collapsed,
|
collapsed,
|
||||||
|
properties_panel_collapsed_sections,
|
||||||
ipp,
|
ipp,
|
||||||
graph_view_overlay_open,
|
graph_view_overlay_open,
|
||||||
graph_fade_artwork_percentage,
|
graph_fade_artwork_percentage,
|
||||||
@@ -188,8 +188,15 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
on: EventMessage::SelectionChanged,
|
on: EventMessage::SelectionChanged,
|
||||||
send: Box::new(NodeGraphMessage::SelectedNodesUpdated.into()),
|
send: Box::new(NodeGraphMessage::SelectedNodesUpdated.into()),
|
||||||
});
|
});
|
||||||
|
|
||||||
network_interface.load_structure();
|
network_interface.load_structure();
|
||||||
|
|
||||||
|
// Prune the Layers panel collapsed state for any layer tree paths whose nodes no longer exist, so it doesn't accumulate across loads
|
||||||
collapsed.0.retain(|path| path.iter().all(|&node_id| network_interface.document_network().nodes.contains_key(&node_id)));
|
collapsed.0.retain(|path| path.iter().all(|&node_id| network_interface.document_network().nodes.contains_key(&node_id)));
|
||||||
|
|
||||||
|
// Prune the Properties panel node section collapsed state for any nodes (in any nested network) that no longer exist, so it doesn't accumulate across loads
|
||||||
|
let existing_nodes = network_interface.document_network().recursive_nodes().map(|(node_id, ..)| *node_id).collect::<HashSet<_>>();
|
||||||
|
properties_panel_collapsed_sections.retain(|node_id| existing_nodes.contains(node_id));
|
||||||
}
|
}
|
||||||
NodeGraphMessage::SelectedNodesUpdated => {
|
NodeGraphMessage::SelectedNodesUpdated => {
|
||||||
let selected_layers = network_interface.selected_nodes().selected_layers(network_interface.document_metadata()).collect::<Vec<_>>();
|
let selected_layers = network_interface.selected_nodes().selected_layers(network_interface.document_metadata()).collect::<Vec<_>>();
|
||||||
@@ -248,12 +255,8 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
let new_ids = &all_selected_nodes.iter().enumerate().map(|(new, old)| (*old, NodeId(new as u64))).collect();
|
let new_ids = &all_selected_nodes.iter().enumerate().map(|(new, old)| (*old, NodeId(new as u64))).collect();
|
||||||
let copied_nodes = network_interface.copy_nodes(new_ids, selection_network_path).collect::<Vec<_>>();
|
let copied_nodes = network_interface.copy_nodes(new_ids, selection_network_path).collect::<Vec<_>>();
|
||||||
|
|
||||||
let Ok(data) = serde_json::to_string(&copied_nodes) else {
|
responses.add(ClipboardMessage::WriteItems {
|
||||||
log::error!("Failed to serialize nodes for clipboard");
|
items: vec![ClipboardItem::Nodes(copied_nodes)],
|
||||||
return;
|
|
||||||
};
|
|
||||||
responses.add(ClipboardMessage::Write {
|
|
||||||
content: ClipboardContent::Nodes(data),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
NodeGraphMessage::CreateNodeInLayerNoTransaction { node_type, layer } => {
|
NodeGraphMessage::CreateNodeInLayerNoTransaction { node_type, layer } => {
|
||||||
@@ -759,29 +762,27 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
NodeGraphMessage::MoveNodeToChainStart { node_id, parent } => {
|
NodeGraphMessage::MoveNodeToChainStart { node_id, parent } => {
|
||||||
network_interface.move_node_to_chain_start(&node_id, parent, selection_network_path, false);
|
network_interface.move_node_to_chain_start(&node_id, parent, selection_network_path, false);
|
||||||
}
|
}
|
||||||
|
NodeGraphMessage::ReorderChainNode { node_id, insert_index } => {
|
||||||
|
network_interface.reorder_chain_node(node_id, insert_index, selection_network_path);
|
||||||
|
}
|
||||||
|
NodeGraphMessage::ReorderPinnedNode { node_id, insert_index } => {
|
||||||
|
network_interface.reorder_pinned_node(node_id, insert_index, selection_network_path);
|
||||||
|
}
|
||||||
NodeGraphMessage::SetChainPosition { node_id } => {
|
NodeGraphMessage::SetChainPosition { node_id } => {
|
||||||
network_interface.set_chain_position(&node_id, selection_network_path);
|
network_interface.set_chain_position(&node_id, selection_network_path);
|
||||||
}
|
}
|
||||||
NodeGraphMessage::PasteNodes { serialized_nodes } => {
|
NodeGraphMessage::InsertNodes { nodes } => {
|
||||||
let data = match serde_json::from_str::<Vec<(NodeId, NodeTemplate)>>(&serialized_nodes) {
|
if nodes.is_empty() {
|
||||||
Ok(d) => d,
|
|
||||||
Err(e) => {
|
|
||||||
warn!("Invalid node data {e:?}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if data.is_empty() {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
responses.add(DocumentMessage::AddTransaction);
|
responses.add(DocumentMessage::AddTransaction);
|
||||||
|
|
||||||
let new_ids: HashMap<_, _> = data.iter().map(|(id, _)| (*id, NodeId::new())).collect();
|
let new_ids: HashMap<_, _> = nodes.iter().map(|(id, _)| (*id, NodeId::new())).collect();
|
||||||
|
|
||||||
|
responses.add(NodeGraphMessage::AddNodes { nodes, new_ids: new_ids.clone() });
|
||||||
|
|
||||||
let nodes: Vec<_> = new_ids.values().copied().collect();
|
let nodes: Vec<_> = new_ids.values().copied().collect();
|
||||||
responses.add(NodeGraphMessage::AddNodes {
|
|
||||||
nodes: data,
|
|
||||||
new_ids: new_ids.clone(),
|
|
||||||
});
|
|
||||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes })
|
responses.add(NodeGraphMessage::SelectedNodesSet { nodes })
|
||||||
}
|
}
|
||||||
NodeGraphMessage::PointerDown {
|
NodeGraphMessage::PointerDown {
|
||||||
@@ -1785,6 +1786,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
responses.add(OverlaysMessage::Draw);
|
responses.add(OverlaysMessage::Draw);
|
||||||
}
|
}
|
||||||
if is_stroke_node || is_fill_node || is_shape_generator_node || is_text_node {
|
if is_stroke_node || is_fill_node || is_shape_generator_node || is_text_node {
|
||||||
|
responses.add(SelectToolMessage::SelectionChanged);
|
||||||
responses.add(PenToolMessage::SelectionChanged);
|
responses.add(PenToolMessage::SelectionChanged);
|
||||||
responses.add(FreehandToolMessage::SelectionChanged);
|
responses.add(FreehandToolMessage::SelectionChanged);
|
||||||
responses.add(SplineToolMessage::SelectionChanged);
|
responses.add(SplineToolMessage::SelectionChanged);
|
||||||
@@ -2538,25 +2540,18 @@ impl NodeGraphMessageHandler {
|
|||||||
Separator::new(SeparatorStyle::Related).widget_instance(),
|
Separator::new(SeparatorStyle::Related).widget_instance(),
|
||||||
])];
|
])];
|
||||||
|
|
||||||
let Some(network) = context.network_interface.nested_network(context.selection_network_path) else {
|
// And if no nodes are selected, show properties for all pinned nodes (in the user's saved order, each draggable to reorder)
|
||||||
warn!("No network in collate_properties");
|
let mut pinned_node_properties = context
|
||||||
return Vec::new();
|
.network_interface
|
||||||
};
|
.ordered_pinned_nodes(context.selection_network_path)
|
||||||
// And if no nodes are selected, show properties for all pinned nodes
|
.into_iter()
|
||||||
let pinned_node_properties = network
|
.map(|node_id| node_properties::generate_node_properties(node_id, context))
|
||||||
.nodes
|
|
||||||
.keys()
|
|
||||||
.cloned()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.iter()
|
|
||||||
.filter_map(|node_id| {
|
|
||||||
if context.network_interface.is_pinned(node_id, context.selection_network_path) {
|
|
||||||
Some(node_properties::generate_node_properties(*node_id, context))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
for pinned_section in pinned_node_properties.iter_mut() {
|
||||||
|
if let LayoutGroup::Section(section) = pinned_section {
|
||||||
|
section.draggable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
properties.extend(pinned_node_properties);
|
properties.extend(pinned_node_properties);
|
||||||
properties
|
properties
|
||||||
@@ -2618,7 +2613,7 @@ impl NodeGraphMessageHandler {
|
|||||||
])];
|
])];
|
||||||
|
|
||||||
// Iterate through all the upstream nodes, but stop when we reach another layer (since that's a point where we switch from horizontal to vertical flow)
|
// Iterate through all the upstream nodes, but stop when we reach another layer (since that's a point where we switch from horizontal to vertical flow)
|
||||||
let node_properties = context
|
let mut node_properties = context
|
||||||
.network_interface
|
.network_interface
|
||||||
.upstream_flow_back_from_nodes(vec![layer], context.selection_network_path, network_interface::FlowType::HorizontalFlow)
|
.upstream_flow_back_from_nodes(vec![layer], context.selection_network_path, network_interface::FlowType::HorizontalFlow)
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@@ -2635,6 +2630,14 @@ impl NodeGraphMessageHandler {
|
|||||||
.map(|node_id| node_properties::generate_node_properties(node_id, context))
|
.map(|node_id| node_properties::generate_node_properties(node_id, context))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// Mark each chain node (but not the layer node itself, which is first) draggable so its section can be reordered.
|
||||||
|
// A node without a primary input (e.g. a generator) is left non-draggable.
|
||||||
|
for chain_node_section in node_properties.iter_mut().skip(1) {
|
||||||
|
if let LayoutGroup::Section(section) = chain_node_section {
|
||||||
|
section.draggable = context.network_interface.has_primary_input(&NodeId(section.id), context.selection_network_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
layer_properties.extend(node_properties);
|
layer_properties.extend(node_properties);
|
||||||
layer_properties
|
layer_properties
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2281,6 +2281,14 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper
|
|||||||
} else {
|
} else {
|
||||||
let number_of_inputs = context.network_interface.number_of_inputs(&node_id, context.selection_network_path);
|
let number_of_inputs = context.network_interface.number_of_inputs(&node_id, context.selection_network_path);
|
||||||
for input_index in 1..number_of_inputs {
|
for input_index in 1..number_of_inputs {
|
||||||
|
// Hide inputs that are connected to a scope
|
||||||
|
if let Some(NodeInput::Scope(_)) = context
|
||||||
|
.network_interface
|
||||||
|
.input_from_connector(&InputConnector::node(node_id, input_index), context.selection_network_path)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let row = context.call_widget_override(&node_id, input_index).unwrap_or_else(|| {
|
let row = context.call_widget_override(&node_id, input_index).unwrap_or_else(|| {
|
||||||
let Some(implementation) = context.network_interface.implementation(&node_id, context.selection_network_path) else {
|
let Some(implementation) = context.network_interface.implementation(&node_id, context.selection_network_path) else {
|
||||||
log::error!("Could not get implementation for node {node_id}");
|
log::error!("Could not get implementation for node {node_id}");
|
||||||
@@ -2365,8 +2373,9 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper
|
|||||||
|
|
||||||
let visible = context.network_interface.is_visible(&node_id, context.selection_network_path);
|
let visible = context.network_interface.is_visible(&node_id, context.selection_network_path);
|
||||||
let pinned = context.network_interface.is_pinned(&node_id, context.selection_network_path);
|
let pinned = context.network_interface.is_pinned(&node_id, context.selection_network_path);
|
||||||
|
let expanded = !context.properties_panel_collapsed_sections.contains(&node_id);
|
||||||
|
|
||||||
LayoutGroup::section(name, description, visible, pinned, node_id.0, Layout(layout))
|
LayoutGroup::section(name, description, visible, pinned, expanded, node_id.0, Layout(layout))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve the viewport-space orientation of a Fill node's gradient by walking downstream to its owning layer
|
/// Resolve the viewport-space orientation of a Fill node's gradient by walking downstream to its owning layer
|
||||||
|
|||||||
@@ -230,10 +230,12 @@ impl OverlayContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.render_context.begin_path();
|
self.render_context.begin_path();
|
||||||
self.render_context.move_to(polygon.last().unwrap().x.round() - 0.5, polygon.last().unwrap().y.round() - 0.5);
|
let last = self.snap_to_physical_pixel_center(*polygon.last().unwrap());
|
||||||
|
self.render_context.move_to(last.x, last.y);
|
||||||
|
|
||||||
for point in polygon {
|
for point in polygon {
|
||||||
self.render_context.line_to(point.x.round() - 0.5, point.y.round() - 0.5);
|
let p = self.snap_to_physical_pixel_center(*point);
|
||||||
|
self.render_context.line_to(p.x, p.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(color_fill) = color_fill {
|
if let Some(color_fill) = color_fill {
|
||||||
@@ -286,8 +288,8 @@ impl OverlayContext {
|
|||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = start.round() - DVec2::splat(0.5);
|
let start = self.snap_to_physical_pixel_center(start);
|
||||||
let end = end.round() - DVec2::splat(0.5);
|
let end = self.snap_to_physical_pixel_center(end);
|
||||||
|
|
||||||
self.render_context.begin_path();
|
self.render_context.begin_path();
|
||||||
self.render_context.move_to(start.x, start.y);
|
self.render_context.move_to(start.x, start.y);
|
||||||
@@ -328,7 +330,7 @@ impl OverlayContext {
|
|||||||
dash_offset: Option<f64>,
|
dash_offset: Option<f64>,
|
||||||
) {
|
) {
|
||||||
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
||||||
let center = center.round();
|
let center = self.snap_to_physical_pixel(center);
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
@@ -397,7 +399,7 @@ impl OverlayContext {
|
|||||||
transform: Option<DAffine2>,
|
transform: Option<DAffine2>,
|
||||||
) {
|
) {
|
||||||
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
||||||
let position = position.round();
|
let position = self.snap_to_physical_pixel(position);
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
@@ -455,7 +457,7 @@ impl OverlayContext {
|
|||||||
pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
|
pub fn manipulator_handle(&mut self, position: DVec2, selected: bool, color: Option<&str>) {
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
let position = position.round() - DVec2::splat(0.5);
|
let position = self.snap_to_physical_pixel_center(position);
|
||||||
|
|
||||||
self.render_context.begin_path();
|
self.render_context.begin_path();
|
||||||
self.render_context
|
self.render_context
|
||||||
@@ -553,7 +555,7 @@ impl OverlayContext {
|
|||||||
pub fn hover_manipulator_handle(&mut self, position: DVec2, selected: bool) {
|
pub fn hover_manipulator_handle(&mut self, position: DVec2, selected: bool) {
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
let position = position.round() - DVec2::splat(0.5);
|
let position = self.snap_to_physical_pixel_center(position);
|
||||||
|
|
||||||
self.render_context.begin_path();
|
self.render_context.begin_path();
|
||||||
self.render_context
|
self.render_context
|
||||||
@@ -622,7 +624,7 @@ impl OverlayContext {
|
|||||||
let color_fill = color_fill.unwrap_or(COLOR_OVERLAY_WHITE);
|
let color_fill = color_fill.unwrap_or(COLOR_OVERLAY_WHITE);
|
||||||
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
let color_stroke = color_stroke.unwrap_or(COLOR_OVERLAY_BLUE);
|
||||||
|
|
||||||
let position = position.round() - DVec2::splat(0.5);
|
let position = self.snap_to_physical_pixel_center(position);
|
||||||
let corner = position - DVec2::splat(size) / 2.;
|
let corner = position - DVec2::splat(size) / 2.;
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
@@ -642,7 +644,7 @@ impl OverlayContext {
|
|||||||
let size = 1.;
|
let size = 1.;
|
||||||
let color_fill = color.unwrap_or(COLOR_OVERLAY_WHITE);
|
let color_fill = color.unwrap_or(COLOR_OVERLAY_WHITE);
|
||||||
|
|
||||||
let position = position.round() - DVec2::splat(0.5);
|
let position = self.snap_to_physical_pixel_center(position);
|
||||||
let corner = position - DVec2::splat(size) / 2.;
|
let corner = position - DVec2::splat(size) / 2.;
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
@@ -727,7 +729,7 @@ impl OverlayContext {
|
|||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
let center = compass_center.round() - DVec2::splat(0.5);
|
let center = self.snap_to_physical_pixel_center(compass_center);
|
||||||
|
|
||||||
// Save the old line width to restore it later
|
// Save the old line width to restore it later
|
||||||
let old_line_width = self.render_context.line_width();
|
let old_line_width = self.render_context.line_width();
|
||||||
@@ -781,7 +783,7 @@ impl OverlayContext {
|
|||||||
|
|
||||||
pub fn pivot(&mut self, position: DVec2, angle: f64) {
|
pub fn pivot(&mut self, position: DVec2, angle: f64) {
|
||||||
let uv = DVec2::from_angle(angle);
|
let uv = DVec2::from_angle(angle);
|
||||||
let (x, y) = (position.round() - DVec2::splat(0.5)).into();
|
let (x, y) = self.snap_to_physical_pixel_center(position).into();
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
|
|
||||||
@@ -816,7 +818,7 @@ impl OverlayContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn dowel_pin(&mut self, position: DVec2, angle: f64, color: Option<&str>) {
|
pub fn dowel_pin(&mut self, position: DVec2, angle: f64, color: Option<&str>) {
|
||||||
let (x, y) = (position.round() - DVec2::splat(0.5)).into();
|
let (x, y) = self.snap_to_physical_pixel_center(position).into();
|
||||||
let color = color.unwrap_or(COLOR_OVERLAY_YELLOW_DULL);
|
let color = color.unwrap_or(COLOR_OVERLAY_YELLOW_DULL);
|
||||||
|
|
||||||
self.start_dpi_aware_transform();
|
self.start_dpi_aware_transform();
|
||||||
@@ -941,29 +943,30 @@ impl OverlayContext {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let start_point = transform.transform_point2(point_to_dvec2(first.start()));
|
let start_point = transform.transform_point2(point_to_dvec2(first.start()));
|
||||||
|
let start_point = self.snap_to_physical_pixel(start_point);
|
||||||
self.render_context.move_to(start_point.x, start_point.y);
|
self.render_context.move_to(start_point.x, start_point.y);
|
||||||
|
|
||||||
for curve in curves {
|
for curve in curves {
|
||||||
match curve {
|
match curve {
|
||||||
PathSeg::Line(line) => {
|
PathSeg::Line(line) => {
|
||||||
let a = transform.transform_point2(point_to_dvec2(line.p1));
|
let a = transform.transform_point2(point_to_dvec2(line.p1));
|
||||||
let a = a.round() - DVec2::splat(0.5);
|
let a = self.snap_to_physical_pixel_center(a);
|
||||||
self.render_context.line_to(a.x, a.y);
|
self.render_context.line_to(a.x, a.y);
|
||||||
}
|
}
|
||||||
PathSeg::Quad(quad_bez) => {
|
PathSeg::Quad(quad_bez) => {
|
||||||
let a = transform.transform_point2(point_to_dvec2(quad_bez.p1));
|
let a = transform.transform_point2(point_to_dvec2(quad_bez.p1));
|
||||||
let b = transform.transform_point2(point_to_dvec2(quad_bez.p2));
|
let b = transform.transform_point2(point_to_dvec2(quad_bez.p2));
|
||||||
let a = a.round() - DVec2::splat(0.5);
|
let a = self.snap_to_physical_pixel_center(a);
|
||||||
let b = b.round() - DVec2::splat(0.5);
|
let b = self.snap_to_physical_pixel_center(b);
|
||||||
self.render_context.quadratic_curve_to(a.x, a.y, b.x, b.y);
|
self.render_context.quadratic_curve_to(a.x, a.y, b.x, b.y);
|
||||||
}
|
}
|
||||||
PathSeg::Cubic(cubic_bez) => {
|
PathSeg::Cubic(cubic_bez) => {
|
||||||
let a = transform.transform_point2(point_to_dvec2(cubic_bez.p1));
|
let a = transform.transform_point2(point_to_dvec2(cubic_bez.p1));
|
||||||
let b = transform.transform_point2(point_to_dvec2(cubic_bez.p2));
|
let b = transform.transform_point2(point_to_dvec2(cubic_bez.p2));
|
||||||
let c = transform.transform_point2(point_to_dvec2(cubic_bez.p3));
|
let c = transform.transform_point2(point_to_dvec2(cubic_bez.p3));
|
||||||
let a = a.round() - DVec2::splat(0.5);
|
let a = self.snap_to_physical_pixel_center(a);
|
||||||
let b = b.round() - DVec2::splat(0.5);
|
let b = self.snap_to_physical_pixel_center(b);
|
||||||
let c = c.round() - DVec2::splat(0.5);
|
let c = self.snap_to_physical_pixel_center(c);
|
||||||
self.render_context.bezier_curve_to(a.x, a.y, b.x, b.y, c.x, c.y);
|
self.render_context.bezier_curve_to(a.x, a.y, b.x, b.y, c.x, c.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1110,6 +1113,22 @@ impl OverlayContext {
|
|||||||
self.line(quad.bottom_left(), quad.bottom_right(), None, None);
|
self.line(quad.bottom_left(), quad.bottom_right(), None, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn snap_to_physical_pixel(&self, p: DVec2) -> DVec2 {
|
||||||
|
let s = self.viewport.scale();
|
||||||
|
if !s.is_finite() || s <= 0.0 {
|
||||||
|
return p.round();
|
||||||
|
}
|
||||||
|
(p * s).round() / s
|
||||||
|
}
|
||||||
|
|
||||||
|
fn snap_to_physical_pixel_center(&self, p: DVec2) -> DVec2 {
|
||||||
|
let s = self.viewport.scale();
|
||||||
|
if !s.is_finite() || s <= 0.0 {
|
||||||
|
return p.round() - DVec2::splat(0.5);
|
||||||
|
}
|
||||||
|
self.snap_to_physical_pixel(p) - DVec2::splat(0.5 / s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Pivot {
|
pub enum Pivot {
|
||||||
|
|||||||
+3
@@ -15,6 +15,7 @@ pub struct PropertiesPanelMessageContext<'a> {
|
|||||||
pub document_name: &'a str,
|
pub document_name: &'a str,
|
||||||
pub fonts: &'a FontsMessageHandler,
|
pub fonts: &'a FontsMessageHandler,
|
||||||
pub properties_panel_open: bool,
|
pub properties_panel_open: bool,
|
||||||
|
pub properties_panel_collapsed_sections: &'a [NodeId],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, ExtractField)]
|
#[derive(Debug, Clone, Default, ExtractField)]
|
||||||
@@ -31,6 +32,7 @@ impl MessageHandler<PropertiesPanelMessage, PropertiesPanelMessageContext<'_>> f
|
|||||||
document_name,
|
document_name,
|
||||||
fonts,
|
fonts,
|
||||||
properties_panel_open,
|
properties_panel_open,
|
||||||
|
properties_panel_collapsed_sections,
|
||||||
} = context;
|
} = context;
|
||||||
|
|
||||||
match message {
|
match message {
|
||||||
@@ -54,6 +56,7 @@ impl MessageHandler<PropertiesPanelMessage, PropertiesPanelMessageContext<'_>> f
|
|||||||
selection_network_path,
|
selection_network_path,
|
||||||
document_name,
|
document_name,
|
||||||
fonts,
|
fonts,
|
||||||
|
properties_panel_collapsed_sections,
|
||||||
};
|
};
|
||||||
let layout = Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context));
|
let layout = Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context));
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
use super::network_interface::NodeTemplate;
|
|
||||||
use graph_craft::document::NodeId;
|
|
||||||
|
|
||||||
#[repr(u8)]
|
|
||||||
#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, Eq, Debug)]
|
|
||||||
pub enum Clipboard {
|
|
||||||
Internal,
|
|
||||||
Device,
|
|
||||||
|
|
||||||
_InternalClipboardCount, // Keep this as the last entry of **internal** clipboards since it is used for counting the number of enum variants
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const INTERNAL_CLIPBOARD_COUNT: u8 = Clipboard::_InternalClipboardCount as u8;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct CopyBufferEntry {
|
|
||||||
pub nodes: Vec<(NodeId, NodeTemplate)>,
|
|
||||||
pub selected: bool,
|
|
||||||
pub visible: bool,
|
|
||||||
pub locked: bool,
|
|
||||||
pub collapsed: bool,
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
pub mod clipboards;
|
|
||||||
pub mod document_metadata;
|
pub mod document_metadata;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod misc;
|
pub mod misc;
|
||||||
|
|||||||
@@ -352,6 +352,12 @@ impl NodeNetworkInterface {
|
|||||||
node.inputs.len()
|
node.inputs.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether the node has an exposed input at index 0 to accept the horizontal flow from upstream.
|
||||||
|
/// A node without one (e.g. a generator) can only be the most-upstream node in a chain.
|
||||||
|
pub fn has_primary_input(&self, node_id: &NodeId, network_path: &[NodeId]) -> bool {
|
||||||
|
self.input_from_connector(&InputConnector::node(*node_id, 0), network_path).is_some_and(|input| input.is_exposed())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn number_of_outputs(&self, node_id: &NodeId, network_path: &[NodeId]) -> usize {
|
pub fn number_of_outputs(&self, node_id: &NodeId, network_path: &[NodeId]) -> usize {
|
||||||
let Some(implementation) = self.implementation(node_id, network_path) else {
|
let Some(implementation) = self.implementation(node_id, network_path) else {
|
||||||
log::error!("Could not get node {node_id} in number_of_outputs");
|
log::error!("Could not get node {node_id} in number_of_outputs");
|
||||||
@@ -1054,6 +1060,35 @@ impl NodeNetworkInterface {
|
|||||||
node_metadata.persistent_metadata.pinned
|
node_metadata.persistent_metadata.pinned
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The given network's pinned nodes in display order: pinning appends, dragging rearranges, and any not yet recorded go last.
|
||||||
|
pub fn ordered_pinned_nodes(&self, network_path: &[NodeId]) -> Vec<NodeId> {
|
||||||
|
let Some(network) = self.nested_network(network_path) else { return Vec::new() };
|
||||||
|
|
||||||
|
let order = self
|
||||||
|
.network_metadata(network_path)
|
||||||
|
.map(|network_metadata| network_metadata.persistent_metadata.pinned_node_order.clone())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
// Follow the saved order, keeping only nodes that still exist and are still pinned
|
||||||
|
let mut pinned_nodes = order
|
||||||
|
.iter()
|
||||||
|
.copied()
|
||||||
|
.filter(|node_id| network.nodes.contains_key(node_id) && self.is_pinned(node_id, network_path))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// Append any pinned nodes missing from the saved order at the end
|
||||||
|
let mut unordered = network
|
||||||
|
.nodes
|
||||||
|
.keys()
|
||||||
|
.copied()
|
||||||
|
.filter(|node_id| self.is_pinned(node_id, network_path) && !order.contains(node_id))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
unordered.sort();
|
||||||
|
pinned_nodes.extend(unordered);
|
||||||
|
|
||||||
|
pinned_nodes
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_visible(&self, node_id: &NodeId, network_path: &[NodeId]) -> bool {
|
pub fn is_visible(&self, node_id: &NodeId, network_path: &[NodeId]) -> bool {
|
||||||
let Some(node) = self.document_node(node_id, network_path) else {
|
let Some(node) = self.document_node(node_id, network_path) else {
|
||||||
log::error!("Could not get node in is_visible");
|
log::error!("Could not get node in is_visible");
|
||||||
@@ -4239,6 +4274,10 @@ impl NodeNetworkInterface {
|
|||||||
}
|
}
|
||||||
NodeTypePersistentMetadata::Node(_) => {}
|
NodeTypePersistentMetadata::Node(_) => {}
|
||||||
}
|
}
|
||||||
|
// Altering an export may move the connectors meaning the ports must be refreshed.
|
||||||
|
if matches!(input_connector, InputConnector::Export(_)) {
|
||||||
|
self.unload_import_export_ports(network_path);
|
||||||
|
}
|
||||||
self.unload_upstream_node_click_targets(vec![*upstream_node_id], network_path);
|
self.unload_upstream_node_click_targets(vec![*upstream_node_id], network_path);
|
||||||
self.unload_stack_dependents(network_path);
|
self.unload_stack_dependents(network_path);
|
||||||
self.try_set_upstream_to_chain(input_connector, network_path);
|
self.try_set_upstream_to_chain(input_connector, network_path);
|
||||||
@@ -4538,6 +4577,15 @@ impl NodeNetworkInterface {
|
|||||||
self.set_chain_position(&previous_chain_node, network_path);
|
self.set_chain_position(&previous_chain_node, network_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prune this network's pinned display order down to the nodes that still exist, dropping any that were actually removed
|
||||||
|
let surviving_nodes = self.nested_network(network_path).map(|network| network.nodes.keys().copied().collect::<HashSet<_>>());
|
||||||
|
if let Some(surviving_nodes) = surviving_nodes
|
||||||
|
&& let Some(network_metadata) = self.network_metadata_mut(network_path)
|
||||||
|
{
|
||||||
|
network_metadata.persistent_metadata.pinned_node_order.retain(|node_id| surviving_nodes.contains(node_id));
|
||||||
|
}
|
||||||
|
|
||||||
self.unload_all_nodes_bounding_box(network_path);
|
self.unload_all_nodes_bounding_box(network_path);
|
||||||
// Instead of unloaded all node click targets, just unload the nodes upstream from the deleted nodes. unload_upstream_node_click_targets will not work since the nodes have been deleted.
|
// Instead of unloaded all node click targets, just unload the nodes upstream from the deleted nodes. unload_upstream_node_click_targets will not work since the nodes have been deleted.
|
||||||
self.unload_all_nodes_click_targets(network_path);
|
self.unload_all_nodes_click_targets(network_path);
|
||||||
@@ -4720,6 +4768,43 @@ impl NodeNetworkInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
node_metadata.persistent_metadata.pinned = pinned;
|
node_metadata.persistent_metadata.pinned = pinned;
|
||||||
|
|
||||||
|
// Track the node in this network's pinned display order: append when newly pinned, prune when unpinned
|
||||||
|
if let Some(network_metadata) = self.network_metadata_mut(network_path) {
|
||||||
|
let order = &mut network_metadata.persistent_metadata.pinned_node_order;
|
||||||
|
if pinned {
|
||||||
|
if !order.contains(node_id) {
|
||||||
|
order.push(*node_id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
order.retain(|id| id != node_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.transaction_modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Reorders a pinned node within its network's Properties panel display order so it ends up at `insert_index` among the
|
||||||
|
/// pinned nodes (0 being the topmost). Rebuilds the order from the list as currently shown, which also drops stale entries.
|
||||||
|
pub fn reorder_pinned_node(&mut self, node_id: NodeId, insert_index: usize, network_path: &[NodeId]) {
|
||||||
|
let shown = self.ordered_pinned_nodes(network_path);
|
||||||
|
|
||||||
|
let Some(from) = shown.iter().position(|id| *id == node_id) else { return };
|
||||||
|
let to = (if insert_index > from { insert_index - 1 } else { insert_index }).min(shown.len().saturating_sub(1));
|
||||||
|
if to == from {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut new_order = shown;
|
||||||
|
let moved = new_order.remove(from);
|
||||||
|
new_order.insert(to, moved);
|
||||||
|
|
||||||
|
let Some(network_metadata) = self.network_metadata_mut(network_path) else {
|
||||||
|
log::error!("Could not get network_metadata in reorder_pinned_node");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
network_metadata.persistent_metadata.pinned_node_order = new_order;
|
||||||
|
|
||||||
self.transaction_modified();
|
self.transaction_modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5998,6 +6083,68 @@ impl NodeNetworkInterface {
|
|||||||
self.force_set_upstream_to_chain(node_id, network_path);
|
self.force_set_upstream_to_chain(node_id, network_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reorders a node within its layer's horizontal chain so it ends up at `insert_index` among the chain's nodes,
|
||||||
|
/// where index 0 is the node closest to the layer. The connection feeding the top (most-upstream end) of the chain
|
||||||
|
/// is preserved, as are each node's other (non-primary) inputs.
|
||||||
|
pub fn reorder_chain_node(&mut self, node_id: NodeId, insert_index: usize, network_path: &[NodeId]) {
|
||||||
|
let Some(layer) = self.downstream_layer_for_chain_node(&node_id, network_path) else {
|
||||||
|
log::error!("Could not find downstream layer for chain node {node_id} in reorder_chain_node");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The nodes in the layer's chain, ordered from closest-to-layer outward, stopping at the next layer
|
||||||
|
let chain = self
|
||||||
|
.upstream_flow_back_from_nodes(vec![layer], network_path, FlowType::HorizontalFlow)
|
||||||
|
.skip(1)
|
||||||
|
.take_while(|upstream_id| !self.is_layer(upstream_id, network_path))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// A source node (no primary input) stays pinned at the most-upstream end; only the nodes below it reorder
|
||||||
|
let pinned_source = chain.last().copied().filter(|last| !self.has_primary_input(last, network_path));
|
||||||
|
let reorderable = &chain[..chain.len() - pinned_source.is_some() as usize];
|
||||||
|
|
||||||
|
let Some(from) = reorderable.iter().position(|id| *id == node_id) else {
|
||||||
|
log::error!("Node {node_id} is not a reorderable node in its layer's chain in reorder_chain_node");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The drop gap is measured against the reorderable nodes that still include the dragged node, so shift it down by one if the node is being removed from before the gap
|
||||||
|
let to = (if insert_index > from { insert_index - 1 } else { insert_index }).min(reorderable.len() - 1);
|
||||||
|
if to == from {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut new_order = reorderable.to_vec();
|
||||||
|
new_order.remove(from);
|
||||||
|
new_order.insert(to, node_id);
|
||||||
|
|
||||||
|
// The most-upstream reorderable node connects up to the pinned source, or else whatever fed the top of the chain
|
||||||
|
let tail_input = if let Some(source) = pinned_source {
|
||||||
|
NodeInput::node(source, 0)
|
||||||
|
} else {
|
||||||
|
let Some(input) = self.input_from_connector(&InputConnector::node(*chain.last().unwrap(), 0), network_path).cloned() else {
|
||||||
|
log::error!("Could not get the upstream input of the chain in reorder_chain_node");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
input
|
||||||
|
};
|
||||||
|
|
||||||
|
// Disconnect first so the rewiring can't transiently form a cycle (the pinned source keeps its wiring)
|
||||||
|
for &chain_node in reorderable {
|
||||||
|
self.disconnect_input(&InputConnector::node(chain_node, 0), network_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rewire in the new order: layer's secondary input -> new_order[0] -> ... -> new_order[last] -> tail input
|
||||||
|
self.set_input(&InputConnector::node(layer, 1), NodeInput::node(new_order[0], 0), network_path);
|
||||||
|
for pair in new_order.windows(2) {
|
||||||
|
self.set_input(&InputConnector::node(pair[0], 0), NodeInput::node(pair[1], 0), network_path);
|
||||||
|
}
|
||||||
|
self.set_input(&InputConnector::node(*new_order.last().unwrap(), 0), tail_input, network_path);
|
||||||
|
|
||||||
|
// Re-establish chain positioning for the reordered nodes
|
||||||
|
self.force_set_upstream_to_chain(&new_order[0], network_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
@@ -6342,6 +6489,9 @@ pub struct NodeNetworkPersistentMetadata {
|
|||||||
/// Node metadata must exist for every document node in the network
|
/// Node metadata must exist for every document node in the network
|
||||||
#[serde(serialize_with = "graphene_std::vector::serialize_hashmap", deserialize_with = "graphene_std::vector::deserialize_hashmap")]
|
#[serde(serialize_with = "graphene_std::vector::serialize_hashmap", deserialize_with = "graphene_std::vector::deserialize_hashmap")]
|
||||||
pub node_metadata: HashMap<NodeId, DocumentNodeMetadata>,
|
pub node_metadata: HashMap<NodeId, DocumentNodeMetadata>,
|
||||||
|
/// The display order of pinned nodes in the Properties panel (shown when nothing is selected in this network), keyed by node ID.
|
||||||
|
#[serde(default)]
|
||||||
|
pub pinned_node_order: Vec<NodeId>,
|
||||||
/// Cached metadata for each node, which is calculated when adding a node to node_metadata
|
/// Cached metadata for each node, which is calculated when adding a node to node_metadata
|
||||||
/// Indicates whether the network is currently rendered with a particular node that is previewed, and if so, which connection should be restored when the preview ends.
|
/// Indicates whether the network is currently rendered with a particular node that is previewed, and if so, which connection should be restored when the preview ends.
|
||||||
pub previewing: Previewing,
|
pub previewing: Previewing,
|
||||||
@@ -6828,17 +6978,22 @@ pub enum TransactionStatus {
|
|||||||
|
|
||||||
fn collect_network_resources(network: &NodeNetwork, out: &mut HashSet<ResourceId>) {
|
fn collect_network_resources(network: &NodeNetwork, out: &mut HashSet<ResourceId>) {
|
||||||
for node in network.nodes.values() {
|
for node in network.nodes.values() {
|
||||||
for input in &node.inputs {
|
collect_node_resources(node, out);
|
||||||
if let NodeInput::Value { tagged_value, .. } = input
|
}
|
||||||
&& let TaggedValue::Resource(id) = &**tagged_value
|
}
|
||||||
{
|
|
||||||
out.insert(*id);
|
/// Collects resource IDs referenced by a node and its nested networks.
|
||||||
}
|
pub fn collect_node_resources(node: &DocumentNode, out: &mut HashSet<ResourceId>) {
|
||||||
}
|
for input in &node.inputs {
|
||||||
if let DocumentNodeImplementation::Network(nested) = &node.implementation {
|
if let NodeInput::Value { tagged_value, .. } = input
|
||||||
collect_network_resources(nested, out);
|
&& let TaggedValue::Resource(id) = &**tagged_value
|
||||||
|
{
|
||||||
|
out.insert(*id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let DocumentNodeImplementation::Network(nested) = &node.implementation {
|
||||||
|
collect_network_resources(nested, out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -6853,18 +7008,19 @@ mod network_interface_tests {
|
|||||||
.await;
|
.await;
|
||||||
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![rectangle] }).await;
|
editor.handle_message(NodeGraphMessage::SelectedNodesSet { nodes: vec![rectangle] }).await;
|
||||||
let frontend_messages = editor.handle_message(NodeGraphMessage::Copy).await;
|
let frontend_messages = editor.handle_message(NodeGraphMessage::Copy).await;
|
||||||
let serialized_nodes = frontend_messages
|
let clipboard = frontend_messages
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find_map(|msg| match msg {
|
.find_map(|msg| match msg {
|
||||||
FrontendMessage::TriggerClipboardWrite { content } => Some(content),
|
FrontendMessage::TriggerClipboardWrite { content } => Some(content),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.expect("copy message should be dispatched")
|
.expect("copy message should be dispatched");
|
||||||
.strip_prefix("graphite/nodes: ")
|
println!("Clipboard: {clipboard}");
|
||||||
.expect("should start with magic string")
|
editor
|
||||||
.to_string();
|
.handle_message(ClipboardMessage::ReadClipboard {
|
||||||
println!("Serialized: {serialized_nodes}");
|
content: ClipboardContentRaw::Text(clipboard),
|
||||||
editor.handle_message(NodeGraphMessage::PasteNodes { serialized_nodes }).await;
|
})
|
||||||
|
.await;
|
||||||
let nodes = &mut editor.active_document_mut().network_interface.network_mut(&[]).unwrap().nodes;
|
let nodes = &mut editor.active_document_mut().network_interface.network_mut(&[]).unwrap().nodes;
|
||||||
let orignal = nodes.remove(&rectangle).expect("original node should exist");
|
let orignal = nodes.remove(&rectangle).expect("original node should exist");
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::messages::portfolio::document::node_graph::document_node_definitions:
|
|||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate, OutputConnector};
|
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate, OutputConnector};
|
||||||
use crate::messages::prelude::DocumentMessageHandler;
|
use crate::messages::prelude::DocumentMessageHandler;
|
||||||
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use glam::{DVec2, IVec2};
|
use glam::{DVec2, IVec2};
|
||||||
use graph_craft::application_io::resource::{DataSource, Resource, ResourceHash, ResourceId};
|
use graph_craft::application_io::resource::{DataSource, Resource, ResourceHash, ResourceId};
|
||||||
use graph_craft::descriptor;
|
use graph_craft::descriptor;
|
||||||
@@ -1121,8 +1122,8 @@ pub fn document_migration_replace_resources_referenced_by_hash(document_serializ
|
|||||||
pub fn document_migration_upgrades(document: &mut DocumentMessageHandler, reset_node_definitions_on_open: bool) {
|
pub fn document_migration_upgrades(document: &mut DocumentMessageHandler, reset_node_definitions_on_open: bool) {
|
||||||
document.network_interface.migrate_path_modify_node();
|
document.network_interface.migrate_path_modify_node();
|
||||||
|
|
||||||
// Legacy `Fill::Gradient`s are converted to absolute by the deferred migration pass once the first graph run yields geometry bounds
|
// Legacy `Fill::Gradient`s are converted to absolute by the deferred migration pre-pass that measures each fill's geometry
|
||||||
document.pending_gradient_migration = true;
|
document.pending_gradient_migration = !graph_modification_utils::legacy_gradient_fill_nodes(&document.network_interface).is_empty();
|
||||||
|
|
||||||
let network = document.network_interface.document_network().clone();
|
let network = document.network_interface.document_network().clone();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ use super::document::utility_types::document_metadata::LayerNodeIdentifier;
|
|||||||
use super::persistent_state::PersistentStateMessage;
|
use super::persistent_state::PersistentStateMessage;
|
||||||
use super::utility_types::{DockingSplitDirection, PanelGroupId, PanelType};
|
use super::utility_types::{DockingSplitDirection, PanelGroupId, PanelType};
|
||||||
use crate::messages::frontend::utility_types::{ExportBounds, FileType, PersistedState};
|
use crate::messages::frontend::utility_types::{ExportBounds, FileType, PersistedState};
|
||||||
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use graphene_std::Color;
|
use graphene_std::Color;
|
||||||
use graphene_std::raster::Image;
|
use graphene_std::raster::Image;
|
||||||
@@ -39,12 +38,6 @@ pub enum PortfolioMessage {
|
|||||||
CloseDocumentWithConfirmation {
|
CloseDocumentWithConfirmation {
|
||||||
document_id: DocumentId,
|
document_id: DocumentId,
|
||||||
},
|
},
|
||||||
Copy {
|
|
||||||
clipboard: Clipboard,
|
|
||||||
},
|
|
||||||
Cut {
|
|
||||||
clipboard: Clipboard,
|
|
||||||
},
|
|
||||||
DeleteDocument {
|
DeleteDocument {
|
||||||
document_id: DocumentId,
|
document_id: DocumentId,
|
||||||
},
|
},
|
||||||
@@ -113,31 +106,19 @@ pub enum PortfolioMessage {
|
|||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
svg: String,
|
svg: String,
|
||||||
},
|
},
|
||||||
PasteSerializedData {
|
InsertImage {
|
||||||
data: String,
|
|
||||||
},
|
|
||||||
PasteSerializedVector {
|
|
||||||
data: String,
|
|
||||||
},
|
|
||||||
PasteImage {
|
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
image: Image<Color>,
|
image: Image<Color>,
|
||||||
mouse: Option<(f64, f64)>,
|
mouse: Option<(f64, f64)>,
|
||||||
parent_and_insert_index: Option<(LayerNodeIdentifier, usize)>,
|
parent_and_insert_index: Option<(LayerNodeIdentifier, usize)>,
|
||||||
},
|
},
|
||||||
PasteSvg {
|
InsertSvg {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
svg: String,
|
svg: String,
|
||||||
mouse: Option<(f64, f64)>,
|
mouse: Option<(f64, f64)>,
|
||||||
parent_and_insert_index: Option<(LayerNodeIdentifier, usize)>,
|
parent_and_insert_index: Option<(LayerNodeIdentifier, usize)>,
|
||||||
},
|
},
|
||||||
// TODO: Unused except by tests, remove?
|
CenterLayers {
|
||||||
PasteIntoFolder {
|
|
||||||
clipboard: Clipboard,
|
|
||||||
parent: LayerNodeIdentifier,
|
|
||||||
insert_index: usize,
|
|
||||||
},
|
|
||||||
CenterPastedLayers {
|
|
||||||
layers: Vec<LayerNodeIdentifier>,
|
layers: Vec<LayerNodeIdentifier>,
|
||||||
},
|
},
|
||||||
PrevDocument,
|
PrevDocument,
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
use super::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use super::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use super::document::utility_types::network_interface;
|
|
||||||
use super::persistent_state::{PersistentStateMessage, PersistentStateMessageContext, PersistentStateMessageHandler};
|
use super::persistent_state::{PersistentStateMessage, PersistentStateMessageContext, PersistentStateMessageHandler};
|
||||||
use super::utility_types::{PanelLayoutSubdivision, PanelType, WorkspacePanelLayout};
|
use super::utility_types::{PanelLayoutSubdivision, PanelType, WorkspacePanelLayout};
|
||||||
use crate::application::{Editor, generate_uuid};
|
use crate::application::{Editor, generate_uuid};
|
||||||
use crate::consts::{DEFAULT_DOCUMENT_NAME, DEFAULT_STROKE_WIDTH, FILE_EXTENSION};
|
use crate::consts::{DEFAULT_DOCUMENT_NAME, FILE_EXTENSION};
|
||||||
use crate::messages::animation::TimingInformation;
|
use crate::messages::animation::TimingInformation;
|
||||||
use crate::messages::clipboard::utility_types::ClipboardContent;
|
|
||||||
use crate::messages::dialog::simple_dialogs;
|
use crate::messages::dialog::simple_dialogs;
|
||||||
use crate::messages::frontend::utility_types::{DocumentInfo, PersistedState};
|
use crate::messages::frontend::utility_types::{DocumentInfo, PersistedState};
|
||||||
use crate::messages::input_mapper::utility_types::input_keyboard::Key;
|
use crate::messages::input_mapper::utility_types::input_keyboard::Key;
|
||||||
@@ -13,15 +11,12 @@ use crate::messages::input_mapper::utility_types::macros::{action_shortcut, acti
|
|||||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||||
use crate::messages::portfolio::document::DocumentMessageContext;
|
use crate::messages::portfolio::document::DocumentMessageContext;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::{self, resolve_network_node_type};
|
use crate::messages::portfolio::document::node_graph::document_node_definitions;
|
||||||
use crate::messages::portfolio::document::utility_types::clipboards::{Clipboard, CopyBufferEntry, INTERNAL_CLIPBOARD_COUNT};
|
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::OutputConnector;
|
use crate::messages::portfolio::document::utility_types::network_interface::OutputConnector;
|
||||||
use crate::messages::portfolio::document::utility_types::nodes::SelectedNodes;
|
|
||||||
use crate::messages::portfolio::document_migration::*;
|
use crate::messages::portfolio::document_migration::*;
|
||||||
use crate::messages::portfolio::utility_types::FileContent;
|
use crate::messages::portfolio::utility_types::FileContent;
|
||||||
use crate::messages::preferences::SelectionMode;
|
use crate::messages::preferences::SelectionMode;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
|
||||||
use crate::messages::tool::utility_types::{HintData, ToolType};
|
use crate::messages::tool::utility_types::{HintData, ToolType};
|
||||||
use crate::messages::viewport::ToPhysical;
|
use crate::messages::viewport::ToPhysical;
|
||||||
use crate::node_graph_executor::{ExportConfig, NodeGraphExecutor};
|
use crate::node_graph_executor::{ExportConfig, NodeGraphExecutor};
|
||||||
@@ -31,9 +26,6 @@ use graph_craft::document::NodeId;
|
|||||||
use graphene_std::Color;
|
use graphene_std::Color;
|
||||||
use graphene_std::raster_types::Image;
|
use graphene_std::raster_types::Image;
|
||||||
use graphene_std::renderer::Quad;
|
use graphene_std::renderer::Quad;
|
||||||
use graphene_std::subpath::BezierHandles;
|
|
||||||
use graphene_std::vector::misc::HandleId;
|
|
||||||
use graphene_std::vector::{PointId, SegmentId, Vector, VectorModificationType};
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
@@ -68,7 +60,6 @@ pub struct PortfolioMessageHandler {
|
|||||||
pub(crate) active_document_id: Option<DocumentId>,
|
pub(crate) active_document_id: Option<DocumentId>,
|
||||||
persistent_state: PersistentStateMessageHandler,
|
persistent_state: PersistentStateMessageHandler,
|
||||||
pub fonts: FontsMessageHandler,
|
pub fonts: FontsMessageHandler,
|
||||||
copy_buffer: [Vec<CopyBufferEntry>; INTERNAL_CLIPBOARD_COUNT as usize],
|
|
||||||
pub executor: NodeGraphExecutor,
|
pub executor: NodeGraphExecutor,
|
||||||
pub selection_mode: SelectionMode,
|
pub selection_mode: SelectionMode,
|
||||||
pub reset_node_definitions_on_open: bool,
|
pub reset_node_definitions_on_open: bool,
|
||||||
@@ -281,86 +272,6 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
responses.add(PortfolioMessage::SelectDocument { document_id });
|
responses.add(PortfolioMessage::SelectDocument { document_id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PortfolioMessage::Copy { clipboard } => {
|
|
||||||
if context.current_tool == &ToolType::Path {
|
|
||||||
responses.add(PathToolMessage::Copy { clipboard });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We can't use `self.active_document()` because it counts as an immutable borrow of the entirety of `self`
|
|
||||||
let Some(active_document) = self.active_document_id.and_then(|id| self.documents.get_mut(&id)) else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
if active_document.graph_view_overlay_open() {
|
|
||||||
responses.add(NodeGraphMessage::Copy);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut copy_val = |buffer: &mut Vec<CopyBufferEntry>| {
|
|
||||||
let mut ordered_last_elements = active_document.network_interface.shallowest_unique_layers(&[]).collect::<Vec<_>>();
|
|
||||||
|
|
||||||
ordered_last_elements.sort_by_key(|layer| {
|
|
||||||
let Some(parent) = layer.parent(active_document.metadata()) else { return usize::MAX };
|
|
||||||
DocumentMessageHandler::get_calculated_insert_index(active_document.metadata(), &SelectedNodes(vec![layer.to_node()]), parent)
|
|
||||||
});
|
|
||||||
|
|
||||||
for layer in ordered_last_elements.into_iter() {
|
|
||||||
let layer_node_id = layer.to_node();
|
|
||||||
|
|
||||||
let mut copy_ids = HashMap::new();
|
|
||||||
copy_ids.insert(layer_node_id, NodeId(0));
|
|
||||||
|
|
||||||
active_document
|
|
||||||
.network_interface
|
|
||||||
.upstream_flow_back_from_nodes(vec![layer_node_id], &[], network_interface::FlowType::LayerChildrenUpstreamFlow)
|
|
||||||
.enumerate()
|
|
||||||
.for_each(|(index, node_id)| {
|
|
||||||
copy_ids.insert(node_id, NodeId((index + 1) as u64));
|
|
||||||
});
|
|
||||||
|
|
||||||
buffer.push(CopyBufferEntry {
|
|
||||||
nodes: active_document.network_interface.copy_nodes(©_ids, &[]).collect(),
|
|
||||||
selected: active_document.network_interface.selected_nodes().selected_layers_contains(layer, active_document.metadata()),
|
|
||||||
visible: active_document.network_interface.selected_nodes().layer_visible(layer, &active_document.network_interface),
|
|
||||||
locked: active_document.network_interface.selected_nodes().layer_locked(layer, &active_document.network_interface),
|
|
||||||
collapsed: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if clipboard == Clipboard::Device {
|
|
||||||
let mut buffer = Vec::new();
|
|
||||||
copy_val(&mut buffer);
|
|
||||||
let Ok(data) = serde_json::to_string(&buffer) else {
|
|
||||||
log::error!("Failed to serialize nodes for clipboard");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
responses.add(ClipboardMessage::Write {
|
|
||||||
content: ClipboardContent::Layer(data),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let copy_buffer = &mut self.copy_buffer;
|
|
||||||
copy_buffer[clipboard as usize].clear();
|
|
||||||
copy_val(&mut copy_buffer[clipboard as usize]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PortfolioMessage::Cut { clipboard } => {
|
|
||||||
if context.current_tool == &ToolType::Path {
|
|
||||||
responses.add(PathToolMessage::Cut { clipboard });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(active_document) = self.active_document()
|
|
||||||
&& active_document.graph_view_overlay_open()
|
|
||||||
{
|
|
||||||
responses.add(NodeGraphMessage::Cut);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
responses.add(PortfolioMessage::Copy { clipboard });
|
|
||||||
responses.add(DocumentMessage::DeleteSelectedLayers);
|
|
||||||
}
|
|
||||||
PortfolioMessage::DeleteDocument { document_id } => {
|
PortfolioMessage::DeleteDocument { document_id } => {
|
||||||
let document_index = self.document_index(document_id);
|
let document_index = self.document_index(document_id);
|
||||||
self.documents.remove(&document_id);
|
self.documents.remove(&document_id);
|
||||||
@@ -759,7 +670,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
FileContent::Svg(svg) => {
|
FileContent::Svg(svg) => {
|
||||||
responses.add(PortfolioMessage::PasteSvg {
|
responses.add(PortfolioMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -767,7 +678,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
FileContent::Image(image) => {
|
FileContent::Image(image) => {
|
||||||
responses.add(PortfolioMessage::PasteImage {
|
responses.add(PortfolioMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -959,7 +870,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
name: name.clone().unwrap_or_default(),
|
name: name.clone().unwrap_or_default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(DocumentMessage::PasteImage {
|
responses.add(DocumentMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -1014,7 +925,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(DocumentMessage::PasteSvg {
|
responses.add(DocumentMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
@@ -1036,153 +947,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into()],
|
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into()],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// TODO: Unused except by tests, remove?
|
PortfolioMessage::CenterLayers { layers } => {
|
||||||
PortfolioMessage::PasteIntoFolder { clipboard, parent, insert_index } => {
|
|
||||||
let mut all_new_ids = Vec::new();
|
|
||||||
let paste = |entry: &CopyBufferEntry, responses: &mut VecDeque<_>, all_new_ids: &mut Vec<NodeId>| {
|
|
||||||
if self.active_document().is_some() {
|
|
||||||
trace!("Pasting into folder {parent:?} as index: {insert_index}");
|
|
||||||
let nodes = entry.clone().nodes;
|
|
||||||
let new_ids: HashMap<_, _> = nodes.iter().map(|(id, _)| (*id, NodeId::new())).collect();
|
|
||||||
let layer = LayerNodeIdentifier::new_unchecked(new_ids[&NodeId(0)]);
|
|
||||||
all_new_ids.extend(new_ids.values().cloned());
|
|
||||||
responses.add(NodeGraphMessage::AddNodes { nodes, new_ids: new_ids.clone() });
|
|
||||||
responses.add(NodeGraphMessage::MoveLayerToStack { layer, parent, insert_index });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
responses.add(DocumentMessage::DeselectAllLayers);
|
|
||||||
|
|
||||||
for entry in self.copy_buffer[clipboard as usize].iter().rev() {
|
|
||||||
paste(entry, responses, &mut all_new_ids)
|
|
||||||
}
|
|
||||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
|
||||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: all_new_ids });
|
|
||||||
}
|
|
||||||
PortfolioMessage::PasteSerializedData { data } => {
|
|
||||||
if let Some(document) = self.active_document() {
|
|
||||||
let mut all_new_ids = Vec::new();
|
|
||||||
if let Ok(data) = serde_json::from_str::<Vec<CopyBufferEntry>>(&data) {
|
|
||||||
let parent = document.new_layer_parent(false);
|
|
||||||
let mut layers = Vec::new();
|
|
||||||
|
|
||||||
let mut added_nodes = false;
|
|
||||||
|
|
||||||
for entry in data.into_iter().rev() {
|
|
||||||
if !added_nodes {
|
|
||||||
responses.add(DocumentMessage::DeselectAllLayers);
|
|
||||||
responses.add(DocumentMessage::AddTransaction);
|
|
||||||
added_nodes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let new_ids: HashMap<_, _> = entry.nodes.iter().map(|(id, _)| (*id, NodeId::new())).collect();
|
|
||||||
let layer = LayerNodeIdentifier::new_unchecked(new_ids[&NodeId(0)]);
|
|
||||||
all_new_ids.extend(new_ids.values().cloned());
|
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::AddNodes { nodes: entry.nodes, new_ids });
|
|
||||||
responses.add(NodeGraphMessage::MoveLayerToStack { layer, parent, insert_index: 0 });
|
|
||||||
layers.push(layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
|
||||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: all_new_ids });
|
|
||||||
responses.add(DeferMessage::AfterGraphRun {
|
|
||||||
messages: vec![PortfolioMessage::CenterPastedLayers { layers }.into()],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Custom paste implementation for Path tool
|
|
||||||
PortfolioMessage::PasteSerializedVector { data } => {
|
|
||||||
// If using Path tool then send the operation to Path tool
|
|
||||||
if *current_tool == ToolType::Path {
|
|
||||||
responses.add(PathToolMessage::Paste { data });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not using Path tool, create new layers and add paths into those
|
|
||||||
if let Some(document) = self.active_document() {
|
|
||||||
let Ok(data) = serde_json::from_str::<Vec<(LayerNodeIdentifier, Vector, DAffine2)>>(&data) else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut layers = Vec::new();
|
|
||||||
|
|
||||||
for (_, new_vector, transform) in data {
|
|
||||||
let Some(node_type) = resolve_network_node_type("Path") else {
|
|
||||||
error!("Path node does not exist");
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let nodes = vec![(NodeId(0), node_type.default_node_template())];
|
|
||||||
|
|
||||||
let parent = document.new_layer_parent(false);
|
|
||||||
|
|
||||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
|
||||||
layers.push(layer);
|
|
||||||
|
|
||||||
// Adding the transform back into the layer
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform,
|
|
||||||
transform_in: TransformIn::Local,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add default fill and stroke to the layer
|
|
||||||
let fill = graphene_std::vector::style::Fill::solid(Color::WHITE);
|
|
||||||
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
|
||||||
|
|
||||||
let stroke = graphene_std::vector::style::Stroke::new(Some(Color::BLACK), DEFAULT_STROKE_WIDTH);
|
|
||||||
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
|
|
||||||
|
|
||||||
// Create new point ids and add those into the existing Vector path
|
|
||||||
let mut points_map = HashMap::new();
|
|
||||||
for (point, position) in new_vector.point_domain.iter() {
|
|
||||||
let new_point_id = PointId::generate();
|
|
||||||
points_map.insert(point, new_point_id);
|
|
||||||
let modification_type = VectorModificationType::InsertPoint { id: new_point_id, position };
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new segment ids and add the segments into the existing Vector path
|
|
||||||
let mut segments_map = HashMap::new();
|
|
||||||
for (segment_id, bezier, start, end) in new_vector.segment_bezier_iter() {
|
|
||||||
let new_segment_id = SegmentId::generate();
|
|
||||||
|
|
||||||
segments_map.insert(segment_id, new_segment_id);
|
|
||||||
|
|
||||||
let handles = match bezier.handles {
|
|
||||||
BezierHandles::Linear => [None, None],
|
|
||||||
BezierHandles::Quadratic { handle } => [Some(handle - bezier.start), None],
|
|
||||||
BezierHandles::Cubic { handle_start, handle_end } => [Some(handle_start - bezier.start), Some(handle_end - bezier.end)],
|
|
||||||
};
|
|
||||||
|
|
||||||
let points = [points_map[&start], points_map[&end]];
|
|
||||||
let modification_type = VectorModificationType::InsertSegment { id: new_segment_id, points, handles };
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set G1 continuity
|
|
||||||
for handles in new_vector.colinear_manipulators {
|
|
||||||
let to_new_handle = |handle: HandleId| -> HandleId {
|
|
||||||
HandleId {
|
|
||||||
ty: handle.ty,
|
|
||||||
segment: segments_map[&handle.segment],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let new_handles = [to_new_handle(handles[0]), to_new_handle(handles[1])];
|
|
||||||
let modification_type = VectorModificationType::SetG1Continuous { handles: new_handles, enabled: true };
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
|
||||||
responses.add(Message::Defer(DeferMessage::AfterGraphRun {
|
|
||||||
messages: vec![PortfolioMessage::CenterPastedLayers { layers }.into()],
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PortfolioMessage::CenterPastedLayers { layers } => {
|
|
||||||
if let Some(document) = self.active_document_mut() {
|
if let Some(document) = self.active_document_mut() {
|
||||||
let viewport_bounds_quad_pixels = Quad::from_box([DVec2::ZERO, viewport.size().into_dvec2()]); // In viewport pixel coordinates
|
let viewport_bounds_quad_pixels = Quad::from_box([DVec2::ZERO, viewport.size().into_dvec2()]); // In viewport pixel coordinates
|
||||||
let viewport_center_pixels = viewport_bounds_quad_pixels.center(); // In viewport pixel coordinates
|
let viewport_center_pixels = viewport_bounds_quad_pixels.center(); // In viewport pixel coordinates
|
||||||
@@ -1287,7 +1052,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PortfolioMessage::PasteImage {
|
PortfolioMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -1296,7 +1061,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
if self.document_ids.is_empty() {
|
if self.document_ids.is_empty() {
|
||||||
responses.add(PortfolioMessage::OpenImage { name, image });
|
responses.add(PortfolioMessage::OpenImage { name, image });
|
||||||
} else {
|
} else {
|
||||||
responses.add(DocumentMessage::PasteImage {
|
responses.add(DocumentMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -1305,7 +1070,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PortfolioMessage::PasteSvg {
|
PortfolioMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -1314,7 +1079,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
if self.document_ids.is_empty() {
|
if self.document_ids.is_empty() {
|
||||||
responses.add(PortfolioMessage::OpenSvg { name, svg });
|
responses.add(PortfolioMessage::OpenSvg { name, svg });
|
||||||
} else {
|
} else {
|
||||||
responses.add(DocumentMessage::PasteSvg {
|
responses.add(DocumentMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -1418,7 +1183,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
}
|
}
|
||||||
PortfolioMessage::RequestStatusBarInfoLayout => {
|
PortfolioMessage::RequestStatusBarInfoLayout => {
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
let widgets = vec![TextLabel::new("Graphite 1.0.0-RC5").disabled(true).widget_instance()]; // TODO: After the RCs, call this "Graphite (beta) x.y.z"
|
let widgets = vec![TextLabel::new("Graphite 1.0.0-RC6").disabled(true).widget_instance()]; // TODO: After the RCs, call this "Graphite (beta) x.y.z"
|
||||||
#[cfg(target_family = "wasm")]
|
#[cfg(target_family = "wasm")]
|
||||||
let widgets = vec![];
|
let widgets = vec![];
|
||||||
|
|
||||||
@@ -1621,6 +1386,13 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
// Use exact physical dimensions from browser (via ResizeObserver's devicePixelContentBoxSize)
|
// Use exact physical dimensions from browser (via ResizeObserver's devicePixelContentBoxSize)
|
||||||
let physical_resolution = viewport.size().to_physical().into_dvec2().round().as_uvec2();
|
let physical_resolution = viewport.size().to_physical().into_dvec2().round().as_uvec2();
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
// A freshly-opened document with legacy gradients runs a one-time measurement pre-pass instead of rendering, until every gradient is converted to absolute space
|
||||||
|
if document.pending_gradient_migration {
|
||||||
|
self.executor.drive_gradient_migration(document, document_id, physical_resolution, scale, responses);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Remove this when we do the SVG rendering with a separate library on desktop, thus avoiding a need for the hole punch.
|
// TODO: Remove this when we do the SVG rendering with a separate library on desktop, thus avoiding a need for the hole punch.
|
||||||
// TODO: See #3796. There is a second instance of this todo comment and code block (be sure to remove both).
|
// TODO: See #3796. There is a second instance of this todo comment and code block (be sure to remove both).
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
@@ -1809,14 +1581,6 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||||||
PrevDocument,
|
PrevDocument,
|
||||||
Import,
|
Import,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Extend with actions that must have a selected layer
|
|
||||||
if document.network_interface.selected_nodes().selected_layers(document.metadata()).next().is_some() {
|
|
||||||
common.extend(actions!(PortfolioMessageDiscriminant;
|
|
||||||
Copy,
|
|
||||||
Cut,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend with actions that are disabled when focusing the document
|
// Extend with actions that are disabled when focusing the document
|
||||||
@@ -1999,7 +1763,7 @@ impl PortfolioMessageHandler {
|
|||||||
return Err("No active document".to_string());
|
return Err("No active document".to_string());
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = self.executor.poll_node_graph_evaluation(active_document, responses);
|
let result = self.executor.poll_node_graph_evaluation(active_document, document_id, responses);
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
let error = r#"
|
let error = r#"
|
||||||
<rect x="50%" y="50%" width="460" height="100" transform="translate(-230 -50)" rx="4" fill="var(--color-warning-yellow)" />
|
<rect x="50%" y="50%" width="460" height="100" transform="translate(-230 -50)" rx="4" fill="var(--color-warning-yellow)" />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ pub use crate::messages::animation::{AnimationMessage, AnimationMessageDiscrimin
|
|||||||
pub use crate::messages::app_window::{AppWindowMessage, AppWindowMessageDiscriminant, AppWindowMessageHandler};
|
pub use crate::messages::app_window::{AppWindowMessage, AppWindowMessageDiscriminant, AppWindowMessageHandler};
|
||||||
pub use crate::messages::broadcast::event::{EventMessage, EventMessageContext, EventMessageDiscriminant, EventMessageHandler};
|
pub use crate::messages::broadcast::event::{EventMessage, EventMessageContext, EventMessageDiscriminant, EventMessageHandler};
|
||||||
pub use crate::messages::broadcast::{BroadcastMessage, BroadcastMessageDiscriminant, BroadcastMessageHandler};
|
pub use crate::messages::broadcast::{BroadcastMessage, BroadcastMessageDiscriminant, BroadcastMessageHandler};
|
||||||
pub use crate::messages::clipboard::{ClipboardMessage, ClipboardMessageDiscriminant, ClipboardMessageHandler};
|
pub use crate::messages::clipboard::{ClipboardMessage, ClipboardMessageContext, ClipboardMessageDiscriminant, ClipboardMessageHandler};
|
||||||
pub use crate::messages::color_picker::{ColorPickerMessage, ColorPickerMessageDiscriminant, ColorPickerMessageHandler};
|
pub use crate::messages::color_picker::{ColorPickerMessage, ColorPickerMessageDiscriminant, ColorPickerMessageHandler};
|
||||||
pub use crate::messages::debug::{DebugMessage, DebugMessageDiscriminant, DebugMessageHandler};
|
pub use crate::messages::debug::{DebugMessage, DebugMessageDiscriminant, DebugMessageHandler};
|
||||||
pub use crate::messages::defer::{DeferMessage, DeferMessageDiscriminant, DeferMessageHandler};
|
pub use crate::messages::defer::{DeferMessage, DeferMessageDiscriminant, DeferMessageHandler};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use crate::messages::portfolio::document::node_graph::document_node_definitions:
|
|||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{FlowType, InputConnector, NodeNetworkInterface, NodeTemplate};
|
use crate::messages::portfolio::document::utility_types::network_interface::{FlowType, InputConnector, NodeNetworkInterface, NodeTemplate};
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
use glam::DVec2;
|
use glam::{DAffine2, DVec2};
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use graph_craft::document::{NodeId, NodeInput};
|
use graph_craft::document::{NodeId, NodeInput};
|
||||||
use graph_craft::{ProtoNodeIdentifier, concrete};
|
use graph_craft::{ProtoNodeIdentifier, concrete};
|
||||||
@@ -319,6 +319,60 @@ pub fn get_gradient(layer: LayerNodeIdentifier, network_interface: &NodeNetworkI
|
|||||||
Some(gradient.clone())
|
Some(gradient.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// The legacy bounding-box-relative gradient (`absolute == false`) in a "Fill" node's active `fill` input, if any.
|
||||||
|
fn legacy_active_gradient_in_fill_node(fill_node_id: NodeId, network_interface: &NodeNetworkInterface) -> Option<Gradient> {
|
||||||
|
let node = network_interface.document_network().nodes.get(&fill_node_id)?;
|
||||||
|
let TaggedValue::Fill(Fill::Gradient(gradient)) = node.inputs.get(graphene_std::vector::fill::FillInput::<Fill>::INDEX)?.as_value()? else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
(!gradient.absolute).then(|| gradient.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// The legacy bounding-box-relative gradient (`absolute == false`) stashed in a "Fill" node's `_backup_gradient` input, if any.
|
||||||
|
/// The backup is inert until the fill is toggled back to a gradient, at which point it becomes the active fill, so it needs converting too.
|
||||||
|
fn legacy_backup_gradient_in_fill_node(fill_node_id: NodeId, network_interface: &NodeNetworkInterface) -> Option<Gradient> {
|
||||||
|
let node = network_interface.document_network().nodes.get(&fill_node_id)?;
|
||||||
|
let TaggedValue::FillGradient(gradient) = node.inputs.get(graphene_std::vector::fill::BackupGradientInput::INDEX)?.as_value()? else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
(!gradient.absolute).then(|| gradient.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Convert a "Fill" node's legacy gradients (the active `fill` and/or the stashed `_backup_gradient`) to absolute space using
|
||||||
|
/// the geometry's measured bounding box, writing each back in place. The active fill is written as a `Fill`, the backup as a bare `FillGradient`.
|
||||||
|
pub fn migrate_fill_node_gradients_to_absolute(fill_node_id: NodeId, network_interface: &mut NodeNetworkInterface, bounding_box: DAffine2, layer_transform: DAffine2) {
|
||||||
|
if let Some(gradient) = legacy_active_gradient_in_fill_node(fill_node_id, network_interface) {
|
||||||
|
let absolute = gradient.to_absolute(bounding_box, layer_transform);
|
||||||
|
let input = InputConnector::node(fill_node_id, graphene_std::vector::fill::FillInput::<Fill>::INDEX);
|
||||||
|
network_interface.set_input(&input, NodeInput::value(TaggedValue::Fill(Fill::Gradient(absolute)), false), &[]);
|
||||||
|
}
|
||||||
|
if let Some(gradient) = legacy_backup_gradient_in_fill_node(fill_node_id, network_interface) {
|
||||||
|
let absolute = gradient.to_absolute(bounding_box, layer_transform);
|
||||||
|
let input = InputConnector::node(fill_node_id, graphene_std::vector::fill::BackupGradientInput::INDEX);
|
||||||
|
network_interface.set_input(&input, NodeInput::value(TaggedValue::FillGradient(absolute), false), &[]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Find every root-network "Fill" node holding a legacy bounding-box-relative gradient, either as its active `fill` or as its `_backup_gradient`.
|
||||||
|
///
|
||||||
|
/// Scans the document network structurally instead of walking each layer's primary flow, so it also catches fills on
|
||||||
|
/// secondary inputs and in hidden, disabled, or orphaned branches. Fills nested inside subgraph node networks are skipped.
|
||||||
|
pub fn legacy_gradient_fill_nodes(network_interface: &NodeNetworkInterface) -> Vec<NodeId> {
|
||||||
|
let fill_identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::fill::IDENTIFIER);
|
||||||
|
network_interface
|
||||||
|
.document_network()
|
||||||
|
.nodes
|
||||||
|
.keys()
|
||||||
|
.copied()
|
||||||
|
.filter(|node_id| network_interface.reference(node_id, &[]).as_ref() == Some(&fill_identifier))
|
||||||
|
.filter(|&node_id| legacy_active_gradient_in_fill_node(node_id, network_interface).is_some() || legacy_backup_gradient_in_fill_node(node_id, network_interface).is_some())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the gradient stops of a layer, if any.
|
/// Get the gradient stops of a layer, if any.
|
||||||
pub fn get_gradient_stops(layer: LayerNodeIdentifier, network_interface: &NodeNetworkInterface) -> Option<GradientStops> {
|
pub fn get_gradient_stops(layer: LayerNodeIdentifier, network_interface: &NodeNetworkInterface) -> Option<GradientStops> {
|
||||||
let gradient_value_node = network_interface.document_network().nodes.get(&get_upstream_gradient_value_node_id(layer, network_interface)?)?;
|
let gradient_value_node = network_interface.document_network().nodes.get(&get_upstream_gradient_value_node_id(layer, network_interface)?)?;
|
||||||
|
|||||||
@@ -181,3 +181,44 @@ impl Resize {
|
|||||||
self.layer = None;
|
self.layer = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The viewport zoom factor, taken from the document-to-viewport transform so it accounts for zoom snapping and canvas flipping.
|
||||||
|
/// Divide a viewport-space measurement by this to convert it to document units.
|
||||||
|
pub fn viewport_zoom(document: &DocumentMessageHandler) -> f64 {
|
||||||
|
document.metadata().document_to_viewport.matrix2.determinant().abs().sqrt()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The viewport-space transform for a freshly drawn layer placed at `viewport_position`: window-aligned, so it is just the zoom (no tilt or flip).
|
||||||
|
/// Routing it through [`TransformIn::Viewport`] yields a document-space layer transform that counter-rotates the tilt/flip with the zoom left out.
|
||||||
|
/// `aspect` is an optional unitless local-frame stretch (e.g. for polygons and stars); pass [`DVec2::ONE`] for none.
|
||||||
|
pub fn window_aligned_transform(document: &DocumentMessageHandler, viewport_position: DVec2, aspect: DVec2) -> DAffine2 {
|
||||||
|
DAffine2::from_scale_angle_translation(viewport_zoom(document) * aspect, 0., viewport_position)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [`TransformSet`](GraphOperationMessage::TransformSet) applying [`window_aligned_transform`] to a freshly drawn layer, via
|
||||||
|
/// [`TransformIn::Viewport`] so the parent transform is resolved at execution time (also correct when the placement is deferred until after the graph runs).
|
||||||
|
pub fn window_aligned_transform_set(document: &DocumentMessageHandler, layer: LayerNodeIdentifier, viewport_position: DVec2, aspect: DVec2) -> Message {
|
||||||
|
GraphOperationMessage::TransformSet {
|
||||||
|
layer,
|
||||||
|
transform: window_aligned_transform(document, viewport_position, aspect),
|
||||||
|
transform_in: TransformIn::Viewport,
|
||||||
|
skip_rerender: false,
|
||||||
|
}
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// [`TransformSet`](GraphOperationMessage::TransformSet) placing a freshly drawn path-like layer (Pen, Freehand, Spline, Line, Arrow) at
|
||||||
|
/// `viewport_position` with only a translation: the drawn geometry holds the shape (including tilt), so the Transform node stays a pure document-space offset.
|
||||||
|
pub fn translation_transform_set(document: &DocumentMessageHandler, layer: LayerNodeIdentifier, viewport_position: DVec2) -> Message {
|
||||||
|
// Same orientation/scale as the document-to-viewport transform, but translated to land the layer's origin at the drawn viewport position.
|
||||||
|
let mut transform = document.metadata().document_to_viewport;
|
||||||
|
transform.translation = viewport_position;
|
||||||
|
|
||||||
|
GraphOperationMessage::TransformSet {
|
||||||
|
layer,
|
||||||
|
transform,
|
||||||
|
transform_in: TransformIn::Viewport,
|
||||||
|
skip_rerender: false,
|
||||||
|
}
|
||||||
|
.into()
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::shape_utility::ShapeToolModifierKey;
|
use super::shape_utility::ShapeToolModifierKey;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
||||||
@@ -9,7 +8,6 @@ use crate::messages::tool::common_functionality::gizmos::shape_gizmos::sweep_ang
|
|||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, arc_outline};
|
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, arc_outline};
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use graphene_std::vector::misc::ArcType;
|
use graphene_std::vector::misc::ArcType;
|
||||||
@@ -159,29 +157,26 @@ impl Arc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let dimensions = (start - end).abs();
|
let dimensions = (start - end).abs();
|
||||||
let mut scale = DVec2::ONE;
|
let mut aspect = DVec2::ONE;
|
||||||
let radius: f64;
|
let radius: f64;
|
||||||
|
|
||||||
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
||||||
if dimensions.x > dimensions.y {
|
if dimensions.x > dimensions.y {
|
||||||
scale.x = dimensions.x / dimensions.y;
|
aspect.x = dimensions.x / dimensions.y;
|
||||||
radius = dimensions.y / 2.;
|
radius = dimensions.y / 2.;
|
||||||
} else {
|
} else {
|
||||||
scale.y = dimensions.y / dimensions.x;
|
aspect.y = dimensions.y / dimensions.x;
|
||||||
radius = dimensions.x / 2.;
|
radius = dimensions.x / 2.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let radius = radius / viewport_zoom(document);
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, 1),
|
input_connector: InputConnector::node(node_id, 1),
|
||||||
input: NodeInput::value(TaggedValue::F64(radius), false),
|
input: NodeInput::value(TaggedValue::F64(radius), false),
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), aspect));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(scale, 0., start.midpoint(end)),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
||||||
use crate::messages::tool::common_functionality::gizmos::shape_gizmos::circle_arc_radius_handle::{RadiusHandle, RadiusHandleState};
|
use crate::messages::tool::common_functionality::gizmos::shape_gizmos::circle_arc_radius_handle::{RadiusHandle, RadiusHandleState};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
|
use crate::messages::tool::common_functionality::resize::{viewport_zoom, window_aligned_transform_set};
|
||||||
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
||||||
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, ShapeToolModifierKey};
|
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, ShapeToolModifierKey};
|
||||||
use crate::messages::tool::tool_messages::shape_tool::ShapeToolData;
|
use crate::messages::tool::tool_messages::shape_tool::ShapeToolData;
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
|
|
||||||
@@ -101,7 +100,7 @@ impl Circle {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let dimensions = (start - end).abs();
|
let dimensions = ((start - end) / viewport_zoom(document)).abs();
|
||||||
|
|
||||||
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
||||||
let radius: f64 = if dimensions.x > dimensions.y { dimensions.y / 2. } else { dimensions.x / 2. };
|
let radius: f64 = if dimensions.x > dimensions.y { dimensions.y / 2. } else { dimensions.x / 2. };
|
||||||
@@ -111,11 +110,6 @@ impl Circle {
|
|||||||
input: NodeInput::value(TaggedValue::F64(radius), false),
|
input: NodeInput::value(TaggedValue::F64(radius), false),
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), DVec2::ONE));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(DVec2::ONE, 0., start.midpoint(end)),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
use super::shape_utility::ShapeToolModifierKey;
|
use super::shape_utility::ShapeToolModifierKey;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@@ -36,20 +34,17 @@ impl Ellipse {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let radius = ((start - end) / 2. / viewport_zoom(document)).abs();
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, 1),
|
input_connector: InputConnector::node(node_id, 1),
|
||||||
input: NodeInput::value(TaggedValue::F64(((start.x - end.x) / 2.).abs()), false),
|
input: NodeInput::value(TaggedValue::F64(radius.x), false),
|
||||||
});
|
});
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, 2),
|
input_connector: InputConnector::node(node_id, 2),
|
||||||
input: NodeInput::value(TaggedValue::F64(((start.y - end.y) / 2.).abs()), false),
|
input: NodeInput::value(TaggedValue::F64(radius.y), false),
|
||||||
});
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_translation(start.midpoint(end)),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
});
|
||||||
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), DVec2::ONE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::shape_utility::ShapeToolModifierKey;
|
use super::shape_utility::ShapeToolModifierKey;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
@@ -10,7 +9,6 @@ use crate::messages::tool::common_functionality::graph_modification_utils;
|
|||||||
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
||||||
use crate::messages::tool::common_functionality::shapes::shape_utility::ShapeGizmoHandler;
|
use crate::messages::tool::common_functionality::shapes::shape_utility::ShapeGizmoHandler;
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use graphene_std::NodeInputDecleration;
|
use graphene_std::NodeInputDecleration;
|
||||||
@@ -117,6 +115,8 @@ impl Grid {
|
|||||||
|
|
||||||
let (translation, dimensions, angle) = calculate_grid_params(start, end, is_isometric, ipp.keyboard.key(center), ipp.keyboard.key(lock_ratio));
|
let (translation, dimensions, angle) = calculate_grid_params(start, end, is_isometric, ipp.keyboard.key(center), ipp.keyboard.key(lock_ratio));
|
||||||
|
|
||||||
|
let dimensions = dimensions / viewport_zoom(document);
|
||||||
|
|
||||||
// Set dimensions/spacing
|
// Set dimensions/spacing
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, SpacingInput::<f64>::INDEX),
|
input_connector: InputConnector::node(node_id, SpacingInput::<f64>::INDEX),
|
||||||
@@ -132,12 +132,7 @@ impl Grid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set transform
|
// Set transform
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, translation, DVec2::ONE));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(DVec2::ONE, 0., translation),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ pub mod shape_utility;
|
|||||||
pub mod spiral_shape;
|
pub mod spiral_shape;
|
||||||
pub mod star_shape;
|
pub mod star_shape;
|
||||||
|
|
||||||
|
pub use super::resize::{viewport_zoom, window_aligned_transform_set};
|
||||||
pub use super::shapes::arrow_shape::Arrow;
|
pub use super::shapes::arrow_shape::Arrow;
|
||||||
pub use super::shapes::ellipse_shape::Ellipse;
|
pub use super::shapes::ellipse_shape::Ellipse;
|
||||||
pub use super::shapes::line_shape::{Line, LineEnd};
|
pub use super::shapes::line_shape::{Line, LineEnd};
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::shape_utility::{ShapeToolModifierKey, update_radius_sign};
|
use super::shape_utility::{ShapeToolModifierKey, update_radius_sign};
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
@@ -12,7 +11,6 @@ use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
|||||||
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, polygon_outline};
|
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, polygon_outline};
|
||||||
use crate::messages::tool::tool_messages::shape_tool::ShapeOptionsUpdate;
|
use crate::messages::tool::tool_messages::shape_tool::ShapeOptionsUpdate;
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@@ -132,16 +130,18 @@ impl Polygon {
|
|||||||
let dimensions = (start - end).abs();
|
let dimensions = (start - end).abs();
|
||||||
|
|
||||||
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
||||||
let mut scale = DVec2::ONE;
|
let mut aspect = DVec2::ONE;
|
||||||
let radius;
|
let radius;
|
||||||
if dimensions.x > dimensions.y {
|
if dimensions.x > dimensions.y {
|
||||||
scale.x = dimensions.x / dimensions.y;
|
aspect.x = dimensions.x / dimensions.y;
|
||||||
radius = dimensions.y / 2.;
|
radius = dimensions.y / 2.;
|
||||||
} else {
|
} else {
|
||||||
scale.y = dimensions.y / dimensions.x;
|
aspect.y = dimensions.y / dimensions.x;
|
||||||
radius = dimensions.x / 2.;
|
radius = dimensions.x / 2.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let radius = radius / viewport_zoom(document);
|
||||||
|
|
||||||
let Some(node_id) = graph_modification_utils::get_polygon_id(layer, &document.network_interface) else {
|
let Some(node_id) = graph_modification_utils::get_polygon_id(layer, &document.network_interface) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -151,12 +151,7 @@ impl Polygon {
|
|||||||
input: NodeInput::value(TaggedValue::F64(radius), false),
|
input: NodeInput::value(TaggedValue::F64(radius), false),
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), aspect));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(scale, 0., (start + end) / 2.),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
use super::shape_utility::ShapeToolModifierKey;
|
use super::shape_utility::ShapeToolModifierKey;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_proto_node_type;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@@ -36,20 +34,17 @@ impl Rectangle {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let size = ((start - end) / viewport_zoom(document)).abs();
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, 1),
|
input_connector: InputConnector::node(node_id, 1),
|
||||||
input: NodeInput::value(TaggedValue::F64((start.x - end.x).abs()), false),
|
input: NodeInput::value(TaggedValue::F64(size.x), false),
|
||||||
});
|
});
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, 2),
|
input_connector: InputConnector::node(node_id, 2),
|
||||||
input: NodeInput::value(TaggedValue::F64((start.y - end.y).abs()), false),
|
input: NodeInput::value(TaggedValue::F64(size.y), false),
|
||||||
});
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_translation(start.midpoint(end)),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
});
|
||||||
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), DVec2::ONE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::frontend::utility_types::MouseCursorIcon;
|
use crate::messages::frontend::utility_types::MouseCursorIcon;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
@@ -135,7 +134,7 @@ impl Spiral {
|
|||||||
let snapped_viewport_point = document.metadata().document_to_viewport.transform_point2(snapped.snapped_point_document);
|
let snapped_viewport_point = document.metadata().document_to_viewport.transform_point2(snapped.snapped_point_document);
|
||||||
shape_tool_data.data.snap_manager.update_indicator(snapped);
|
shape_tool_data.data.snap_manager.update_indicator(snapped);
|
||||||
|
|
||||||
let dragged_distance = (viewport_drag_start - snapped_viewport_point).length();
|
let dragged_distance = (viewport_drag_start - snapped_viewport_point).length() / viewport_zoom(document);
|
||||||
|
|
||||||
let Some(node_id) = graph_modification_utils::get_spiral_id(layer, &document.network_interface) else {
|
let Some(node_id) = graph_modification_utils::get_spiral_id(layer, &document.network_interface) else {
|
||||||
return;
|
return;
|
||||||
@@ -155,12 +154,7 @@ impl Spiral {
|
|||||||
SpiralType::Logarithmic => (dragged_distance).max(0.1),
|
SpiralType::Logarithmic => (dragged_distance).max(0.1),
|
||||||
};
|
};
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, viewport_drag_start, DVec2::ONE));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(DVec2::ONE, 0., viewport_drag_start),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
responses.add(NodeGraphMessage::SetInput {
|
responses.add(NodeGraphMessage::SetInput {
|
||||||
input_connector: InputConnector::node(node_id, OuterRadiusInput::INDEX),
|
input_connector: InputConnector::node(node_id, OuterRadiusInput::INDEX),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use super::shape_utility::{ShapeToolModifierKey, update_radius_sign};
|
use super::shape_utility::{ShapeToolModifierKey, update_radius_sign};
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DefinitionIdentifier, resolve_document_node_type};
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
@@ -12,7 +11,6 @@ use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
|||||||
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, star_outline};
|
use crate::messages::tool::common_functionality::shapes::shape_utility::{ShapeGizmoHandler, star_outline};
|
||||||
use crate::messages::tool::tool_messages::tool_prelude::*;
|
use crate::messages::tool::tool_messages::tool_prelude::*;
|
||||||
use core::f64;
|
use core::f64;
|
||||||
use glam::DAffine2;
|
|
||||||
use graph_craft::document::NodeInput;
|
use graph_craft::document::NodeInput;
|
||||||
use graph_craft::document::value::TaggedValue;
|
use graph_craft::document::value::TaggedValue;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@@ -137,16 +135,18 @@ impl Star {
|
|||||||
let dimensions = (start - end).abs();
|
let dimensions = (start - end).abs();
|
||||||
|
|
||||||
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
// We keep the smaller dimension's scale at 1 and scale the other dimension accordingly
|
||||||
let mut scale = DVec2::ONE;
|
let mut aspect = DVec2::ONE;
|
||||||
let radius: f64;
|
let radius: f64;
|
||||||
if dimensions.x > dimensions.y {
|
if dimensions.x > dimensions.y {
|
||||||
scale.x = dimensions.x / dimensions.y;
|
aspect.x = dimensions.x / dimensions.y;
|
||||||
radius = dimensions.y / 2.;
|
radius = dimensions.y / 2.;
|
||||||
} else {
|
} else {
|
||||||
scale.y = dimensions.y / dimensions.x;
|
aspect.y = dimensions.y / dimensions.x;
|
||||||
radius = dimensions.x / 2.;
|
radius = dimensions.x / 2.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let radius = radius / viewport_zoom(document);
|
||||||
|
|
||||||
let Some(node_id) = graph_modification_utils::get_star_id(layer, &document.network_interface) else {
|
let Some(node_id) = graph_modification_utils::get_star_id(layer, &document.network_interface) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -161,12 +161,7 @@ impl Star {
|
|||||||
input: NodeInput::value(TaggedValue::F64(radius / 2.), false),
|
input: NodeInput::value(TaggedValue::F64(radius / 2.), false),
|
||||||
});
|
});
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
responses.add(window_aligned_transform_set(document, layer, start.midpoint(end), aspect));
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_scale_angle_translation(scale, 0., (start + end) / 2.),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
use super::tool_prelude::*;
|
use super::tool_prelude::*;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
||||||
use crate::messages::portfolio::document::overlays::utility_functions::path_endpoint_overlays;
|
use crate::messages::portfolio::document::overlays::utility_functions::path_endpoint_overlays;
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
@@ -9,6 +8,7 @@ use crate::messages::tool::common_functionality::color_selector::{
|
|||||||
sync_drawing_state,
|
sync_drawing_state,
|
||||||
};
|
};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
|
use crate::messages::tool::common_functionality::resize::translation_transform_set;
|
||||||
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
||||||
use crate::messages::tool::common_functionality::utility_functions::should_extend;
|
use crate::messages::tool::common_functionality::utility_functions::should_extend;
|
||||||
use glam::DVec2;
|
use glam::DVec2;
|
||||||
@@ -309,16 +309,7 @@ impl Fsm for FreehandToolFsmState {
|
|||||||
|
|
||||||
// Position the layer at the initial mouse position via Transform
|
// Position the layer at the initial mouse position via Transform
|
||||||
responses.add(DeferMessage::AfterGraphRun {
|
responses.add(DeferMessage::AfterGraphRun {
|
||||||
messages: vec![
|
messages: vec![translation_transform_set(document, layer, input.mouse.position), NodeGraphMessage::RunDocumentGraph.into()],
|
||||||
GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_translation(input.mouse.position),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
NodeGraphMessage::RunDocumentGraph.into(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
FreehandToolFsmState::Drawing
|
FreehandToolFsmState::Drawing
|
||||||
@@ -337,7 +328,7 @@ impl Fsm for FreehandToolFsmState {
|
|||||||
tool_data.new_layer_viewport_start = None;
|
tool_data.new_layer_viewport_start = None;
|
||||||
}
|
}
|
||||||
let position = if let Some(start) = tool_data.new_layer_viewport_start {
|
let position = if let Some(start) = tool_data.new_layer_viewport_start {
|
||||||
input.mouse.position - start
|
document.metadata().document_to_viewport.inverse().transform_vector2(input.mouse.position - start)
|
||||||
} else {
|
} else {
|
||||||
transform.inverse().transform_point2(input.mouse.position)
|
transform.inverse().transform_point2(input.mouse.position)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ use crate::consts::{
|
|||||||
DOUBLE_CLICK_MILLISECONDS, DRAG_DIRECTION_MODE_DETERMINATION_THRESHOLD, DRAG_THRESHOLD, DRILL_THROUGH_THRESHOLD, HANDLE_ROTATE_SNAP_ANGLE, SEGMENT_INSERTION_DISTANCE, SEGMENT_OVERLAY_SIZE,
|
DOUBLE_CLICK_MILLISECONDS, DRAG_DIRECTION_MODE_DETERMINATION_THRESHOLD, DRAG_THRESHOLD, DRILL_THROUGH_THRESHOLD, HANDLE_ROTATE_SNAP_ANGLE, SEGMENT_INSERTION_DISTANCE, SEGMENT_OVERLAY_SIZE,
|
||||||
SELECTION_THRESHOLD, SELECTION_TOLERANCE,
|
SELECTION_THRESHOLD, SELECTION_TOLERANCE,
|
||||||
};
|
};
|
||||||
use crate::messages::clipboard::utility_types::ClipboardContent;
|
use crate::messages::clipboard::utility_types::{ClipboardItem, ClipboardVectorEntry};
|
||||||
use crate::messages::input_mapper::utility_types::macros::action_shortcut_manual;
|
use crate::messages::input_mapper::utility_types::macros::action_shortcut_manual;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
||||||
use crate::messages::portfolio::document::overlays::utility_functions::{path_overlays, selected_segments};
|
use crate::messages::portfolio::document::overlays::utility_functions::{path_overlays, selected_segments};
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::{DrawHandles, OverlayContext};
|
use crate::messages::portfolio::document::overlays::utility_types::{DrawHandles, OverlayContext};
|
||||||
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
|
||||||
use crate::messages::portfolio::document::utility_types::document_metadata::{DocumentMetadata, LayerNodeIdentifier};
|
use crate::messages::portfolio::document::utility_types::document_metadata::{DocumentMetadata, LayerNodeIdentifier};
|
||||||
use crate::messages::portfolio::document::utility_types::network_interface::NodeNetworkInterface;
|
use crate::messages::portfolio::document::utility_types::network_interface::NodeNetworkInterface;
|
||||||
use crate::messages::portfolio::document::utility_types::transformation::Axis;
|
use crate::messages::portfolio::document::utility_types::transformation::Axis;
|
||||||
@@ -141,14 +140,11 @@ pub enum PathToolMessage {
|
|||||||
overlay_context: OverlayContext,
|
overlay_context: OverlayContext,
|
||||||
},
|
},
|
||||||
StartSlidingPoint,
|
StartSlidingPoint,
|
||||||
Copy {
|
Copy,
|
||||||
clipboard: Clipboard,
|
Cut,
|
||||||
},
|
|
||||||
Cut {
|
|
||||||
clipboard: Clipboard,
|
|
||||||
},
|
|
||||||
Paste {
|
Paste {
|
||||||
data: String,
|
#[cfg_attr(feature = "wasm", tsify(type = "unknown"))]
|
||||||
|
paths: Vec<ClipboardVectorEntry>,
|
||||||
},
|
},
|
||||||
DeleteSelected,
|
DeleteSelected,
|
||||||
Duplicate,
|
Duplicate,
|
||||||
@@ -2749,7 +2745,7 @@ impl Fsm for PathToolFsmState {
|
|||||||
PathToolFsmState::Ready
|
PathToolFsmState::Ready
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(_, PathToolMessage::Copy { clipboard }) => {
|
(_, PathToolMessage::Copy) => {
|
||||||
// TODO: Add support for selected segments
|
// TODO: Add support for selected segments
|
||||||
|
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
@@ -2808,131 +2804,121 @@ impl Fsm for PathToolFsmState {
|
|||||||
buffer.push((layer, new_vector, transform));
|
buffer.push((layer, new_vector, transform));
|
||||||
}
|
}
|
||||||
|
|
||||||
if clipboard == Clipboard::Device {
|
responses.add(ClipboardMessage::WriteItems {
|
||||||
if let Ok(data) = serde_json::to_string(&buffer) {
|
items: vec![ClipboardItem::Vector(buffer)],
|
||||||
responses.add(ClipboardMessage::Write {
|
});
|
||||||
content: ClipboardContent::Vector(data),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
log::error!("Failed to serialize nodes for clipboard");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO: Add implementation for internal clipboard
|
|
||||||
|
|
||||||
PathToolFsmState::Ready
|
PathToolFsmState::Ready
|
||||||
}
|
}
|
||||||
(_, PathToolMessage::Cut { clipboard }) => {
|
(_, PathToolMessage::Cut) => {
|
||||||
responses.add(PathToolMessage::Copy { clipboard });
|
responses.add(PathToolMessage::Copy);
|
||||||
// Delete the selected points/segments
|
// Delete the selected points/segments
|
||||||
responses.add(PathToolMessage::DeleteSelected);
|
responses.add(PathToolMessage::DeleteSelected);
|
||||||
|
|
||||||
PathToolFsmState::Ready
|
PathToolFsmState::Ready
|
||||||
}
|
}
|
||||||
(_, PathToolMessage::Paste { data }) => {
|
(_, PathToolMessage::Paste { paths }) => {
|
||||||
// Deserialize the data
|
shape_editor.deselect_all_points();
|
||||||
if let Ok(data) = serde_json::from_str::<Vec<(LayerNodeIdentifier, Vector, DAffine2)>>(&data) {
|
responses.add(DocumentMessage::AddTransaction);
|
||||||
shape_editor.deselect_all_points();
|
let mut new_layers = Vec::new();
|
||||||
responses.add(DocumentMessage::AddTransaction);
|
for (layer, new_vector, transform) in paths {
|
||||||
let mut new_layers = Vec::new();
|
// If layer is not selected then create a new selected layer
|
||||||
for (layer, new_vector, transform) in data {
|
let layer = if shape_editor.selected_shape_state.contains_key(&layer) {
|
||||||
// If layer is not selected then create a new selected layer
|
layer
|
||||||
let layer = if shape_editor.selected_shape_state.contains_key(&layer) {
|
} else {
|
||||||
layer
|
let Some(node_type) = resolve_network_node_type("Path") else {
|
||||||
} else {
|
error!("Could not resolve node type for Path");
|
||||||
let Some(node_type) = resolve_network_node_type("Path") else {
|
|
||||||
error!("Could not resolve node type for Path");
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let nodes = vec![(NodeId(0), node_type.default_node_template())];
|
|
||||||
|
|
||||||
let parent = document.new_layer_parent(false);
|
|
||||||
|
|
||||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
|
||||||
|
|
||||||
// Defaults chosen because the pasted geometry has no inherent associated style
|
|
||||||
let stroke = graphene_std::vector::style::Stroke::new(Some(Color::BLACK), DEFAULT_STROKE_WIDTH);
|
|
||||||
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
|
|
||||||
|
|
||||||
let fill = graphene_std::vector::style::Fill::solid(Color::WHITE);
|
|
||||||
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
|
||||||
|
|
||||||
new_layers.push(layer);
|
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform,
|
|
||||||
transform_in: TransformIn::Local,
|
|
||||||
skip_rerender: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
layer
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create new point ids and add those into the existing vector content
|
|
||||||
let mut points_map = HashMap::new();
|
|
||||||
for (point, position) in new_vector.point_domain.iter() {
|
|
||||||
let new_point_id = PointId::generate();
|
|
||||||
points_map.insert(point, new_point_id);
|
|
||||||
|
|
||||||
let modification_type = VectorModificationType::InsertPoint { id: new_point_id, position };
|
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create new segment ids and add the segments into the existing vector content
|
|
||||||
let mut segments_map = HashMap::new();
|
|
||||||
for (segment_id, bezier, start, end) in new_vector.segment_iter() {
|
|
||||||
let new_segment_id = SegmentId::generate();
|
|
||||||
|
|
||||||
segments_map.insert(segment_id, new_segment_id);
|
|
||||||
|
|
||||||
let points = pathseg_points(bezier);
|
|
||||||
let handles = [points.p1.map(|handle| handle - points.p0), points.p2.map(|handle| handle - points.p3)];
|
|
||||||
|
|
||||||
let points = [points_map[&start], points_map[&end]];
|
|
||||||
let modification_type = VectorModificationType::InsertSegment { id: new_segment_id, points, handles };
|
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set G1 continuity
|
|
||||||
for handles in new_vector.colinear_manipulators {
|
|
||||||
let to_new_handle = |handle: HandleId| -> HandleId {
|
|
||||||
HandleId {
|
|
||||||
ty: handle.ty,
|
|
||||||
segment: segments_map[&handle.segment],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let new_handles = [to_new_handle(handles[0]), to_new_handle(handles[1])];
|
|
||||||
let modification_type = VectorModificationType::SetG1Continuous { handles: new_handles, enabled: true };
|
|
||||||
|
|
||||||
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
|
||||||
}
|
|
||||||
|
|
||||||
shape_editor.selected_shape_state.entry(layer).or_insert(Default::default());
|
|
||||||
|
|
||||||
// Set selection to newly inserted points
|
|
||||||
let Some(state) = shape_editor.selected_shape_state.get_mut(&layer) else {
|
|
||||||
error!("No state for layer: {layer:?}");
|
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
let nodes = vec![(NodeId(0), node_type.default_node_template())];
|
||||||
|
|
||||||
// If point editing mode is enabled, select all the pasted points
|
let parent = document.new_layer_parent(false);
|
||||||
if tool_options.path_editing_mode.point_editing_mode {
|
|
||||||
points_map.values().for_each(|point| state.select_point(ManipulatorPointId::Anchor(*point)));
|
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||||
}
|
|
||||||
// If segment editing mode is enabled, select all the pasted segments
|
// Defaults chosen because the pasted geometry has no inherent associated style
|
||||||
if tool_options.path_editing_mode.segment_editing_mode {
|
let stroke = graphene_std::vector::style::Stroke::new(Some(Color::BLACK), DEFAULT_STROKE_WIDTH);
|
||||||
segments_map.values().for_each(|segment| state.select_segment(*segment));
|
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
|
||||||
}
|
|
||||||
|
let fill = graphene_std::vector::style::Fill::solid(Color::WHITE);
|
||||||
|
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
||||||
|
|
||||||
|
new_layers.push(layer);
|
||||||
|
|
||||||
|
responses.add(GraphOperationMessage::TransformSet {
|
||||||
|
layer,
|
||||||
|
transform,
|
||||||
|
transform_in: TransformIn::Local,
|
||||||
|
skip_rerender: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
layer
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create new point ids and add those into the existing vector content
|
||||||
|
let mut points_map = HashMap::new();
|
||||||
|
for (point, position) in new_vector.point_domain.iter() {
|
||||||
|
let new_point_id = PointId::generate();
|
||||||
|
points_map.insert(point, new_point_id);
|
||||||
|
|
||||||
|
let modification_type = VectorModificationType::InsertPoint { id: new_point_id, position };
|
||||||
|
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are new layers created, we need to center them in the viewport
|
// Create new segment ids and add the segments into the existing vector content
|
||||||
if !new_layers.is_empty() {
|
let mut segments_map = HashMap::new();
|
||||||
responses.add(Message::Defer(DeferMessage::AfterGraphRun {
|
for (segment_id, bezier, start, end) in new_vector.segment_iter() {
|
||||||
messages: vec![PortfolioMessage::CenterPastedLayers { layers: new_layers }.into()],
|
let new_segment_id = SegmentId::generate();
|
||||||
}));
|
|
||||||
|
segments_map.insert(segment_id, new_segment_id);
|
||||||
|
|
||||||
|
let points = pathseg_points(bezier);
|
||||||
|
let handles = [points.p1.map(|handle| handle - points.p0), points.p2.map(|handle| handle - points.p3)];
|
||||||
|
|
||||||
|
let points = [points_map[&start], points_map[&end]];
|
||||||
|
let modification_type = VectorModificationType::InsertSegment { id: new_segment_id, points, handles };
|
||||||
|
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set G1 continuity
|
||||||
|
for handles in new_vector.colinear_manipulators {
|
||||||
|
let to_new_handle = |handle: HandleId| -> HandleId {
|
||||||
|
HandleId {
|
||||||
|
ty: handle.ty,
|
||||||
|
segment: segments_map[&handle.segment],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let new_handles = [to_new_handle(handles[0]), to_new_handle(handles[1])];
|
||||||
|
let modification_type = VectorModificationType::SetG1Continuous { handles: new_handles, enabled: true };
|
||||||
|
|
||||||
|
responses.add(GraphOperationMessage::Vector { layer, modification_type });
|
||||||
|
}
|
||||||
|
|
||||||
|
shape_editor.selected_shape_state.entry(layer).or_insert(Default::default());
|
||||||
|
|
||||||
|
// Set selection to newly inserted points
|
||||||
|
let Some(state) = shape_editor.selected_shape_state.get_mut(&layer) else {
|
||||||
|
error!("No state for layer: {layer:?}");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
// If point editing mode is enabled, select all the pasted points
|
||||||
|
if tool_options.path_editing_mode.point_editing_mode {
|
||||||
|
points_map.values().for_each(|point| state.select_point(ManipulatorPointId::Anchor(*point)));
|
||||||
|
}
|
||||||
|
// If segment editing mode is enabled, select all the pasted segments
|
||||||
|
if tool_options.path_editing_mode.segment_editing_mode {
|
||||||
|
segments_map.values().for_each(|segment| state.select_segment(*segment));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are new layers created, we need to center them in the viewport
|
||||||
|
if !new_layers.is_empty() {
|
||||||
|
responses.add(Message::Defer(DeferMessage::AfterGraphRun {
|
||||||
|
messages: vec![PortfolioMessage::CenterLayers { layers: new_layers }.into()],
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
PathToolFsmState::Ready
|
PathToolFsmState::Ready
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use super::tool_prelude::*;
|
use super::tool_prelude::*;
|
||||||
use crate::consts::{COLOR_OVERLAY_BLUE, COLOR_OVERLAY_BLUE_05, HIDE_HANDLE_DISTANCE, LINE_ROTATE_SNAP_ANGLE, SEGMENT_OVERLAY_SIZE};
|
use crate::consts::{COLOR_OVERLAY_BLUE, COLOR_OVERLAY_BLUE_05, HIDE_HANDLE_DISTANCE, LINE_ROTATE_SNAP_ANGLE, SEGMENT_OVERLAY_SIZE};
|
||||||
use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_network_node_type;
|
||||||
use crate::messages::portfolio::document::overlays::utility_functions::path_overlays;
|
use crate::messages::portfolio::document::overlays::utility_functions::path_overlays;
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::{DrawHandles, OverlayContext};
|
use crate::messages::portfolio::document::overlays::utility_types::{DrawHandles, OverlayContext};
|
||||||
@@ -12,6 +11,7 @@ use crate::messages::tool::common_functionality::color_selector::{
|
|||||||
sync_drawing_state,
|
sync_drawing_state,
|
||||||
};
|
};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils::{self, merge_layers};
|
use crate::messages::tool::common_functionality::graph_modification_utils::{self, merge_layers};
|
||||||
|
use crate::messages::tool::common_functionality::resize::translation_transform_set;
|
||||||
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
use crate::messages::tool::common_functionality::shape_editor::ShapeState;
|
||||||
use crate::messages::tool::common_functionality::snapping::{SnapCache, SnapCandidatePoint, SnapConstraint, SnapData, SnapManager, SnapTypeConfiguration};
|
use crate::messages::tool::common_functionality::snapping::{SnapCache, SnapCandidatePoint, SnapConstraint, SnapData, SnapManager, SnapTypeConfiguration};
|
||||||
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
||||||
@@ -1373,13 +1373,7 @@ impl PenToolData {
|
|||||||
// Defer the transform setup and point insertion until after the layer is created
|
// Defer the transform setup and point insertion until after the layer is created
|
||||||
responses.add(DeferMessage::AfterGraphRun {
|
responses.add(DeferMessage::AfterGraphRun {
|
||||||
messages: vec![
|
messages: vec![
|
||||||
GraphOperationMessage::TransformSet {
|
translation_transform_set(document, layer, viewport_vec),
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_translation(viewport_vec),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
GraphOperationMessage::Vector {
|
GraphOperationMessage::Vector {
|
||||||
layer,
|
layer,
|
||||||
modification_type: VectorModificationType::InsertPoint { id, position: DVec2::ZERO },
|
modification_type: VectorModificationType::InsertPoint { id, position: DVec2::ZERO },
|
||||||
@@ -1601,6 +1595,9 @@ impl Fsm for PenToolFsmState {
|
|||||||
let vector = document.network_interface.compute_modified_vector(layer);
|
let vector = document.network_interface.compute_modified_vector(layer);
|
||||||
let Some(vector) = vector else { return PenToolFsmState::GRSHandle };
|
let Some(vector) = vector else { return PenToolFsmState::GRSHandle };
|
||||||
|
|
||||||
|
// Keep the preview segment's endpoint tracking the cursor while the outgoing handle is transformed by the GRS operation
|
||||||
|
tool_data.place_anchor(SnapData::new(document, input, viewport), transform, input.mouse.position, responses);
|
||||||
|
|
||||||
if let Some(latest_pt) = tool_data.latest_point_mut() {
|
if let Some(latest_pt) = tool_data.latest_point_mut() {
|
||||||
let layer_space_to_viewport = document.metadata().transform_to_viewport(layer);
|
let layer_space_to_viewport = document.metadata().transform_to_viewport(layer);
|
||||||
let final_pos = layer_space_to_viewport.inverse().transform_point2(final_position);
|
let final_pos = layer_space_to_viewport.inverse().transform_point2(final_position);
|
||||||
|
|||||||
@@ -512,7 +512,6 @@ struct SelectToolData {
|
|||||||
selected_layers_changed: bool,
|
selected_layers_changed: bool,
|
||||||
snap_candidates: Vec<SnapCandidatePoint>,
|
snap_candidates: Vec<SnapCandidatePoint>,
|
||||||
auto_panning: AutoPanning,
|
auto_panning: AutoPanning,
|
||||||
drag_start_center: ViewportPosition,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SelectToolData {
|
impl SelectToolData {
|
||||||
@@ -529,6 +528,15 @@ impl SelectToolData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The center of the combined viewport-space bounding box of the layers currently being dragged.
|
||||||
|
fn dragging_layers_center(&self, document: &DocumentMessageHandler) -> Option<ViewportPosition> {
|
||||||
|
self.layers_dragging
|
||||||
|
.iter()
|
||||||
|
.filter_map(|&layer| document.metadata().bounding_box_viewport(layer).map(Rect::from_box))
|
||||||
|
.reduce(Rect::combine_bounds)
|
||||||
|
.map(|bounds| bounds.center())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn selection_quad(&self) -> Quad {
|
pub fn selection_quad(&self) -> Quad {
|
||||||
let bbox = self.selection_box();
|
let bbox = self.selection_box();
|
||||||
Quad::from_box(bbox)
|
Quad::from_box(bbox)
|
||||||
@@ -1021,7 +1029,18 @@ impl Fsm for SelectToolFsmState {
|
|||||||
let angle = -mouse_position.angle_to(DVec2::X);
|
let angle = -mouse_position.angle_to(DVec2::X);
|
||||||
let snapped_angle = (angle / snap_resolution).round() * snap_resolution;
|
let snapped_angle = (angle / snap_resolution).round() * snap_resolution;
|
||||||
|
|
||||||
let origin = tool_data.drag_start_center;
|
// Anchor the guide to the dragged layers' center at the moment the drag began. It's computed live (rather than
|
||||||
|
// snapshotted at drag start) so it stays correct as the layers move and the viewport auto-pans: their current
|
||||||
|
// center minus the drag displacement recovers the start center in the present viewport frame. Sourcing it from
|
||||||
|
// the layers being dragged (not the prior selection's pivot) is what keeps it on the layer actually grabbed.
|
||||||
|
let origin = if matches!(self, Self::Dragging { .. }) {
|
||||||
|
tool_data
|
||||||
|
.dragging_layers_center(document)
|
||||||
|
.map(|center| center - (tool_data.drag_current - tool_data.drag_start))
|
||||||
|
.unwrap_or_else(|| tool_data.pivot_gizmo().position(document))
|
||||||
|
} else {
|
||||||
|
tool_data.pivot_gizmo().position(document)
|
||||||
|
};
|
||||||
let viewport_diagonal = viewport.size().into_dvec2().length();
|
let viewport_diagonal = viewport.size().into_dvec2().length();
|
||||||
|
|
||||||
let edge = DVec2::from_angle(snapped_angle).normalize_or(DVec2::X);
|
let edge = DVec2::from_angle(snapped_angle).normalize_or(DVec2::X);
|
||||||
@@ -1132,8 +1151,6 @@ impl Fsm for SelectToolFsmState {
|
|||||||
let position = tool_data.pivot_gizmo().position(document);
|
let position = tool_data.pivot_gizmo().position(document);
|
||||||
let (resize, rotate, skew) = transforming_transform_cage(document, &mut tool_data.bounding_box_manager, input, responses, &mut tool_data.layers_dragging, Some(position));
|
let (resize, rotate, skew) = transforming_transform_cage(document, &mut tool_data.bounding_box_manager, input, responses, &mut tool_data.layers_dragging, Some(position));
|
||||||
|
|
||||||
tool_data.drag_start_center = position;
|
|
||||||
|
|
||||||
// If the user is dragging the bounding box bounds, go into ResizingBounds mode.
|
// If the user is dragging the bounding box bounds, go into ResizingBounds mode.
|
||||||
// If the user is dragging the rotate trigger, go into RotatingBounds mode.
|
// If the user is dragging the rotate trigger, go into RotatingBounds mode.
|
||||||
// If the user clicks on a layer that is in their current selection, go into the dragging mode.
|
// If the user clicks on a layer that is in their current selection, go into the dragging mode.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use super::tool_prelude::*;
|
use super::tool_prelude::*;
|
||||||
use crate::consts::{DRAG_THRESHOLD, PATH_JOIN_THRESHOLD, SNAP_POINT_TOLERANCE};
|
use crate::consts::{DRAG_THRESHOLD, PATH_JOIN_THRESHOLD, SNAP_POINT_TOLERANCE};
|
||||||
use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
||||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
|
||||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::{resolve_network_node_type, resolve_proto_node_type};
|
use crate::messages::portfolio::document::node_graph::document_node_definitions::{resolve_network_node_type, resolve_proto_node_type};
|
||||||
use crate::messages::portfolio::document::overlays::utility_functions::path_endpoint_overlays;
|
use crate::messages::portfolio::document::overlays::utility_functions::path_endpoint_overlays;
|
||||||
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
|
||||||
@@ -12,6 +11,7 @@ use crate::messages::tool::common_functionality::color_selector::{
|
|||||||
sync_drawing_state,
|
sync_drawing_state,
|
||||||
};
|
};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils::{self, find_spline, merge_layers, merge_points};
|
use crate::messages::tool::common_functionality::graph_modification_utils::{self, find_spline, merge_layers, merge_points};
|
||||||
|
use crate::messages::tool::common_functionality::resize::translation_transform_set;
|
||||||
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapData, SnapManager, SnapTypeConfiguration, SnappedPoint};
|
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapData, SnapManager, SnapTypeConfiguration, SnappedPoint};
|
||||||
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
use crate::messages::tool::common_functionality::stroke_options::{StrokeOptionsUpdate, apply_stroke_option, create_stroke_options_popover_widget};
|
||||||
use crate::messages::tool::common_functionality::utility_functions::{closest_point, should_extend};
|
use crate::messages::tool::common_functionality::utility_functions::{closest_point, should_extend};
|
||||||
@@ -414,16 +414,7 @@ impl Fsm for SplineToolFsmState {
|
|||||||
|
|
||||||
// Position the layer at the initial mouse position via Transform
|
// Position the layer at the initial mouse position via Transform
|
||||||
responses.add(DeferMessage::AfterGraphRun {
|
responses.add(DeferMessage::AfterGraphRun {
|
||||||
messages: vec![
|
messages: vec![translation_transform_set(document, layer, viewport_vec), NodeGraphMessage::RunDocumentGraph.into()],
|
||||||
GraphOperationMessage::TransformSet {
|
|
||||||
layer,
|
|
||||||
transform: DAffine2::from_translation(viewport_vec),
|
|
||||||
transform_in: TransformIn::Viewport,
|
|
||||||
skip_rerender: false,
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
NodeGraphMessage::RunDocumentGraph.into(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SplineToolFsmState::Drawing
|
SplineToolFsmState::Drawing
|
||||||
@@ -446,7 +437,7 @@ impl Fsm for SplineToolFsmState {
|
|||||||
// For newly created layers, the deferred TransformSet may not yet be reflected
|
// For newly created layers, the deferred TransformSet may not yet be reflected
|
||||||
// in the metadata, so compute local position from the known viewport start.
|
// in the metadata, so compute local position from the known viewport start.
|
||||||
tool_data.next_point = if let Some(start) = tool_data.new_layer_viewport_start {
|
tool_data.next_point = if let Some(start) = tool_data.new_layer_viewport_start {
|
||||||
viewport_pos - start
|
document_to_viewport.inverse().transform_vector2(viewport_pos - start)
|
||||||
} else {
|
} else {
|
||||||
let transform = document.metadata().transform_to_viewport(layer);
|
let transform = document.metadata().transform_to_viewport(layer);
|
||||||
transform.inverse().transform_point2(viewport_pos)
|
transform.inverse().transform_point2(viewport_pos)
|
||||||
@@ -483,7 +474,7 @@ impl Fsm for SplineToolFsmState {
|
|||||||
// For newly created layers, the deferred TransformSet may not yet be reflected
|
// For newly created layers, the deferred TransformSet may not yet be reflected
|
||||||
// in the metadata, so compute local position from the known viewport start.
|
// in the metadata, so compute local position from the known viewport start.
|
||||||
tool_data.next_point = if let Some(start) = tool_data.new_layer_viewport_start {
|
tool_data.next_point = if let Some(start) = tool_data.new_layer_viewport_start {
|
||||||
viewport_pos - start
|
document_to_viewport.inverse().transform_vector2(viewport_pos - start)
|
||||||
} else {
|
} else {
|
||||||
let transform = document.metadata().transform_to_viewport(layer);
|
let transform = document.metadata().transform_to_viewport(layer);
|
||||||
transform.inverse().transform_point2(viewport_pos)
|
transform.inverse().transform_point2(viewport_pos)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::messages::tool::common_functionality::color_selector::{
|
|||||||
ToolColorOptions, apply_fill_only_color_pick, apply_fill_only_enabled, refresh_slot_working_color, selection_changed_since_last_sync, solid, sync_fill_only,
|
ToolColorOptions, apply_fill_only_color_pick, apply_fill_only_enabled, refresh_slot_working_color, selection_changed_since_last_sync, solid, sync_fill_only,
|
||||||
};
|
};
|
||||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use crate::messages::tool::common_functionality::resize::Resize;
|
use crate::messages::tool::common_functionality::resize::{Resize, viewport_zoom, window_aligned_transform};
|
||||||
use crate::messages::tool::common_functionality::snapping::{self, SnapCandidatePoint, SnapData};
|
use crate::messages::tool::common_functionality::snapping::{self, SnapCandidatePoint, SnapData};
|
||||||
use crate::messages::tool::common_functionality::transformation_cage::*;
|
use crate::messages::tool::common_functionality::transformation_cage::*;
|
||||||
use crate::messages::tool::common_functionality::utility_functions::text_bounding_box;
|
use crate::messages::tool::common_functionality::utility_functions::text_bounding_box;
|
||||||
@@ -971,17 +971,11 @@ impl Fsm for TextToolFsmState {
|
|||||||
return TextToolFsmState::Editing;
|
return TextToolFsmState::Editing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise create some new text. The drag bounds are in viewport space; map them into document space for the text's
|
// Otherwise create some new text. The window-aligned transform is in viewport space, so the editing overlay (a screen-space CSS matrix) carries the zoom.
|
||||||
// transform and wrapping size, then compose with document-to-viewport so the editing overlay (a screen-space CSS matrix) carries the zoom.
|
let constraint_size = has_dragged.then_some((start - end).abs() / viewport_zoom(document));
|
||||||
let document_to_viewport = document.metadata().document_to_viewport;
|
|
||||||
let viewport_to_document = document_to_viewport.inverse();
|
|
||||||
let document_start = viewport_to_document.transform_point2(start);
|
|
||||||
let document_end = viewport_to_document.transform_point2(end);
|
|
||||||
|
|
||||||
let constraint_size = has_dragged.then_some((document_start - document_end).abs());
|
|
||||||
let editing_text = EditingText {
|
let editing_text = EditingText {
|
||||||
text: String::new(),
|
text: String::new(),
|
||||||
transform: document_to_viewport * DAffine2::from_translation(document_start),
|
transform: window_aligned_transform(document, start, DVec2::ONE),
|
||||||
typesetting: TypesettingConfig {
|
typesetting: TypesettingConfig {
|
||||||
font_size: tool_options.font_size,
|
font_size: tool_options.font_size,
|
||||||
letter_spacing: tool_options.letter_spacing,
|
letter_spacing: tool_options.letter_spacing,
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
use crate::messages::frontend::utility_types::{ExportBounds, FileType};
|
use crate::messages::frontend::utility_types::{ExportBounds, FileType};
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||||
use glam::{DAffine2, DVec2, UVec2};
|
use glam::{DAffine2, DVec2, UVec2};
|
||||||
use graph_craft::application_io::EditorPreferences;
|
use graph_craft::application_io::EditorPreferences;
|
||||||
use graph_craft::document::value::{RenderOutput, RenderOutputType, TaggedValue};
|
use graph_craft::document::value::{RenderOutput, RenderOutputType, TaggedValue};
|
||||||
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput};
|
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput};
|
||||||
use graph_craft::proto::GraphErrors;
|
use graph_craft::proto::GraphErrors;
|
||||||
use graphene_std::application_io::{NodeGraphUpdateMessage, RenderConfig, TimingInformation};
|
use graphene_std::application_io::{ExportFormat, NodeGraphUpdateMessage, RenderConfig, TimingInformation};
|
||||||
|
use graphene_std::bounds::RenderBoundingBox;
|
||||||
use graphene_std::color::SRGBA8;
|
use graphene_std::color::SRGBA8;
|
||||||
|
use graphene_std::list::List;
|
||||||
|
use graphene_std::memo::IORecord;
|
||||||
use graphene_std::raster::{CPU, Raster};
|
use graphene_std::raster::{CPU, Raster};
|
||||||
use graphene_std::renderer::RenderMetadata;
|
use graphene_std::renderer::{RenderMetadata, graphic_list_bounding_box};
|
||||||
use graphene_std::transform::Footprint;
|
use graphene_std::transform::Footprint;
|
||||||
use graphene_std::vector::Vector;
|
use graphene_std::vector::Vector;
|
||||||
|
use graphene_std::{ATTR_TRANSFORM, Context, Graphic};
|
||||||
use interpreted_executor::dynamic_executor::ResolvedDocumentNodeTypesDelta;
|
use interpreted_executor::dynamic_executor::ResolvedDocumentNodeTypesDelta;
|
||||||
|
use std::any::Any;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
mod runtime_io;
|
mod runtime_io;
|
||||||
pub use runtime_io::NodeRuntimeIO;
|
pub use runtime_io::NodeRuntimeIO;
|
||||||
@@ -58,12 +65,30 @@ pub struct NodeGraphExecutor {
|
|||||||
/// so the runtime can splice its monitor node alongside the target rather than only at the top level.
|
/// so the runtime can splice its monitor node alongside the target rather than only at the top level.
|
||||||
/// Tracking the previously-sent value lets `update_node_graph` re-send the network when the inspection target changes.
|
/// Tracking the previously-sent value lets `update_node_graph` re-send the network when the inspection target changes.
|
||||||
previous_node_to_inspect: Vec<NodeId>,
|
previous_node_to_inspect: Vec<NodeId>,
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// In-progress one-time pre-pass that converts legacy bounding-box-relative gradients to absolute space, if any.
|
||||||
|
gradient_migration: Option<GradientMigration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct ExecutionContext {
|
struct ExecutionContext {
|
||||||
export_config: Option<ExportConfig>,
|
export_config: Option<ExportConfig>,
|
||||||
document_id: DocumentId,
|
document_id: DocumentId,
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Set when this execution is a gradient-migration measurement run for the given "Fill" node, whose evaluated geometry
|
||||||
|
/// is read back from the inspect result to size the gradient; such runs never touch the visible artwork.
|
||||||
|
measure_fill: Option<NodeId>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// State for the deferred legacy-gradient migration: a queue of root-network "Fill" nodes still holding bounding-box-relative
|
||||||
|
/// gradients, measured one at a time by redirecting the document export to each so even hidden/orphaned branches evaluate.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct GradientMigration {
|
||||||
|
document_id: DocumentId,
|
||||||
|
remaining: VecDeque<NodeId>,
|
||||||
|
resolution: UVec2,
|
||||||
|
scale: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodeGraphExecutor {
|
impl NodeGraphExecutor {
|
||||||
@@ -80,6 +105,7 @@ impl NodeGraphExecutor {
|
|||||||
node_graph_hash: 0,
|
node_graph_hash: 0,
|
||||||
current_execution_id: 0,
|
current_execution_id: 0,
|
||||||
previous_node_to_inspect: Vec::new(),
|
previous_node_to_inspect: Vec::new(),
|
||||||
|
gradient_migration: None,
|
||||||
};
|
};
|
||||||
(node_runtime, node_executor)
|
(node_runtime, node_executor)
|
||||||
}
|
}
|
||||||
@@ -168,7 +194,14 @@ impl NodeGraphExecutor {
|
|||||||
// Execute the node graph
|
// Execute the node graph
|
||||||
let execution_id = self.queue_execution(render_config);
|
let execution_id = self.queue_execution(render_config);
|
||||||
|
|
||||||
self.futures.push_back((execution_id, ExecutionContext { export_config: None, document_id }));
|
self.futures.push_back((
|
||||||
|
execution_id,
|
||||||
|
ExecutionContext {
|
||||||
|
export_config: None,
|
||||||
|
document_id,
|
||||||
|
measure_fill: None,
|
||||||
|
},
|
||||||
|
));
|
||||||
|
|
||||||
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
||||||
}
|
}
|
||||||
@@ -232,7 +265,14 @@ impl NodeGraphExecutor {
|
|||||||
// Execute the node graph
|
// Execute the node graph
|
||||||
let execution_id = self.queue_execution(render_config);
|
let execution_id = self.queue_execution(render_config);
|
||||||
|
|
||||||
self.futures.push_back((execution_id, ExecutionContext { export_config: None, document_id }));
|
self.futures.push_back((
|
||||||
|
execution_id,
|
||||||
|
ExecutionContext {
|
||||||
|
export_config: None,
|
||||||
|
document_id,
|
||||||
|
measure_fill: None,
|
||||||
|
},
|
||||||
|
));
|
||||||
|
|
||||||
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
||||||
}
|
}
|
||||||
@@ -294,13 +334,14 @@ impl NodeGraphExecutor {
|
|||||||
ExecutionContext {
|
ExecutionContext {
|
||||||
export_config: Some(export_config),
|
export_config: Some(export_config),
|
||||||
document_id,
|
document_id,
|
||||||
|
measure_fill: None,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn poll_node_graph_evaluation(&mut self, document: &mut DocumentMessageHandler, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
pub fn poll_node_graph_evaluation(&mut self, document: &mut DocumentMessageHandler, document_id: DocumentId, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||||
let results = self.runtime_io.receive().collect::<Vec<_>>();
|
let results = self.runtime_io.receive().collect::<Vec<_>>();
|
||||||
for response in results {
|
for response in results {
|
||||||
match response {
|
match response {
|
||||||
@@ -313,6 +354,29 @@ impl NodeGraphExecutor {
|
|||||||
inspect_result,
|
inspect_result,
|
||||||
} = execution_response;
|
} = execution_response;
|
||||||
|
|
||||||
|
while let Some(&(queued_execution_id, _)) = self.futures.front() {
|
||||||
|
if queued_execution_id < execution_id {
|
||||||
|
self.futures.pop_front();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some((queued_execution_id, execution_context)) = self.futures.pop_front() else {
|
||||||
|
panic!("InvalidGenerationId")
|
||||||
|
};
|
||||||
|
assert_eq!(queued_execution_id, execution_id, "Missmatch in execution id");
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
// Gradient-migration measurement runs only read back the fill's evaluated geometry; they never render to the artwork.
|
||||||
|
// Apply only to the active document's in-progress migration, dropping responses left over from a document switch.
|
||||||
|
if let Some(fill_node_id) = execution_context.measure_fill {
|
||||||
|
if execution_context.document_id == document_id && self.gradient_migration.as_ref().is_some_and(|migration| migration.document_id == document_id) {
|
||||||
|
self.handle_gradient_measurement(document, document_id, fill_node_id, result.ok().and(inspect_result), responses);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
responses.add(OverlaysMessage::Draw);
|
responses.add(OverlaysMessage::Draw);
|
||||||
|
|
||||||
let node_graph_output = match result {
|
let node_graph_output = match result {
|
||||||
@@ -329,19 +393,6 @@ impl NodeGraphExecutor {
|
|||||||
responses.extend(existing_responses.into_iter().map(Into::into));
|
responses.extend(existing_responses.into_iter().map(Into::into));
|
||||||
document.network_interface.update_vector_modify(vector_modify);
|
document.network_interface.update_vector_modify(vector_modify);
|
||||||
|
|
||||||
while let Some(&(fid, _)) = self.futures.front() {
|
|
||||||
if fid < execution_id {
|
|
||||||
self.futures.pop_front();
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let Some((fid, execution_context)) = self.futures.pop_front() else {
|
|
||||||
panic!("InvalidGenerationId")
|
|
||||||
};
|
|
||||||
assert_eq!(fid, execution_id, "Missmatch in execution id");
|
|
||||||
|
|
||||||
if let Some(export_config) = execution_context.export_config {
|
if let Some(export_config) = execution_context.export_config {
|
||||||
// Special handling for exporting the artwork
|
// Special handling for exporting the artwork
|
||||||
self.process_export(node_graph_output, export_config, document, responses)?;
|
self.process_export(node_graph_output, export_config, document, responses)?;
|
||||||
@@ -362,6 +413,16 @@ impl NodeGraphExecutor {
|
|||||||
}
|
}
|
||||||
NodeGraphUpdate::CompilationResponse(execution_response) => {
|
NodeGraphUpdate::CompilationResponse(execution_response) => {
|
||||||
let CompilationResponse { node_graph_errors, result } = execution_response;
|
let CompilationResponse { node_graph_errors, result } = execution_response;
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
// The migration's temporary redirected-export compilations must not push types or a graph view to the frontend
|
||||||
|
if self.gradient_migration.is_some() {
|
||||||
|
if let Err((_, e)) = &result {
|
||||||
|
log::trace!("Gradient migration measurement compile: {e}");
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let type_delta = match result {
|
let type_delta = match result {
|
||||||
Err((incomplete_delta, e)) => {
|
Err((incomplete_delta, e)) => {
|
||||||
// Clear the click targets while the graph is in an un-renderable state
|
// Clear the click targets while the graph is in an un-renderable state
|
||||||
@@ -400,6 +461,146 @@ impl NodeGraphExecutor {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Kick off the one-time pre-pass converting legacy bounding-box gradients to absolute space, or no-op if already running.
|
||||||
|
pub(crate) fn drive_gradient_migration(&mut self, document: &mut DocumentMessageHandler, document_id: DocumentId, resolution: UVec2, scale: f64, responses: &mut VecDeque<Message>) {
|
||||||
|
match &self.gradient_migration {
|
||||||
|
// Already running for this document
|
||||||
|
Some(migration) if migration.document_id == document_id => return,
|
||||||
|
// A different document's migration is in progress; cancel it so this one can run (the other restarts when revisited)
|
||||||
|
Some(_) => self.gradient_migration = None,
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let remaining: VecDeque<NodeId> = graph_modification_utils::legacy_gradient_fill_nodes(&document.network_interface).into_iter().collect();
|
||||||
|
let Some(&first_fill) = remaining.front() else {
|
||||||
|
document.pending_gradient_migration = false;
|
||||||
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.gradient_migration = Some(GradientMigration {
|
||||||
|
document_id,
|
||||||
|
remaining,
|
||||||
|
resolution,
|
||||||
|
scale,
|
||||||
|
});
|
||||||
|
self.dispatch_gradient_measurement(document, document_id, first_fill, resolution, scale, responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Run the graph with its export redirected to `fill_node_id` (so its branch evaluates even when hidden or orphaned) and
|
||||||
|
/// that node inspected, so its evaluated geometry returns in the execution response without touching the visible artwork.
|
||||||
|
fn dispatch_gradient_measurement(
|
||||||
|
&mut self,
|
||||||
|
document: &mut DocumentMessageHandler,
|
||||||
|
document_id: DocumentId,
|
||||||
|
fill_node_id: NodeId,
|
||||||
|
resolution: UVec2,
|
||||||
|
scale: f64,
|
||||||
|
responses: &mut VecDeque<Message>,
|
||||||
|
) {
|
||||||
|
let mut network = document.network_interface.document_network().clone();
|
||||||
|
|
||||||
|
// On this throwaway clone, un-hide just the Fill so it's measured as a real Fill rather than a passthrough.
|
||||||
|
// But upstream generators keep their visibility, so a hidden one intentionally contributes no geometry.
|
||||||
|
if let Some(node) = network.nodes.get_mut(&fill_node_id) {
|
||||||
|
node.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(export) = network.exports.first_mut() else {
|
||||||
|
// No export to redirect through, so skip this Fill rather than leaving the migration stuck
|
||||||
|
log::warn!("Gradient migration: document network has no export to redirect");
|
||||||
|
self.advance_gradient_migration(document, document_id, responses);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
*export = NodeInput::node(fill_node_id, 0);
|
||||||
|
|
||||||
|
let resources = document.resources.registry.clone();
|
||||||
|
if self
|
||||||
|
.runtime_io
|
||||||
|
.send(GraphRuntimeRequest::GraphUpdate(GraphUpdate {
|
||||||
|
network,
|
||||||
|
resources,
|
||||||
|
node_to_inspect: vec![fill_node_id],
|
||||||
|
}))
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
log::error!("Gradient migration: failed to send measurement graph update");
|
||||||
|
self.advance_gradient_migration(document, document_id, responses);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force the next normal render to recompile and re-send the real, non-redirected network
|
||||||
|
self.node_graph_hash = 0;
|
||||||
|
self.previous_node_to_inspect = vec![fill_node_id];
|
||||||
|
|
||||||
|
let viewport = Footprint {
|
||||||
|
transform: document.metadata().document_to_viewport,
|
||||||
|
resolution,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let render_config = RenderConfig {
|
||||||
|
viewport,
|
||||||
|
scale,
|
||||||
|
time: Default::default(),
|
||||||
|
pointer: DVec2::ZERO,
|
||||||
|
export_format: ExportFormat::Svg,
|
||||||
|
render_mode: document.render_mode,
|
||||||
|
for_export: false,
|
||||||
|
for_eyedropper: false,
|
||||||
|
};
|
||||||
|
let execution_id = self.queue_execution(render_config);
|
||||||
|
self.futures.push_back((
|
||||||
|
execution_id,
|
||||||
|
ExecutionContext {
|
||||||
|
export_config: None,
|
||||||
|
document_id,
|
||||||
|
measure_fill: Some(fill_node_id),
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Convert the just-measured fill's legacy gradients to absolute space using its evaluated geometry, then advance the queue.
|
||||||
|
fn handle_gradient_measurement(
|
||||||
|
&mut self,
|
||||||
|
document: &mut DocumentMessageHandler,
|
||||||
|
document_id: DocumentId,
|
||||||
|
fill_node_id: NodeId,
|
||||||
|
inspect_result: Option<InspectResult>,
|
||||||
|
responses: &mut VecDeque<Message>,
|
||||||
|
) {
|
||||||
|
let measured = inspect_result.and_then(|mut result| result.take_data()).and_then(|data| measure_fill_geometry(&data));
|
||||||
|
|
||||||
|
match measured {
|
||||||
|
Some((bounding_box, item_transform)) => graph_modification_utils::migrate_fill_node_gradients_to_absolute(fill_node_id, &mut document.network_interface, bounding_box, item_transform),
|
||||||
|
None => log::warn!("Gradient migration could not measure geometry for fill node {fill_node_id:?}; leaving it in legacy space"),
|
||||||
|
}
|
||||||
|
|
||||||
|
self.advance_gradient_migration(document, document_id, responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Move to the next queued fill, or finish the migration and trigger a normal render once the queue is empty.
|
||||||
|
fn advance_gradient_migration(&mut self, document: &mut DocumentMessageHandler, document_id: DocumentId, responses: &mut VecDeque<Message>) {
|
||||||
|
let next_fill = self.gradient_migration.as_mut().and_then(|migration| {
|
||||||
|
migration.remaining.pop_front();
|
||||||
|
migration.remaining.front().copied()
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some(next_fill) = next_fill {
|
||||||
|
let (resolution, scale) = self.gradient_migration.as_ref().map(|migration| (migration.resolution, migration.scale)).unwrap_or((UVec2::ONE, 1.));
|
||||||
|
self.dispatch_gradient_measurement(document, document_id, next_fill, resolution, scale, responses);
|
||||||
|
} else {
|
||||||
|
self.gradient_migration = None;
|
||||||
|
self.previous_node_to_inspect = Vec::new();
|
||||||
|
self.node_graph_hash = 0;
|
||||||
|
document.pending_gradient_migration = false;
|
||||||
|
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn process_node_graph_output(&mut self, node_graph_output: TaggedValue, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
fn process_node_graph_output(&mut self, node_graph_output: TaggedValue, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||||
let TaggedValue::RenderOutput(render_output) = node_graph_output else {
|
let TaggedValue::RenderOutput(render_output) = node_graph_output else {
|
||||||
return Err(format!("Invalid node graph output type: {node_graph_output:#?}"));
|
return Err(format!("Invalid node graph output type: {node_graph_output:#?}"));
|
||||||
@@ -458,11 +659,6 @@ impl NodeGraphExecutor {
|
|||||||
first_element_source_id,
|
first_element_source_id,
|
||||||
});
|
});
|
||||||
responses.add(DocumentMessage::UpdateClickTargets { click_targets });
|
responses.add(DocumentMessage::UpdateClickTargets { click_targets });
|
||||||
|
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
// Runs after click targets land (this graph run's geometry bounds) so the deferred gradient migration can use them.
|
|
||||||
responses.add(DocumentMessage::MigrateLegacyGradients);
|
|
||||||
|
|
||||||
responses.add(DocumentMessage::UpdateOutlines { outlines });
|
responses.add(DocumentMessage::UpdateOutlines { outlines });
|
||||||
responses.add(DocumentMessage::UpdateTextFrames { text_frames });
|
responses.add(DocumentMessage::UpdateTextFrames { text_frames });
|
||||||
responses.add(DocumentMessage::UpdateClipTargets { clip_targets });
|
responses.add(DocumentMessage::UpdateClipTargets { clip_targets });
|
||||||
@@ -572,6 +768,41 @@ impl NodeGraphExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Turn a measured fill node's evaluated geometry into a `[0,1]² -> bounding box` affine plus the geometry's item transform.
|
||||||
|
fn measure_fill_geometry(data: &Arc<dyn Any + Send + Sync>) -> Option<(DAffine2, DAffine2)> {
|
||||||
|
if let Some(list) = introspected_output::<List<Vector>>(data) {
|
||||||
|
let vector = list.element(0)?;
|
||||||
|
let item_transform: DAffine2 = list.attribute_cloned_or_default(ATTR_TRANSFORM, 0);
|
||||||
|
let bounds = vector.nonzero_bounding_box();
|
||||||
|
let bounding_box_affine = DAffine2::from_scale_angle_translation(bounds[1] - bounds[0], 0., bounds[0]);
|
||||||
|
return Some((bounding_box_affine, item_transform));
|
||||||
|
}
|
||||||
|
if let Some(list) = introspected_output::<List<Graphic>>(data) {
|
||||||
|
let RenderBoundingBox::Rectangle(bounds) = graphic_list_bounding_box(&list, DAffine2::IDENTITY) else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
let bounding_box_affine = DAffine2::from_scale_angle_translation(bounds[1] - bounds[0], 0., bounds[0]);
|
||||||
|
return Some((bounding_box_affine, DAffine2::IDENTITY));
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this document upgrade code
|
||||||
|
/// Extract a monitor node's recorded output, trying each context type the runtime may have evaluated it under.
|
||||||
|
fn introspected_output<T: Clone + Send + Sync + 'static>(data: &Arc<dyn Any + Send + Sync>) -> Option<T> {
|
||||||
|
if let Some(io) = data.downcast_ref::<IORecord<(), T>>() {
|
||||||
|
return Some(io.output.clone());
|
||||||
|
}
|
||||||
|
if let Some(io) = data.downcast_ref::<IORecord<Footprint, T>>() {
|
||||||
|
return Some(io.output.clone());
|
||||||
|
}
|
||||||
|
if let Some(io) = data.downcast_ref::<IORecord<Context, T>>() {
|
||||||
|
return Some(io.output.clone());
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
// Re-export for usage by tests in other modules
|
// Re-export for usage by tests in other modules
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub use test::Instrumented;
|
pub use test::Instrumented;
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ impl NodeRuntime {
|
|||||||
async fn update_network(&mut self, graph: NodeNetwork) -> Result<ResolvedDocumentNodeTypesDelta, (ResolvedDocumentNodeTypesDelta, String)> {
|
async fn update_network(&mut self, graph: NodeNetwork) -> Result<ResolvedDocumentNodeTypesDelta, (ResolvedDocumentNodeTypesDelta, String)> {
|
||||||
let mut scoped_network = wrap_network_in_scope(graph, self.editor_api.clone());
|
let mut scoped_network = wrap_network_in_scope(graph, self.editor_api.clone());
|
||||||
|
|
||||||
if let Err(e) = self.preprocessor.preprocess(&mut scoped_network, &self.resources) {
|
if let Err(e) = self.preprocessor.preprocess(&mut scoped_network, &|resource_id| self.resources.hash(&resource_id)) {
|
||||||
return Err((ResolvedDocumentNodeTypesDelta::default(), e.to_string()));
|
return Err((ResolvedDocumentNodeTypesDelta::default(), e.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ impl EditorTestUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_raster_image(&mut self, image: graphene_std::raster::Image<Color>, mouse: Option<(f64, f64)>) {
|
pub async fn create_raster_image(&mut self, image: graphene_std::raster::Image<Color>, mouse: Option<(f64, f64)>) {
|
||||||
self.handle_message(PortfolioMessage::PasteImage {
|
self.handle_message(PortfolioMessage::InsertImage {
|
||||||
name: None,
|
name: None,
|
||||||
image,
|
image,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -346,10 +346,10 @@ pub mod test_prelude {
|
|||||||
pub use super::FrontendMessageTestUtils;
|
pub use super::FrontendMessageTestUtils;
|
||||||
pub use crate::application::Editor;
|
pub use crate::application::Editor;
|
||||||
pub use crate::float_eq;
|
pub use crate::float_eq;
|
||||||
|
pub use crate::messages::clipboard::utility_types::ClipboardContentRaw;
|
||||||
pub use crate::messages::input_mapper::utility_types::input_keyboard::{Key, ModifierKeys};
|
pub use crate::messages::input_mapper::utility_types::input_keyboard::{Key, ModifierKeys};
|
||||||
pub use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
pub use crate::messages::input_mapper::utility_types::input_mouse::MouseKeys;
|
||||||
pub use crate::messages::portfolio::document::node_graph::document_node_definitions::DefinitionIdentifier;
|
pub use crate::messages::portfolio::document::node_graph::document_node_definitions::DefinitionIdentifier;
|
||||||
pub use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
|
||||||
pub use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
pub use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
|
||||||
pub use crate::messages::prelude::*;
|
pub use crate::messages::prelude::*;
|
||||||
pub use crate::messages::tool::common_functionality::graph_modification_utils::{NodeGraphLayer, is_layer_fed_by_node_of_name};
|
pub use crate::messages::tool::common_functionality::graph_modification_utils::{NodeGraphLayer, is_layer_fed_by_node_of_name};
|
||||||
|
|||||||
Generated
+9
-9
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778106249,
|
"lastModified": 1781825982,
|
||||||
"narHash": "sha256-cM/AuKy5tMhwOOQIbha8ZRRMHVfNf7cv2aljIw+qoCg=",
|
"narHash": "sha256-SlXKwIRIhrOSAcTjCB3ftPLzJWZStQIPS7J1FlZPnKk=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "6d015ea29630b7ad2402841386da2cb617a470a7",
|
"rev": "469fd08d0bcf6926321fa973c6777fbc87785dd7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -17,11 +17,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778869304,
|
"lastModified": 1782723713,
|
||||||
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
|
"narHash": "sha256-oPXCU/SSUokcGaJREHibG1CBX3+s/W7orDWQOZDsEeQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
|
"rev": "b5aa0fbd538984f6e3d201be0005b4463d8b09f8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -45,11 +45,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778987862,
|
"lastModified": 1782789458,
|
||||||
"narHash": "sha256-V3qGt9P1eJP/r/1ONablphfGiH0RP4agQhrRANpDYx8=",
|
"narHash": "sha256-CR55gKCChD9ffN1Ag5az20Z3RD4tylHlcM1SSohkMA8=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "6f44d8874ac29806c8d5cae42bf8e19ebb5ce0d3",
|
"rev": "067959ef838c440558ca519cf08ca87f43c3db3a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
wasm/pkg/
|
wrapper/pkg/
|
||||||
public/build/
|
public/build/
|
||||||
dist/
|
dist/
|
||||||
+1
-1
@@ -12,7 +12,7 @@ Source code for the web app in the form of Svelte components and [TypeScript](ht
|
|||||||
|
|
||||||
## Editor wrapper: `wrapper/`
|
## Editor wrapper: `wrapper/`
|
||||||
|
|
||||||
Wraps the editor backend codebase (`/editor`) and provides a JS-centric API for the web app to use as an entry point, unburdened by Rust's complex data types that are incompatible with JS data types. Bindings (JS functions that call into the Wasm module) are provided by [wasm-bindgen](https://rustwasm.github.io/docs/wasm-bindgen/) in concert with [wasm-pack](https://github.com/rustwasm/wasm-pack).
|
Wraps the editor backend codebase (`/editor`) and provides a JS-centric API for the web app to use as an entry point, unburdened by Rust's complex data types that are incompatible with JS data types. Bindings (JS functions that call into the Wasm module) are provided by `wasm-bindgen`. As part of `cargo run`, our build tool compiles this crate to Wasm, runs the `wasm-bindgen` CLI to generate the JS/TS bindings in `wrapper/pkg/`, and (for release builds) optimizes the binary with Binaryen's `wasm-opt`.
|
||||||
|
|
||||||
## ESLint configuration: `eslint.config.js`
|
## ESLint configuration: `eslint.config.js`
|
||||||
|
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
/* eslint-disable no-console */
|
|
||||||
|
|
||||||
import crypto from "crypto";
|
|
||||||
import fs from "fs";
|
|
||||||
import http from "http";
|
|
||||||
import https from "https";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import zlib from "zlib";
|
|
||||||
import * as tar from "tar";
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
|
|
||||||
const BRANDING_INFO_FILE = path.join(__dirname, "../.branding");
|
|
||||||
const BRANDING_DIR = path.join(__dirname, "../branding");
|
|
||||||
const INSTALLED_BRANDING_INFO_FILE = path.join(BRANDING_DIR, ".branding");
|
|
||||||
const TEMP_FILE = path.join(__dirname, "branding_download.tar.gz");
|
|
||||||
|
|
||||||
function downloadFile(url, dest) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const file = fs.createWriteStream(dest);
|
|
||||||
const protocol = url.startsWith("https") ? https : http;
|
|
||||||
|
|
||||||
const request = protocol.get(url, (response) => {
|
|
||||||
if (response.statusCode === 301 || response.statusCode === 302 || response.statusCode === 307) {
|
|
||||||
file.close();
|
|
||||||
fs.unlink(dest, () => {});
|
|
||||||
if (response.headers.location) {
|
|
||||||
downloadFile(response.headers.location, dest).then(resolve).catch(reject);
|
|
||||||
} else {
|
|
||||||
reject(new Error("Redirect location missing"));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.statusCode !== 200) {
|
|
||||||
file.close();
|
|
||||||
fs.unlink(dest, () => {});
|
|
||||||
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
response.pipe(file);
|
|
||||||
file.on("finish", () => {
|
|
||||||
file.close(resolve);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
request.on("error", (err) => {
|
|
||||||
fs.unlink(dest, () => {});
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
if (!fs.existsSync(BRANDING_INFO_FILE)) {
|
|
||||||
console.error(`Branding info file not found at ${BRANDING_INFO_FILE}`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const content = fs.readFileSync(BRANDING_INFO_FILE, "utf8");
|
|
||||||
|
|
||||||
if (fs.existsSync(INSTALLED_BRANDING_INFO_FILE)) {
|
|
||||||
const installedContent = fs.readFileSync(INSTALLED_BRANDING_INFO_FILE, "utf8");
|
|
||||||
if (content === installedContent) {
|
|
||||||
console.log("Branding assets are up to date.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const lines = content
|
|
||||||
.split("\n")
|
|
||||||
.map((l) => l.trim())
|
|
||||||
.filter((l) => l.length > 0);
|
|
||||||
|
|
||||||
if (lines.length < 2) {
|
|
||||||
console.error("Branding file must contain at least two lines: URL and Hash");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const url = lines[0];
|
|
||||||
const expectedHash = lines[1];
|
|
||||||
|
|
||||||
console.log(`Downloading branding assets from <${url}>...`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await downloadFile(url, TEMP_FILE);
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Download failed:", err);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Download complete. Verifying hash...");
|
|
||||||
|
|
||||||
const fileBuffer = fs.readFileSync(TEMP_FILE);
|
|
||||||
const hashSum = crypto.createHash("sha256");
|
|
||||||
hashSum.update(fileBuffer);
|
|
||||||
const hex = hashSum.digest("hex");
|
|
||||||
|
|
||||||
if (hex !== expectedHash) {
|
|
||||||
console.error("Hash mismatch!");
|
|
||||||
console.error(`Expected: ${expectedHash}`);
|
|
||||||
console.error(`Actual: ${hex}`);
|
|
||||||
if (fs.existsSync(TEMP_FILE)) fs.unlinkSync(TEMP_FILE);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Hash verified. Extracting...");
|
|
||||||
|
|
||||||
if (fs.existsSync(BRANDING_DIR)) {
|
|
||||||
fs.rmSync(BRANDING_DIR, { recursive: true, force: true });
|
|
||||||
}
|
|
||||||
fs.mkdirSync(BRANDING_DIR, { recursive: true });
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Extract the tar.gz file
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
fs.createReadStream(TEMP_FILE)
|
|
||||||
.pipe(zlib.createGunzip())
|
|
||||||
.pipe(
|
|
||||||
tar.x({
|
|
||||||
cwd: BRANDING_DIR,
|
|
||||||
strip: 1,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.on("error", reject)
|
|
||||||
.on("finish", resolve);
|
|
||||||
});
|
|
||||||
fs.copyFileSync(BRANDING_INFO_FILE, INSTALLED_BRANDING_INFO_FILE);
|
|
||||||
console.log("Extraction complete.");
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to extract archive:", error);
|
|
||||||
} finally {
|
|
||||||
if (fs.existsSync(TEMP_FILE)) {
|
|
||||||
fs.unlinkSync(TEMP_FILE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
.then(() => process.exit(0))
|
|
||||||
.catch((err) => {
|
|
||||||
console.error("An error occurred:", err);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
// This script automatically installs the npm packages listed in package-lock.json and runs before `npm start`.
|
|
||||||
// It skips the installation if this has already run and neither package.json nor package-lock.json has been modified since.
|
|
||||||
|
|
||||||
import { execSync } from "child_process";
|
|
||||||
import { existsSync, statSync, writeFileSync } from "fs";
|
|
||||||
|
|
||||||
const INSTALL_TIMESTAMP_FILE = "node_modules/.install-timestamp";
|
|
||||||
|
|
||||||
// Checks if the install is needed by comparing modification times
|
|
||||||
const isInstallNeeded = () => {
|
|
||||||
if (!existsSync(INSTALL_TIMESTAMP_FILE)) return true;
|
|
||||||
|
|
||||||
const timestamp = statSync(INSTALL_TIMESTAMP_FILE).mtime;
|
|
||||||
return ["package.json", "package-lock.json"].some((file) => {
|
|
||||||
return existsSync(file) && statSync(file).mtime > timestamp;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Run `npm ci` if needed and update the install timestamp
|
|
||||||
if (isInstallNeeded()) {
|
|
||||||
try {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log("Installing npm packages...");
|
|
||||||
|
|
||||||
// Check if packages are up to date, doing so quickly by using `npm ci`, preferring local cached packages, and skipping the package audit and other checks
|
|
||||||
execSync("npm ci --prefer-offline --no-audit --no-fund", { stdio: "inherit" });
|
|
||||||
|
|
||||||
// Touch the install timestamp file
|
|
||||||
writeFileSync(INSTALL_TIMESTAMP_FILE, "");
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log("Finished installing npm packages.");
|
|
||||||
} catch (_) {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error("\n\n--------------------> Failed to install npm packages. Please delete `/frontend/node_modules` then try again.\n\n");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log("All npm packages are up-to-date.");
|
|
||||||
}
|
|
||||||
Generated
+2
-332
@@ -14,7 +14,6 @@
|
|||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^9.39.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||||
"@types/node": "^25.5.2",
|
"@types/node": "^25.5.2",
|
||||||
"concurrently": "^9.2.1",
|
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import": "^2.32.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
@@ -27,7 +26,6 @@
|
|||||||
"sass": "^1.99.0",
|
"sass": "^1.99.0",
|
||||||
"svelte": "^5.55.1",
|
"svelte": "^5.55.1",
|
||||||
"svelte-check": "^4.4.6",
|
"svelte-check": "^4.4.6",
|
||||||
"tar": "^7.5.13",
|
|
||||||
"typescript": "^6.0.2",
|
"typescript": "^6.0.2",
|
||||||
"typescript-eslint": "^8.58.0",
|
"typescript-eslint": "^8.58.0",
|
||||||
"vite": "^8.0.3"
|
"vite": "^8.0.3"
|
||||||
@@ -294,19 +292,6 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@isaacs/fs-minipass": {
|
|
||||||
"version": "4.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
|
|
||||||
"integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"minipass": "^7.0.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||||
@@ -2059,94 +2044,6 @@
|
|||||||
"url": "https://paulmillr.com/funding/"
|
"url": "https://paulmillr.com/funding/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/chownr": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "BlueOak-1.0.0",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui": {
|
|
||||||
"version": "8.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
|
|
||||||
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"string-width": "^4.2.0",
|
|
||||||
"strip-ansi": "^6.0.1",
|
|
||||||
"wrap-ansi": "^7.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/ansi-regex": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/emoji-regex": {
|
|
||||||
"version": "8.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/string-width": {
|
|
||||||
"version": "4.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"emoji-regex": "^8.0.0",
|
|
||||||
"is-fullwidth-code-point": "^3.0.0",
|
|
||||||
"strip-ansi": "^6.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/strip-ansi": {
|
|
||||||
"version": "6.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^5.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/wrap-ansi": {
|
|
||||||
"version": "7.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
|
||||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": "^4.0.0",
|
|
||||||
"string-width": "^4.1.0",
|
|
||||||
"strip-ansi": "^6.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/clsx": {
|
"node_modules/clsx": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||||
@@ -2184,31 +2081,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/concurrently": {
|
|
||||||
"version": "9.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz",
|
|
||||||
"integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"chalk": "4.1.2",
|
|
||||||
"rxjs": "7.8.2",
|
|
||||||
"shell-quote": "1.8.3",
|
|
||||||
"supports-color": "8.1.1",
|
|
||||||
"tree-kill": "1.2.2",
|
|
||||||
"yargs": "17.7.2"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"conc": "dist/bin/concurrently.js",
|
|
||||||
"concurrently": "dist/bin/concurrently.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/open-cli-tools/concurrently?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.6",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
@@ -2570,16 +2442,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/escalade": {
|
|
||||||
"version": "3.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
|
||||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/escape-string-regexp": {
|
"node_modules/escape-string-regexp": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
@@ -3206,16 +3068,6 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/get-caller-file": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"engines": {
|
|
||||||
"node": "6.* || 8.* || >= 10.*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/get-intrinsic": {
|
"node_modules/get-intrinsic": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||||
@@ -4518,19 +4370,6 @@
|
|||||||
"node": ">=16 || 14 >=14.17"
|
"node": ">=16 || 14 >=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minizlib": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"minipass": "^7.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mkdirp": {
|
"node_modules/mkdirp": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
@@ -5270,16 +5109,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/require-directory": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "2.0.0-next.6",
|
"version": "2.0.0-next.6",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.6.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.6.tgz",
|
||||||
@@ -5358,16 +5187,6 @@
|
|||||||
"@rolldown/binding-win32-x64-msvc": "1.0.0-rc.12"
|
"@rolldown/binding-win32-x64-msvc": "1.0.0-rc.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rxjs": {
|
|
||||||
"version": "7.8.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
|
||||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"tslib": "^2.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/sade": {
|
"node_modules/sade": {
|
||||||
"version": "1.8.1",
|
"version": "1.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
|
||||||
@@ -5539,19 +5358,6 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/shell-quote": {
|
|
||||||
"version": "1.8.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",
|
|
||||||
"integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/side-channel": {
|
"node_modules/side-channel": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||||
@@ -5951,22 +5757,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/supports-color": {
|
|
||||||
"version": "8.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
|
|
||||||
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/supports-preserve-symlinks-flag": {
|
"node_modules/supports-preserve-symlinks-flag": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||||
@@ -6092,23 +5882,6 @@
|
|||||||
"url": "https://opencollective.com/synckit"
|
"url": "https://opencollective.com/synckit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
|
||||||
"version": "7.5.13",
|
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.13.tgz",
|
|
||||||
"integrity": "sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "BlueOak-1.0.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@isaacs/fs-minipass": "^4.0.0",
|
|
||||||
"chownr": "^3.0.0",
|
|
||||||
"minipass": "^7.1.2",
|
|
||||||
"minizlib": "^3.1.0",
|
|
||||||
"yallist": "^5.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tinyglobby": {
|
"node_modules/tinyglobby": {
|
||||||
"version": "0.2.15",
|
"version": "0.2.15",
|
||||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
||||||
@@ -6126,16 +5899,6 @@
|
|||||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tree-kill": {
|
|
||||||
"version": "1.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
|
|
||||||
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"tree-kill": "cli.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/treeify": {
|
"node_modules/treeify": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz",
|
||||||
@@ -6177,7 +5940,8 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "0BSD"
|
"license": "0BSD",
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/type-check": {
|
"node_modules/type-check": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
@@ -6705,100 +6469,6 @@
|
|||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/y18n": {
|
|
||||||
"version": "5.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
|
||||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yallist": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "BlueOak-1.0.0",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs": {
|
|
||||||
"version": "17.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
|
||||||
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"cliui": "^8.0.1",
|
|
||||||
"escalade": "^3.1.1",
|
|
||||||
"get-caller-file": "^2.0.5",
|
|
||||||
"require-directory": "^2.1.1",
|
|
||||||
"string-width": "^4.2.3",
|
|
||||||
"y18n": "^5.0.5",
|
|
||||||
"yargs-parser": "^21.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs-parser": {
|
|
||||||
"version": "21.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
|
||||||
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs/node_modules/ansi-regex": {
|
|
||||||
"version": "5.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs/node_modules/emoji-regex": {
|
|
||||||
"version": "8.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/yargs/node_modules/string-width": {
|
|
||||||
"version": "4.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"emoji-regex": "^8.0.0",
|
|
||||||
"is-fullwidth-code-point": "^3.0.0",
|
|
||||||
"strip-ansi": "^6.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs/node_modules/strip-ansi": {
|
|
||||||
"version": "6.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^5.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yocto-queue": {
|
"node_modules/yocto-queue": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||||
|
|||||||
+1
-20
@@ -6,25 +6,8 @@
|
|||||||
"browserslist": "> 1.5%, last 2 versions, not dead, not ie 11, not op_mini all, not ios_saf < 13",
|
"browserslist": "> 1.5%, last 2 versions, not dead, not ie 11, not op_mini all, not ios_saf < 13",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"---------- DEV SERVER ----------": "",
|
|
||||||
"start": "npm run setup && npm run wasm:build-dev && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run wasm:watch-dev\"",
|
|
||||||
"production": "npm run setup && npm run wasm:build-production && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run wasm:watch-production\"",
|
|
||||||
"---------- BUILDS ----------": "",
|
|
||||||
"build": "npm run setup && npm run wasm:build-production && vite build",
|
|
||||||
"build-dev": "npm run setup && npm run wasm:build-dev && vite build --mode dev",
|
|
||||||
"build-native": "npm run setup && npm run native:build-production",
|
|
||||||
"build-native-dev": "npm run setup && npm run native:build-dev",
|
|
||||||
"---------- UTILITIES ----------": "",
|
|
||||||
"check": "svelte-check --fail-on-warnings && eslint",
|
"check": "svelte-check --fail-on-warnings && eslint",
|
||||||
"fix": "eslint --fix",
|
"fix": "eslint --fix"
|
||||||
"---------- INTERNAL ----------": "",
|
|
||||||
"setup": "node package-installer.js && node branding-installer.js",
|
|
||||||
"native:build-dev": "wasm-pack build ./wrapper --dev --target=web --no-default-features --features native && vite build --mode native",
|
|
||||||
"native:build-production": "wasm-pack build ./wrapper --release --target=web --no-default-features --features native && vite build --mode native",
|
|
||||||
"wasm:build-dev": "wasm-pack build ./wrapper --dev --target=web",
|
|
||||||
"wasm:build-production": "wasm-pack build ./wrapper --release --target=web",
|
|
||||||
"wasm:watch-dev": "cargo watch --postpone --watch-when-idle --workdir=wrapper --shell \"wasm-pack build . --dev --target=web -- --color=always\"",
|
|
||||||
"wasm:watch-production": "cargo watch --postpone --watch-when-idle --workdir=wrapper --shell \"wasm-pack build . --release --target=web -- --color=always\""
|
|
||||||
},
|
},
|
||||||
"//": "NOTE: `source-sans-pro` is never to be upgraded to 3.x because that renders 1px above its intended position.",
|
"//": "NOTE: `source-sans-pro` is never to be upgraded to 3.x because that renders 1px above its intended position.",
|
||||||
"///": "Waiting on <https://github.com/import-js/eslint-plugin-import/issues/3227> before we can update @eslint/js and eslint to 10.x",
|
"///": "Waiting on <https://github.com/import-js/eslint-plugin-import/issues/3227> before we can update @eslint/js and eslint to 10.x",
|
||||||
@@ -36,7 +19,6 @@
|
|||||||
"@eslint/js": "^9.39.2",
|
"@eslint/js": "^9.39.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||||
"@types/node": "^25.5.2",
|
"@types/node": "^25.5.2",
|
||||||
"concurrently": "^9.2.1",
|
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
"eslint-import-resolver-typescript": "^4.4.4",
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
"eslint-plugin-import": "^2.32.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
@@ -49,7 +31,6 @@
|
|||||||
"sass": "^1.99.0",
|
"sass": "^1.99.0",
|
||||||
"svelte": "^5.55.1",
|
"svelte": "^5.55.1",
|
||||||
"svelte-check": "^4.4.6",
|
"svelte-check": "^4.4.6",
|
||||||
"tar": "^7.5.13",
|
|
||||||
"typescript": "^6.0.2",
|
"typescript": "^6.0.2",
|
||||||
"typescript-eslint": "^8.58.0",
|
"typescript-eslint": "^8.58.0",
|
||||||
"vite": "^8.0.3"
|
"vite": "^8.0.3"
|
||||||
|
|||||||
@@ -233,7 +233,6 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background: var(--color-2-mildblack);
|
background: var(--color-2-mildblack);
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
-webkit-user-select: none; // Still required by Safari as of 2025
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text-label.multiline {
|
.text-label.multiline {
|
||||||
-webkit-user-select: text; // Still required by Safari as of 2026
|
|
||||||
user-select: text;
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -884,7 +884,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
-webkit-user-select: none; // Still required by Safari as of 2025
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
// Workaround for `user-select: none` not working on <input> elements
|
// Workaround for `user-select: none` not working on <input> elements
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
@@ -1,12 +1,171 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { getContext, onMount, onDestroy } from "svelte";
|
||||||
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
import LayoutCol from "/src/components/layout/LayoutCol.svelte";
|
||||||
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
import WidgetLayout from "/src/components/widgets/WidgetLayout.svelte";
|
||||||
import { propertiesPanelLayout } from "/src/stores/portfolio";
|
import { propertiesPanelLayout } from "/src/stores/portfolio";
|
||||||
|
import type { EditorWrapper } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
|
|
||||||
|
let sectionsCol: LayoutCol | undefined;
|
||||||
|
|
||||||
|
// Interactive dragging to reorder Properties panel node sections (a selected layer's chain nodes, or pinned nodes)
|
||||||
|
type DragState = { nodeId: bigint; startX: number; startY: number; active: boolean };
|
||||||
|
let dragState: DragState | undefined = undefined;
|
||||||
|
let dragging = false;
|
||||||
|
let fromIndex: number | undefined = undefined;
|
||||||
|
let insertIndex: number | undefined = undefined;
|
||||||
|
let insertMarkerTop: number | undefined = undefined;
|
||||||
|
let justFinishedDrag = false; // Used to suppress the click event that follows a drag release (which would otherwise toggle a section)
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
addEventListener("pointermove", draggingPointerMove);
|
||||||
|
addEventListener("pointerup", draggingPointerUp);
|
||||||
|
addEventListener("keydown", draggingKeyDown);
|
||||||
|
addEventListener("mousedown", draggingMouseDown);
|
||||||
|
// Capture phase so this runs before a section header's own click handler
|
||||||
|
addEventListener("click", suppressClickAfterDrag, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
removeEventListener("pointermove", draggingPointerMove);
|
||||||
|
removeEventListener("pointerup", draggingPointerUp);
|
||||||
|
removeEventListener("keydown", draggingKeyDown);
|
||||||
|
removeEventListener("mousedown", draggingMouseDown);
|
||||||
|
removeEventListener("click", suppressClickAfterDrag, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
function suppressClickAfterDrag(e: MouseEvent) {
|
||||||
|
if (!justFinishedDrag) return;
|
||||||
|
justFinishedDrag = false;
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reorderableSections(): Element[] {
|
||||||
|
const container = sectionsCol?.div();
|
||||||
|
if (!container) return [];
|
||||||
|
return Array.from(container.querySelectorAll("[data-properties-reorderable-section]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sectionPointerDown(e: PointerEvent) {
|
||||||
|
// Only left click drags
|
||||||
|
if (e.button !== 0) return;
|
||||||
|
|
||||||
|
const target = e.target instanceof Element ? e.target : undefined;
|
||||||
|
if (!target) return;
|
||||||
|
|
||||||
|
// The drag handle is the section header
|
||||||
|
const handle = target.closest("[data-properties-reorder-handle]");
|
||||||
|
if (!handle) return;
|
||||||
|
|
||||||
|
// Don't begin a drag when pressing one of the header's own buttons (pin/delete/visibility); only the header itself grabs
|
||||||
|
if (target.closest("button") !== handle) return;
|
||||||
|
|
||||||
|
const section = target.closest("[data-properties-reorderable-section]");
|
||||||
|
const nodeIdAttribute = section?.getAttribute("data-node-id");
|
||||||
|
if (!section || !nodeIdAttribute) return;
|
||||||
|
|
||||||
|
dragState = { nodeId: BigInt(nodeIdAttribute), startX: e.clientX, startY: e.clientY, active: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
function draggingPointerMove(e: PointerEvent) {
|
||||||
|
if (!dragState) return;
|
||||||
|
|
||||||
|
// Wait until the cursor has moved beyond the threshold before treating it as a drag (so a click still toggles the section)
|
||||||
|
if (!dragState.active) {
|
||||||
|
const distance = Math.hypot(e.clientX - dragState.startX, e.clientY - dragState.startY);
|
||||||
|
const DRAG_THRESHOLD = 5;
|
||||||
|
if (distance <= DRAG_THRESHOLD) return;
|
||||||
|
|
||||||
|
dragState.active = true;
|
||||||
|
dragging = true;
|
||||||
|
fromIndex = reorderableSections().findIndex((section) => section.getAttribute("data-node-id") === String(dragState?.nodeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateInsertIndex(e.clientY);
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateInsertIndex(clientY: number) {
|
||||||
|
const container = sectionsCol?.div();
|
||||||
|
const sections = reorderableSections();
|
||||||
|
if (!container || sections.length === 0) {
|
||||||
|
insertIndex = undefined;
|
||||||
|
insertMarkerTop = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const containerRect = container.getBoundingClientRect();
|
||||||
|
const scrollTop = container.scrollTop;
|
||||||
|
// Convert a viewport Y to a position within the (scrollable) container's content, so the marker tracks the content when scrolled
|
||||||
|
const toContentOffset = (viewportY: number) => viewportY - containerRect.top + scrollTop;
|
||||||
|
|
||||||
|
// The insertion index is the number of sections whose vertical midpoint sits above the cursor. The index flips only when
|
||||||
|
// the cursor crosses a section's midpoint, so each gap maps to exactly one index (and gaps between sections are handled).
|
||||||
|
let index = 0;
|
||||||
|
for (let i = 0; i < sections.length; i += 1) {
|
||||||
|
const rect = sections[i].getBoundingClientRect();
|
||||||
|
if (clientY < (rect.top + rect.bottom) / 2) break;
|
||||||
|
index = i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position the marker purely from the gap index so it has one fixed spot per gap, rather than snapping between adjacent
|
||||||
|
// sections' edges as the cursor crosses their shared boundary.
|
||||||
|
let markerViewportY;
|
||||||
|
if (index <= 0) {
|
||||||
|
markerViewportY = sections[0].getBoundingClientRect().top - 2;
|
||||||
|
} else if (index >= sections.length) {
|
||||||
|
markerViewportY = sections[sections.length - 1].getBoundingClientRect().bottom + 2;
|
||||||
|
} else {
|
||||||
|
markerViewportY = (sections[index - 1].getBoundingClientRect().bottom + sections[index].getBoundingClientRect().top) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
insertIndex = index;
|
||||||
|
insertMarkerTop = toContentOffset(markerViewportY);
|
||||||
|
}
|
||||||
|
|
||||||
|
function draggingPointerUp() {
|
||||||
|
if (dragState?.active) {
|
||||||
|
// Suppress the click that the browser fires after the drag release, so it doesn't toggle the dropped section
|
||||||
|
justFinishedDrag = true;
|
||||||
|
|
||||||
|
// Skip drops that don't actually move the node (into its own slot), or where the dragged section vanished from the DOM mid-drag (fromIndex of -1)
|
||||||
|
if (insertIndex !== undefined && fromIndex !== undefined && fromIndex !== -1 && insertIndex !== fromIndex && insertIndex !== fromIndex + 1) {
|
||||||
|
editor.reorderPropertiesSection(dragState.nodeId, insertIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abortDrag();
|
||||||
|
}
|
||||||
|
|
||||||
|
function draggingKeyDown(e: KeyboardEvent) {
|
||||||
|
if (e.key === "Escape" && dragState?.active) {
|
||||||
|
abortDrag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function draggingMouseDown(e: MouseEvent) {
|
||||||
|
// Abort an in-progress drag if the user presses the right mouse button
|
||||||
|
if (e.button === 2 && dragState?.active) {
|
||||||
|
abortDrag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function abortDrag() {
|
||||||
|
dragState = undefined;
|
||||||
|
dragging = false;
|
||||||
|
fromIndex = undefined;
|
||||||
|
insertIndex = undefined;
|
||||||
|
insertMarkerTop = undefined;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<LayoutCol class="properties">
|
<LayoutCol class="properties">
|
||||||
<LayoutCol class="sections" scrollableY={true}>
|
<LayoutCol class="sections" classes={{ dragging }} scrollableY={true} bind:this={sectionsCol} on:pointerdown={sectionPointerDown}>
|
||||||
<WidgetLayout layout={$propertiesPanelLayout} layoutTarget="PropertiesPanel" />
|
<WidgetLayout layout={$propertiesPanelLayout} layoutTarget="PropertiesPanel" />
|
||||||
|
{#if dragging && insertMarkerTop !== undefined}
|
||||||
|
<div class="insert-mark" style:top={`${insertMarkerTop}px`}></div>
|
||||||
|
{/if}
|
||||||
</LayoutCol>
|
</LayoutCol>
|
||||||
</LayoutCol>
|
</LayoutCol>
|
||||||
|
|
||||||
@@ -17,6 +176,13 @@
|
|||||||
|
|
||||||
.sections {
|
.sections {
|
||||||
flex: 1 1 100%;
|
flex: 1 1 100%;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
// While dragging a section, disable pointer events (which inherit down to the sections) so the drop doesn't toggle a section's expansion, and prevent text selection
|
||||||
|
&.dragging {
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
// Used as a placeholder for empty assist widgets
|
// Used as a placeholder for empty assist widgets
|
||||||
.separator.section.horizontal {
|
.separator.section.horizontal {
|
||||||
@@ -27,6 +193,18 @@
|
|||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.insert-mark {
|
||||||
|
position: absolute;
|
||||||
|
left: 4px;
|
||||||
|
right: 4px;
|
||||||
|
background: var(--color-e-nearwhite);
|
||||||
|
height: 5px;
|
||||||
|
// The marker's `top` is the center of the gap, so shift up by half its height to straddle that line
|
||||||
|
transform: translateY(-50%);
|
||||||
|
z-index: 1;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-button {
|
.text-button {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<LayoutCol class="bottom-message">
|
<LayoutCol class="bottom-message">
|
||||||
{#if import.meta.env.MODE === "native"}
|
{#if import.meta.env.MODE === "native"}
|
||||||
<TextLabel italic={true} disabled={true}>
|
<TextLabel italic={true} disabled={true}>
|
||||||
You are testing Release Candidate 5 of the 1.0 desktop release. Please regularly check Discord for the next testing build and report issues you encounter.
|
You are testing Release Candidate 6 of the 1.0 desktop release. Please regularly check Discord for the next testing build and report issues you encounter.
|
||||||
</TextLabel>
|
</TextLabel>
|
||||||
{:else if new Date() < new Date(2026, 10, 1)}
|
{:else if new Date() < new Date(2026, 10, 1)}
|
||||||
<TextLabel italic={true} disabled={true}>
|
<TextLabel italic={true} disabled={true}>
|
||||||
|
|||||||
@@ -952,7 +952,6 @@
|
|||||||
&.faded:hover {
|
&.faded:hover {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
-webkit-user-select: text;
|
|
||||||
user-select: text;
|
user-select: text;
|
||||||
transition:
|
transition:
|
||||||
opacity 0.2s,
|
opacity 0.2s,
|
||||||
|
|||||||
@@ -13,14 +13,24 @@
|
|||||||
export { className as class };
|
export { className as class };
|
||||||
export let classes: Record<string, boolean> = {};
|
export let classes: Record<string, boolean> = {};
|
||||||
|
|
||||||
let expanded = true;
|
// Whether the section is expanded is owned by the backend (persisted per node), so just reflect it here
|
||||||
|
$: expanded = widgetData.expanded;
|
||||||
|
|
||||||
|
// A reorderable section is a Properties panel node section the user can drag to reorder (a layer chain's node, or a pinned node)
|
||||||
|
$: reorderable = layoutTarget === "PropertiesPanel" && widgetData.draggable;
|
||||||
|
|
||||||
const editor = getContext<EditorWrapper>("editor");
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- TODO: Implement collapsable sections with properties system -->
|
<!-- TODO: Implement collapsable sections with properties system -->
|
||||||
<LayoutCol class={`widget-section ${className}`.trim()} {classes}>
|
<LayoutCol class={`widget-section ${className}`.trim()} {classes} data-properties-reorderable-section={reorderable ? "" : undefined} data-node-id={reorderable ? String(widgetData.id) : undefined}>
|
||||||
<button class="header" class:expanded on:click|stopPropagation={() => (expanded = !expanded)} tabindex="0">
|
<button
|
||||||
|
class="header"
|
||||||
|
class:expanded
|
||||||
|
data-properties-reorder-handle={reorderable ? "" : undefined}
|
||||||
|
on:click|stopPropagation={() => editor.toggleNodePropertiesSectionExpanded(widgetData.id)}
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
<div class="expand-arrow"></div>
|
<div class="expand-arrow"></div>
|
||||||
<TextLabel tooltipLabel={widgetData.name} tooltipDescription={widgetData.description} bold={true}>{widgetData.name}</TextLabel>
|
<TextLabel tooltipLabel={widgetData.name} tooltipDescription={widgetData.description} bold={true}>{widgetData.name}</TextLabel>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|||||||
@@ -215,10 +215,11 @@
|
|||||||
component: NumberInput,
|
component: NumberInput,
|
||||||
getProps: (props, index) => ({
|
getProps: (props, index) => ({
|
||||||
...props,
|
...props,
|
||||||
incrementCallbackIncrease: () => widgetValueCommitAndUpdate(index, "Increment", false),
|
incrementCallbackIncrease: () => widgetValueCommitAndUpdate(index, { increment: "Increase" }, false),
|
||||||
incrementCallbackDecrease: () => widgetValueCommitAndUpdate(index, "Decrement", false),
|
incrementCallbackDecrease: () => widgetValueCommitAndUpdate(index, { increment: "Decrease" }, false),
|
||||||
$$events: {
|
$$events: {
|
||||||
value: (e: CustomEvent) => widgetValueUpdate(index, e.detail, true),
|
value: (e: CustomEvent) => widgetValueUpdate(index, e.detail, true),
|
||||||
|
commitText: (e: CustomEvent) => widgetValueUpdate(index, e.detail, true),
|
||||||
startHistoryTransaction: () => widgetValueCommit(index, props.value),
|
startHistoryTransaction: () => widgetValueCommit(index, props.value),
|
||||||
commitHistoryTransaction: () => editor.endTransaction(),
|
commitHistoryTransaction: () => editor.endTransaction(),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
import FieldInput from "/src/components/widgets/inputs/FieldInput.svelte";
|
||||||
import { PRESS_REPEAT_DELAY_MS, PRESS_REPEAT_INTERVAL_MS } from "/src/managers/input";
|
import { PRESS_REPEAT_DELAY_MS, PRESS_REPEAT_INTERVAL_MS } from "/src/managers/input";
|
||||||
import { browserVersion } from "/src/utility-functions/platform";
|
import { browserVersion } from "/src/utility-functions/platform";
|
||||||
import { evaluateMathExpression } from "/wrapper/pkg/graphite_wasm_wrapper";
|
|
||||||
import type { ActionShortcut, EditorWrapper, NumberInputIncrementBehavior, NumberInputMode } from "/wrapper/pkg/graphite_wasm_wrapper";
|
import type { ActionShortcut, EditorWrapper, NumberInputIncrementBehavior, NumberInputMode } from "/wrapper/pkg/graphite_wasm_wrapper";
|
||||||
|
|
||||||
const BUTTONS_LEFT = 0b0000_0001;
|
const BUTTONS_LEFT = 0b0000_0001;
|
||||||
@@ -12,7 +11,12 @@
|
|||||||
const BUTTON_LEFT = 0;
|
const BUTTON_LEFT = 0;
|
||||||
const BUTTON_RIGHT = 2;
|
const BUTTON_RIGHT = 2;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ value: number | undefined; startHistoryTransaction: undefined; commitHistoryTransaction: undefined }>();
|
const dispatch = createEventDispatcher<{
|
||||||
|
value: number | undefined;
|
||||||
|
commitText: string;
|
||||||
|
startHistoryTransaction: undefined;
|
||||||
|
commitHistoryTransaction: undefined;
|
||||||
|
}>();
|
||||||
|
|
||||||
const editor = getContext<EditorWrapper>("editor");
|
const editor = getContext<EditorWrapper>("editor");
|
||||||
|
|
||||||
@@ -247,21 +251,11 @@
|
|||||||
// The `unFocus()` call at the bottom of this function and in `onTextChangeCanceled()` causes this function to be run again, so this check skips a second run.
|
// The `unFocus()` call at the bottom of this function and in `onTextChangeCanceled()` causes this function to be run again, so this check skips a second run.
|
||||||
if (!editing) return;
|
if (!editing) return;
|
||||||
|
|
||||||
// Insert a leading zero before all decimal points lacking a preceding digit, since the library doesn't realize that "point" means "zero point".
|
// The backend evaluates the math, validates against this widget's constraints, and (only when changed) applies it within a history transaction before resending the widget.
|
||||||
const textWithLeadingZeroes = text.replaceAll(/(?<=^|[^0-9])\./g, "0."); // Match any "." that is preceded by the start of the string (^) or a non-digit character ([^0-9])
|
dispatch("commitText", text);
|
||||||
|
|
||||||
let newValue = evaluateMathExpression(textWithLeadingZeroes);
|
// Revert the field to the current value's canonical display; an accepted change resends the widget and re-runs `watchValue` to show the new value.
|
||||||
if (newValue !== undefined && isNaN(newValue)) newValue = undefined; // Rejects `sqrt(-1)`
|
text = displayText(value, unit);
|
||||||
|
|
||||||
if (newValue !== undefined) {
|
|
||||||
const oldValue = value !== undefined && isInteger ? Math.round(value) : value;
|
|
||||||
if (newValue !== oldValue) {
|
|
||||||
dispatch("startHistoryTransaction");
|
|
||||||
transactionInProgress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateValue(newValue);
|
|
||||||
commitTransactionIfInProgress();
|
|
||||||
|
|
||||||
editing = false;
|
editing = false;
|
||||||
self?.unFocus();
|
self?.unFocus();
|
||||||
|
|||||||
@@ -36,6 +36,13 @@
|
|||||||
let activeMarkerIsMidpointRestore = false;
|
let activeMarkerIsMidpointRestore = false;
|
||||||
// Tracks whether a midpoint drag has actually moved by at least one frame, to distinguish click-to-select from drag.
|
// Tracks whether a midpoint drag has actually moved by at least one frame, to distinguish click-to-select from drag.
|
||||||
let midpointDragged = false;
|
let midpointDragged = false;
|
||||||
|
// Mirrors whether Alt is currently held during the drag (the desired state).
|
||||||
|
let duplicateRequested = false;
|
||||||
|
// Mirrors whether a frozen copy currently exists in the gradient (the materialized state).
|
||||||
|
let duplicateActive = false;
|
||||||
|
// Set when a key-triggered reconcile inserts/removes the frozen copy, so the next pointer move skips emitting a `MoveMarker`
|
||||||
|
// that would otherwise race the structural change before Rust has reported the dragged marker's new index.
|
||||||
|
let skipNextMove = false;
|
||||||
|
|
||||||
function emit(intent: SpectrumInputUpdate) {
|
function emit(intent: SpectrumInputUpdate) {
|
||||||
dispatch("update", intent);
|
dispatch("update", intent);
|
||||||
@@ -68,6 +75,9 @@
|
|||||||
activeMarkerIsMidpointRestore = activeMarkerIsMidpoint;
|
activeMarkerIsMidpointRestore = activeMarkerIsMidpoint;
|
||||||
dragRestorePosition = markers[index].position;
|
dragRestorePosition = markers[index].position;
|
||||||
dragInsertedMarker = false;
|
dragInsertedMarker = false;
|
||||||
|
// Only offer duplication where new stops are allowed. Don't materialize yet: wait for the first move so an Alt-click without a drag leaves no stray copy.
|
||||||
|
duplicateRequested = allowInsert && e.altKey;
|
||||||
|
duplicateActive = false;
|
||||||
setActive(index, false);
|
setActive(index, false);
|
||||||
addEvents();
|
addEvents();
|
||||||
return;
|
return;
|
||||||
@@ -118,7 +128,10 @@
|
|||||||
activeMarkerIsMidpointRestore = activeMarkerIsMidpoint;
|
activeMarkerIsMidpointRestore = activeMarkerIsMidpoint;
|
||||||
dragRestorePosition = position;
|
dragRestorePosition = position;
|
||||||
dragInsertedMarker = true;
|
dragInsertedMarker = true;
|
||||||
// Don't dispatch an `ActiveMarker` here — the Rust handler already updates the active marker in response to `InsertMarker` and a duplicate `ActiveMarker` would race the layout update.
|
// A stop being created by this drag can't be duplicated; duplication is only for dragging an existing stop.
|
||||||
|
duplicateRequested = false;
|
||||||
|
duplicateActive = false;
|
||||||
|
// Don't dispatch an `ActiveMarker` here. The Rust handler already updates the active marker in response to `InsertMarker` and a duplicate `ActiveMarker` would race the layout update.
|
||||||
activeMarkerIndex = insertIndex;
|
activeMarkerIndex = insertIndex;
|
||||||
activeMarkerIsMidpoint = false;
|
activeMarkerIsMidpoint = false;
|
||||||
addEvents();
|
addEvents();
|
||||||
@@ -134,10 +147,78 @@
|
|||||||
else if (allowDelete) emit({ DeleteMarker: { index: activeMarkerIndex } });
|
else if (allowDelete) emit({ DeleteMarker: { index: activeMarkerIndex } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Locate the frozen copy left by a duplicate: the non-dragged marker sitting (within epsilon) at the drag's start position.
|
||||||
|
// Returns undefined if no marker is close enough, so a stale `markers` prop can never delete an unrelated stop.
|
||||||
|
function findDuplicateAnchorIndex(): number | undefined {
|
||||||
|
// The frozen copy is inserted at exactly the drag's start position and round-trips through Rust losslessly, so it matches within this tolerance
|
||||||
|
const DUPLICATE_POSITION_EPSILON = 1e-6;
|
||||||
|
|
||||||
|
if (dragRestorePosition === undefined) return undefined;
|
||||||
|
|
||||||
|
const startPosition = dragRestorePosition;
|
||||||
|
|
||||||
|
let best: number | undefined = undefined;
|
||||||
|
let bestDistance = DUPLICATE_POSITION_EPSILON;
|
||||||
|
|
||||||
|
markers.forEach((marker, index) => {
|
||||||
|
if (index === activeMarkerIndex) return;
|
||||||
|
|
||||||
|
const distance = Math.abs(marker.position - startPosition);
|
||||||
|
if (distance < bestDistance) {
|
||||||
|
bestDistance = distance;
|
||||||
|
best = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bring the materialized duplicate state in line with whether Alt is currently held, inserting or removing the frozen copy.
|
||||||
|
// Returns whether a structural change was emitted, so callers can skip the next move that would race it.
|
||||||
|
function reconcileDuplicate(): boolean {
|
||||||
|
if (!allowInsert || activeMarkerIndex === undefined || activeMarkerIsMidpoint) return false;
|
||||||
|
|
||||||
|
if (duplicateRequested && !duplicateActive) {
|
||||||
|
// Drop a frozen copy at the drag's start position. The dragged marker stays active and becomes the duplicate being moved.
|
||||||
|
|
||||||
|
if (dragRestorePosition === undefined) return false;
|
||||||
|
|
||||||
|
emit({ InsertDuplicate: { index: activeMarkerIndex, position: dragRestorePosition } });
|
||||||
|
duplicateActive = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else if (!duplicateRequested && duplicateActive) {
|
||||||
|
// Remove the frozen copy so only the dragged marker remains, as if it had been dragged all along.
|
||||||
|
|
||||||
|
const anchor = findDuplicateAnchorIndex();
|
||||||
|
if (anchor === undefined) return false;
|
||||||
|
|
||||||
|
emit({ RemoveDuplicate: { index: anchor } });
|
||||||
|
duplicateActive = false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function moveActiveMarker(e: PointerEvent) {
|
function moveActiveMarker(e: PointerEvent) {
|
||||||
if (disabled || activeMarkerIndex === undefined) return;
|
if (disabled || activeMarkerIndex === undefined) return;
|
||||||
if (e.buttons === 0) {
|
if (e.buttons === 0) {
|
||||||
stopDrag();
|
endDrag();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Materialize/remove the frozen copy if Alt's state changed without a key event reconciling it first (e.g. Alt held at drag start).
|
||||||
|
// Skip this frame's move. The next move runs once Rust has reported the dragged marker's new index.
|
||||||
|
if (duplicateRequested !== duplicateActive) {
|
||||||
|
reconcileDuplicate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A key event (Alt press/release) already reconciled. Skip the one move that would race that structural change.
|
||||||
|
if (skipNextMove) {
|
||||||
|
skipNextMove = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +233,7 @@
|
|||||||
function moveActiveMidpoint(e: PointerEvent) {
|
function moveActiveMidpoint(e: PointerEvent) {
|
||||||
if (disabled || activeMarkerIndex === undefined) return;
|
if (disabled || activeMarkerIndex === undefined) return;
|
||||||
if (e.buttons === 0) {
|
if (e.buttons === 0) {
|
||||||
stopDrag();
|
endDrag();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,18 +254,30 @@
|
|||||||
function abortDrag() {
|
function abortDrag() {
|
||||||
if (disabled || activeMarkerIndex === undefined) return;
|
if (disabled || activeMarkerIndex === undefined) return;
|
||||||
|
|
||||||
// Restore the dragged value, or delete the marker if it was inserted as part of this drag.
|
const dragged = activeMarkerIndex;
|
||||||
|
const anchor = duplicateActive ? findDuplicateAnchorIndex() : undefined;
|
||||||
|
|
||||||
if (dragInsertedMarker) {
|
if (dragInsertedMarker) {
|
||||||
emit({ DeleteMarker: { index: activeMarkerIndex } });
|
// The dragged marker was created by this drag, so delete it.
|
||||||
|
emit({ DeleteMarker: { index: dragged } });
|
||||||
|
} else if (anchor !== undefined) {
|
||||||
|
// A duplicated pre-existing marker: the frozen copy already sits at the start position, so deleting the dragged copy restores the original.
|
||||||
|
emit({ DeleteMarker: { index: dragged } });
|
||||||
} else if (dragRestorePosition !== undefined) {
|
} else if (dragRestorePosition !== undefined) {
|
||||||
if (activeMarkerIsMidpoint) emit({ MoveMidpoint: { index: activeMarkerIndex, position: dragRestorePosition } });
|
// Plain drag: return the marker (or midpoint) to where it began.
|
||||||
else emit({ MoveMarker: { index: activeMarkerIndex, position: dragRestorePosition } });
|
if (activeMarkerIsMidpoint) emit({ MoveMidpoint: { index: dragged, position: dragRestorePosition } });
|
||||||
|
else emit({ MoveMarker: { index: dragged, position: dragRestorePosition } });
|
||||||
}
|
}
|
||||||
|
|
||||||
setActive(activeMarkerIndexRestore, activeMarkerIsMidpointRestore);
|
setActive(activeMarkerIndexRestore, activeMarkerIsMidpointRestore);
|
||||||
stopDrag();
|
stopDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function endDrag() {
|
||||||
|
if (!duplicateRequested && duplicateActive) reconcileDuplicate();
|
||||||
|
stopDrag();
|
||||||
|
}
|
||||||
|
|
||||||
function stopDrag() {
|
function stopDrag() {
|
||||||
removeEvents();
|
removeEvents();
|
||||||
dragRestorePosition = undefined;
|
dragRestorePosition = undefined;
|
||||||
@@ -192,6 +285,9 @@
|
|||||||
activeMarkerIndexRestore = undefined;
|
activeMarkerIndexRestore = undefined;
|
||||||
activeMarkerIsMidpointRestore = false;
|
activeMarkerIsMidpointRestore = false;
|
||||||
midpointDragged = false;
|
midpointDragged = false;
|
||||||
|
duplicateRequested = false;
|
||||||
|
duplicateActive = false;
|
||||||
|
skipNextMove = false;
|
||||||
dispatch("dragging", false);
|
dispatch("dragging", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +297,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onPointerUp() {
|
function onPointerUp() {
|
||||||
stopDrag();
|
endDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDown(e: MouseEvent) {
|
function onMouseDown(e: MouseEvent) {
|
||||||
@@ -214,6 +310,23 @@
|
|||||||
const element = markerTrackElement?.div();
|
const element = markerTrackElement?.div();
|
||||||
if (element) preventEscapeClosingParentFloatingMenu(element);
|
if (element) preventEscapeClosingParentFloatingMenu(element);
|
||||||
abortDrag();
|
abortDrag();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pressing Alt mid-drag duplicates the marker, leaving a frozen copy where the drag began. Reconcile immediately for instant
|
||||||
|
// feedback, and arm a skip so the next pointer move doesn't race the just-emitted structural change. Only when dragging an
|
||||||
|
// existing stop (not one being created by this drag).
|
||||||
|
if (e.key === "Alt" && allowInsert && !activeMarkerIsMidpoint && !dragInsertedMarker && !duplicateRequested) {
|
||||||
|
duplicateRequested = true;
|
||||||
|
if (reconcileDuplicate()) skipNextMove = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeyUp(e: KeyboardEvent) {
|
||||||
|
// Releasing Alt mid-drag removes the frozen copy immediately, as if the marker had been dragged all along (likewise armed to skip the next move).
|
||||||
|
if (e.key === "Alt" && duplicateRequested) {
|
||||||
|
duplicateRequested = false;
|
||||||
|
if (reconcileDuplicate()) skipNextMove = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +335,7 @@
|
|||||||
document.addEventListener("pointerup", onPointerUp);
|
document.addEventListener("pointerup", onPointerUp);
|
||||||
document.addEventListener("mousedown", onMouseDown);
|
document.addEventListener("mousedown", onMouseDown);
|
||||||
document.addEventListener("keydown", onKeyDown);
|
document.addEventListener("keydown", onKeyDown);
|
||||||
|
document.addEventListener("keyup", onKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeEvents() {
|
function removeEvents() {
|
||||||
@@ -229,6 +343,7 @@
|
|||||||
document.removeEventListener("pointerup", onPointerUp);
|
document.removeEventListener("pointerup", onPointerUp);
|
||||||
document.removeEventListener("mousedown", onMouseDown);
|
document.removeEventListener("mousedown", onMouseDown);
|
||||||
document.removeEventListener("keydown", onKeyDown);
|
document.removeEventListener("keydown", onKeyDown);
|
||||||
|
document.removeEventListener("keyup", onKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map midpoint pairs to absolute track positions for rendering the diamond markers.
|
// Map midpoint pairs to absolute track positions for rendering the diamond markers.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
{#if $tooltip.visible}
|
{#if $tooltip.visible}
|
||||||
<Tooltip />
|
<Tooltip />
|
||||||
{/if}
|
{/if}
|
||||||
{#if import.meta.env.MODE === "native" && new Date() > new Date("2026-07-01")}
|
{#if import.meta.env.MODE === "native" && new Date() > new Date("2026-12-31")}
|
||||||
<LayoutCol class="release-candidate-expiry">
|
<LayoutCol class="release-candidate-expiry">
|
||||||
<TextLabel>
|
<TextLabel>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
+26
-1
@@ -11,7 +11,7 @@ const projectRootDir = path.resolve(__dirname);
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
return {
|
return {
|
||||||
plugins: [svelteGlobalStyles(), svelte(), staticAssets(), mode !== "native" && thirdPartyLicenses(), mode !== "native" && serviceWorker()],
|
plugins: [svelteGlobalStyles(), webkitUserSelectPrefix(), svelte(), staticAssets(), mode !== "native" && thirdPartyLicenses(), mode !== "native" && serviceWorker()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: [{ find: /\/..\/branding\/(.*\.svg)/, replacement: path.resolve(projectRootDir, "../branding", "$1?raw") }],
|
alias: [{ find: /\/..\/branding\/(.*\.svg)/, replacement: path.resolve(projectRootDir, "../branding", "$1?raw") }],
|
||||||
},
|
},
|
||||||
@@ -35,6 +35,31 @@ function svelteGlobalStyles(): PluginOption {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adds the `-webkit-user-select` prefix alongside every `user-select` declaration in Svelte component styles (still required by Safari). Remove when Safari ships the unprefixed version.
|
||||||
|
// WebKit tracking issue:
|
||||||
|
// https://bugs.webkit.org/show_bug.cgi?id=208677
|
||||||
|
// Included in Interop 2026:
|
||||||
|
// https://webkit.org/blog/17818/announcing-interop-2026/#web-compat
|
||||||
|
// https://github.com/web-platform-tests/interop/issues/1000#issuecomment-3892214470
|
||||||
|
// Web platform test for WebKit implementation status:
|
||||||
|
// https://wpt.fyi/results/css/css-ui/parsing/user-select-computed.html?label=master&label=experimental&aligned&view=interop&q=label%3Ainterop-2026-webcompat
|
||||||
|
function webkitUserSelectPrefix(): PluginOption {
|
||||||
|
return {
|
||||||
|
name: "webkit-user-select-prefix",
|
||||||
|
enforce: "pre",
|
||||||
|
transform(code, id) {
|
||||||
|
if (!id.endsWith(".svelte")) return;
|
||||||
|
|
||||||
|
return code.replace(/<style(?=\s|>)([^>]*)>(.*?)<\/style>/gs, (_, attrs, content) => {
|
||||||
|
// The lookbehind requires a property boundary on the left, so it skips `-webkit-`/`-moz-` prefixes, `--custom` properties, and `$scss-variables`.
|
||||||
|
// Excluding newlines/braces from the value stops a `user-select` mentioned in a comment from swallowing the following declarations.
|
||||||
|
const prefixed = content.replace(/(?<![\w$-])user-select\s*:\s*([^;{}\r\n]+);/g, "-webkit-user-select: $1; user-select: $1;");
|
||||||
|
return `<style${attrs}>${prefixed}</style>`;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function staticAssets(): PluginOption {
|
function staticAssets(): PluginOption {
|
||||||
const STATIC_ASSET_DIRS: { source: string; urlPrefix: string }[] = [
|
const STATIC_ASSET_DIRS: { source: string; urlPrefix: string }[] = [
|
||||||
{ source: "../demo-artwork", urlPrefix: "/demo-artwork" },
|
{ source: "../demo-artwork", urlPrefix: "/demo-artwork" },
|
||||||
|
|||||||
@@ -33,29 +33,12 @@ wasm-bindgen = { workspace = true }
|
|||||||
serde-wasm-bindgen = { workspace = true }
|
serde-wasm-bindgen = { workspace = true }
|
||||||
js-sys = { workspace = true }
|
js-sys = { workspace = true }
|
||||||
wasm-bindgen-futures = { workspace = true }
|
wasm-bindgen-futures = { workspace = true }
|
||||||
math-parser = { workspace = true }
|
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
web-sys = { workspace = true }
|
web-sys = { workspace = true }
|
||||||
ron = { workspace = true }
|
ron = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
node-macro = { workspace = true }
|
node-macro = { workspace = true }
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.dev]
|
|
||||||
wasm-opt = false
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
|
|
||||||
debug-js-glue = true
|
|
||||||
demangle-name-section = true
|
|
||||||
dwarf-debug-info = false
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release]
|
|
||||||
wasm-opt = ["-Os", "-g"]
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release.wasm-bindgen]
|
|
||||||
debug-js-glue = false
|
|
||||||
demangle-name-section = false
|
|
||||||
dwarf-debug-info = false
|
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
unexpected_cfgs = { level = "warn", check-cfg = [
|
unexpected_cfgs = { level = "warn", check-cfg = [
|
||||||
'cfg(wasm_bindgen_unstable_test_coverage)',
|
'cfg(wasm_bindgen_unstable_test_coverage)',
|
||||||
|
|||||||
@@ -756,6 +756,15 @@ impl EditorWrapper {
|
|||||||
self.dispatch(message);
|
self.dispatch(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reorder a draggable Properties panel section to the given index among its peers.
|
||||||
|
#[wasm_bindgen(js_name = reorderPropertiesSection)]
|
||||||
|
pub fn reorder_properties_section(&self, node_id: u64, insert_index: usize) {
|
||||||
|
self.dispatch(DocumentMessage::ReorderPropertiesSection {
|
||||||
|
node_id: NodeId(node_id),
|
||||||
|
insert_index,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Duplicate the selected layers, placing the copies within the given folder at the given index.
|
/// Duplicate the selected layers, placing the copies within the given folder at the given index.
|
||||||
/// If the folder is `None`, they are inserted into the document root.
|
/// If the folder is `None`, they are inserted into the document root.
|
||||||
/// If the insert index is `None`, they are inserted at the start of the folder.
|
/// If the insert index is `None`, they are inserted at the start of the folder.
|
||||||
@@ -877,7 +886,7 @@ impl EditorWrapper {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let message = PortfolioMessage::PasteImage {
|
let message = PortfolioMessage::InsertImage {
|
||||||
name,
|
name,
|
||||||
image,
|
image,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -899,7 +908,7 @@ impl EditorWrapper {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let message = PortfolioMessage::PasteSvg {
|
let message = PortfolioMessage::InsertSvg {
|
||||||
name,
|
name,
|
||||||
svg,
|
svg,
|
||||||
mouse,
|
mouse,
|
||||||
@@ -922,6 +931,12 @@ impl EditorWrapper {
|
|||||||
self.dispatch(DocumentMessage::SetNodePinned { node_id: NodeId(id), pinned });
|
self.dispatch(DocumentMessage::SetNodePinned { node_id: NodeId(id), pinned });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Collapse or expand a node's section in the Properties panel
|
||||||
|
#[wasm_bindgen(js_name = toggleNodePropertiesSectionExpanded)]
|
||||||
|
pub fn toggle_node_properties_section_expanded(&self, id: u64) {
|
||||||
|
self.dispatch(DocumentMessage::ToggleNodePropertiesSectionExpanded { node_id: NodeId(id) });
|
||||||
|
}
|
||||||
|
|
||||||
/// Delete a layer or node given its node ID
|
/// Delete a layer or node given its node ID
|
||||||
#[wasm_bindgen(js_name = deleteNode)]
|
#[wasm_bindgen(js_name = deleteNode)]
|
||||||
pub fn delete_node(&self, id: u64) {
|
pub fn delete_node(&self, id: u64) {
|
||||||
@@ -979,22 +994,3 @@ impl EditorWrapper {
|
|||||||
self.dispatch(message);
|
self.dispatch(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
|
||||||
// Static functions callable from JavaScript without an Editor instance
|
|
||||||
// ====================================================================
|
|
||||||
|
|
||||||
#[wasm_bindgen(js_name = evaluateMathExpression)]
|
|
||||||
pub fn evaluate_math_expression(expression: &str) -> Option<f64> {
|
|
||||||
let value = math_parser::evaluate(expression)
|
|
||||||
.inspect_err(|err| error!("Math parser error on \"{expression}\": {err}"))
|
|
||||||
.ok()?
|
|
||||||
.0
|
|
||||||
.inspect_err(|err| error!("Math evaluate error on \"{expression}\": {err} "))
|
|
||||||
.ok()?;
|
|
||||||
let Some(real) = value.as_real() else {
|
|
||||||
error!("{value} was not a real; skipping.");
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
Some(real)
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@ fn_call = { ident ~ "(" ~ expr ~ ("," ~ expr)* ~ ")" }
|
|||||||
ident = @{ (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* }
|
ident = @{ (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* }
|
||||||
lit = { unit | ((float | int) ~ unit?) }
|
lit = { unit | ((float | int) ~ unit?) }
|
||||||
|
|
||||||
float = @{ int ~ "." ~ int? ~ exp? | int ~ exp }
|
float = @{ (int ~ "." ~ int? ~ exp? | "." ~ int ~ exp? | int ~ exp) ~ !("." | ASCII_DIGIT) }
|
||||||
exp = _{ ^"e" ~ ("+" | "-")? ~ int }
|
exp = _{ ^"e" ~ ("+" | "-")? ~ int }
|
||||||
int = @{ ASCII_DIGIT+ }
|
int = @{ ASCII_DIGIT+ }
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ mod tests {
|
|||||||
|
|
||||||
const EPSILON: f64 = 1e-10_f64;
|
const EPSILON: f64 = 1e-10_f64;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn malformed_juxtaposed_numbers_fail_to_parse() {
|
||||||
|
// Two numbers cannot be glued together by a stray decimal point (they must not parse as implicit multiplication).
|
||||||
|
for input in ["1..5", "1.5.5", "1..", ".5.5"] {
|
||||||
|
assert!(evaluate(input).is_err(), "expected `{input}` to be a parse error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! test_end_to_end{
|
macro_rules! test_end_to_end{
|
||||||
($($name:ident: $input:expr_2021 => ($expected_value:expr_2021, $expected_unit:expr_2021)),* $(,)?) => {
|
($($name:ident: $input:expr_2021 => ($expected_value:expr_2021, $expected_unit:expr_2021)),* $(,)?) => {
|
||||||
$(
|
$(
|
||||||
@@ -139,6 +147,11 @@ mod tests {
|
|||||||
exponent_tau: "2^tau" => (2f64.powf(2. * std::f64::consts::PI), Unit::BASE_UNIT),
|
exponent_tau: "2^tau" => (2f64.powf(2. * std::f64::consts::PI), Unit::BASE_UNIT),
|
||||||
infinity_subtract_large_number: "inf - 1000" => (f64::INFINITY, Unit::BASE_UNIT),
|
infinity_subtract_large_number: "inf - 1000" => (f64::INFINITY, Unit::BASE_UNIT),
|
||||||
|
|
||||||
|
// Decimals with no leading digit before the point
|
||||||
|
leading_dot_decimal: ".5" => (0.5, Unit::BASE_UNIT),
|
||||||
|
leading_dot_in_expression: "1+.5" => (1.5, Unit::BASE_UNIT),
|
||||||
|
leading_dot_exponent: ".5e3" => (500., Unit::BASE_UNIT),
|
||||||
|
|
||||||
// Trigonometric functions
|
// Trigonometric functions
|
||||||
trig_sin_pi: "sin(pi)" => (0., Unit::BASE_UNIT),
|
trig_sin_pi: "sin(pi)" => (0., Unit::BASE_UNIT),
|
||||||
trig_cos_zero: "cos(0)" => (1., Unit::BASE_UNIT),
|
trig_cos_zero: "cos(0)" => (1., Unit::BASE_UNIT),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ pub use core_types::{ProtoNodeIdentifier, Type, TypeDescriptor, concrete, descri
|
|||||||
|
|
||||||
pub mod application_io;
|
pub mod application_io;
|
||||||
pub mod document;
|
pub mod document;
|
||||||
|
pub use document::{DocumentNode, NodeNetwork};
|
||||||
pub mod graphene_compiler;
|
pub mod graphene_compiler;
|
||||||
pub mod proto;
|
pub mod proto;
|
||||||
#[cfg(feature = "loading")]
|
#[cfg(feature = "loading")]
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ graphene-std = { workspace = true }
|
|||||||
interpreted-executor = { workspace = true }
|
interpreted-executor = { workspace = true }
|
||||||
graph-craft = { workspace = true, features = ["loading"] }
|
graph-craft = { workspace = true, features = ["loading"] }
|
||||||
preprocessor = { workspace = true }
|
preprocessor = { workspace = true }
|
||||||
|
document-format = { workspace = true, features = ["zip", "xz"] }
|
||||||
|
document-container = { workspace = true, features = ["zip", "xz"] }
|
||||||
|
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
mod export;
|
mod export;
|
||||||
|
|
||||||
use clap::{Args, Parser, Subcommand};
|
use clap::{Args, Parser, Subcommand};
|
||||||
|
use document_container::AnyContainer;
|
||||||
|
use document_container::backends::memory::MemoryBackend;
|
||||||
|
use document_format::{GddV1, GddV1Layout};
|
||||||
use fern::colors::{Color, ColoredLevelConfig};
|
use fern::colors::{Color, ColoredLevelConfig};
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use graph_craft::application_io::EditorPreferences;
|
use graph_craft::application_io::EditorPreferences;
|
||||||
@@ -84,6 +87,11 @@ enum Command {
|
|||||||
duration: Option<f64>,
|
duration: Option<f64>,
|
||||||
},
|
},
|
||||||
ListNodeIdentifiers,
|
ListNodeIdentifiers,
|
||||||
|
|
||||||
|
/// Extract embedded legacy .graphite file from the new .gdd file
|
||||||
|
ExtractLegacyDoc {
|
||||||
|
document: PathBuf,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Args)]
|
#[derive(Debug, Args)]
|
||||||
@@ -104,6 +112,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
let document_path = match app.command {
|
let document_path = match app.command {
|
||||||
Command::Compile { ref document, .. } => document,
|
Command::Compile { ref document, .. } => document,
|
||||||
Command::Export { ref document, .. } => document,
|
Command::Export { ref document, .. } => document,
|
||||||
|
Command::ExtractLegacyDoc { ref document } => document,
|
||||||
Command::ListNodeIdentifiers => {
|
Command::ListNodeIdentifiers => {
|
||||||
let mut nodes: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect();
|
let mut nodes: Vec<_> = graphene_std::registry::NODE_METADATA.lock().unwrap().keys().cloned().collect();
|
||||||
nodes.sort_by_key(|x| x.as_str().to_string());
|
nodes.sort_by_key(|x| x.as_str().to_string());
|
||||||
@@ -114,10 +123,51 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let document_string = std::fs::read_to_string(document_path).expect("Failed to read document");
|
// Load the document by extension: `.gdd` opens the new archive format, anything else is treated as a
|
||||||
|
// legacy `.graphite` document. The legacy path has no `Gdd`, so resources fall back to the default registry.
|
||||||
|
let is_gdd = document_path.extension().is_some_and(|extension| extension.eq_ignore_ascii_case("gdd"));
|
||||||
|
|
||||||
|
let gdd = if is_gdd {
|
||||||
|
let archive = std::fs::read(document_path).map_err(|error| format!("Failed to read document {}: {error}", document_path.display()))?;
|
||||||
|
let container = AnyContainer::Memory(MemoryBackend::new());
|
||||||
|
let gdd = document_format::Gdd::open_from_archive(archive.as_ref(), container, GddV1Layout)
|
||||||
|
.await
|
||||||
|
.map_err(|error| format!("Failed to open document: {error}"))?;
|
||||||
|
Some(gdd)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Command::ExtractLegacyDoc { ref document } = app.command {
|
||||||
|
let Some(gdd) = &gdd else { return Err("ExtractLegacyDoc requires a .gdd document".into()) };
|
||||||
|
let Some(legacy_doc) = gdd.read_legacy_document().await else {
|
||||||
|
return Err("gdd file did not contain a legacy .graphite document".into());
|
||||||
|
};
|
||||||
|
let mut new_path = document.clone();
|
||||||
|
new_path.set_extension("graphite");
|
||||||
|
std::fs::write(&new_path, legacy_doc).map_err(|error| format!("Failed to write .graphite file: {error}"))?;
|
||||||
|
eprintln!("Saved file to {}", new_path.to_string_lossy());
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the runtime network: from the `.gdd` registry, or by loading a legacy `.graphite` document.
|
||||||
|
let node_network = match &gdd {
|
||||||
|
Some(gdd) => {
|
||||||
|
let declarations = gdd.declarations(gdd).await;
|
||||||
|
let (node_network, _metadata) = gdd.registry().to_runtime_with_metadata(&declarations)?;
|
||||||
|
node_network
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
let document_string = std::fs::read_to_string(document_path).map_err(|error| format!("Failed to read document {}: {error}", document_path.display()))?;
|
||||||
|
load_network(&document_string)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
log::info!("Creating GPU context");
|
log::info!("Creating GPU context");
|
||||||
let application_io = block_on(PlatformApplicationIo::new());
|
let mut application_io = PlatformApplicationIo::new().await;
|
||||||
|
if let Some(gdd) = &gdd {
|
||||||
|
application_io.inject_resource_proxy(Box::new(gdd.resource_proxy()));
|
||||||
|
}
|
||||||
|
|
||||||
// Convert application_io to Arc first
|
// Convert application_io to Arc first
|
||||||
let application_io_arc = Arc::new(application_io);
|
let application_io_arc = Arc::new(application_io);
|
||||||
@@ -137,8 +187,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
node_graph_message_sender: Box::new(UpdateLogger {}),
|
node_graph_message_sender: Box::new(UpdateLogger {}),
|
||||||
editor_preferences: Box::new(preferences),
|
editor_preferences: Box::new(preferences),
|
||||||
});
|
});
|
||||||
|
let proto_graph = compile_graph(node_network, editor_api, gdd.as_ref())?;
|
||||||
let proto_graph = compile_graph(document_string, editor_api)?;
|
|
||||||
|
|
||||||
match app.command {
|
match app.command {
|
||||||
Command::Compile { print_proto, .. } => {
|
Command::Compile { print_proto, .. } => {
|
||||||
@@ -218,37 +267,22 @@ fn init_logging(log_level: u8) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrations are done in the editor which is unfortunately not available here.
|
fn compile_graph(network: NodeNetwork, editor_api: Arc<PlatformEditorApi>, gdd: Option<&GddV1>) -> Result<ProtoNetwork, Box<dyn Error>> {
|
||||||
// TODO: remove this and share migrations between the editor and the CLI.
|
|
||||||
fn fix_nodes(network: &mut NodeNetwork) {
|
|
||||||
for node in network.nodes.values_mut() {
|
|
||||||
match &mut node.implementation {
|
|
||||||
// Recursively fix
|
|
||||||
DocumentNodeImplementation::Network(network) => fix_nodes(network),
|
|
||||||
// This replicates the migration from the editor linked:
|
|
||||||
// https://github.com/GraphiteEditor/Graphite/blob/d68f91ccca69e90e6d2df78d544d36cd1aaf348e/editor/src/messages/portfolio/portfolio_message_handler.rs#L535
|
|
||||||
// Since the CLI doesn't have the document node definitions, a less robust method of just patching the inputs is used.
|
|
||||||
DocumentNodeImplementation::ProtoNode(proto_node_identifier)
|
|
||||||
if (proto_node_identifier.as_str().starts_with("graphene_core::ConstructLayerNode") || proto_node_identifier.as_str().starts_with("graphene_core::AddArtboardNode"))
|
|
||||||
&& node.inputs.len() < 3 =>
|
|
||||||
{
|
|
||||||
node.inputs.push(NodeInput::Reflection(DocumentNodeMetadata::DocumentNodePath));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn compile_graph(document_string: String, editor_api: Arc<PlatformEditorApi>) -> Result<ProtoNetwork, Box<dyn Error>> {
|
|
||||||
let mut network = load_network(&document_string);
|
|
||||||
fix_nodes(&mut network);
|
|
||||||
|
|
||||||
let mut wrapped_network = wrap_network_in_scope(network, editor_api);
|
|
||||||
|
|
||||||
let preprocessor = preprocessor::Preprocessor::new();
|
let preprocessor = preprocessor::Preprocessor::new();
|
||||||
preprocessor.preprocess(&mut wrapped_network, &ResourceRegistry::default()).expect("Failed to expand network"); // TODO: actually load the resources from the document
|
|
||||||
|
let mut network = wrap_network_in_scope(network, editor_api);
|
||||||
|
|
||||||
|
// A `.gdd` resolves resource hashes from its registry; a legacy `.graphite` has no resource store, so it
|
||||||
|
// preprocesses against an empty registry (matching the pre-`.gdd` CLI behavior).
|
||||||
|
match gdd {
|
||||||
|
Some(gdd) => preprocessor
|
||||||
|
.preprocess(&mut network, &|resource_id| gdd.registry().resources.get(&resource_id).and_then(|r| r.hash))
|
||||||
|
.expect("Failed to expand network"),
|
||||||
|
None => { preprocessor.preprocess(&mut network, &|_| None) }.expect("Failed to expand network"),
|
||||||
|
}
|
||||||
|
|
||||||
let compiler = Compiler {};
|
let compiler = Compiler {};
|
||||||
compiler.compile_single(wrapped_network).map_err(|x| x.into())
|
compiler.compile_single(network).map_err(|x| x.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_executor(proto_network: ProtoNetwork) -> Result<DynamicExecutor, Box<dyn Error>> {
|
fn create_executor(proto_network: ProtoNetwork) -> Result<DynamicExecutor, Box<dyn Error>> {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ use futures::executor::block_on;
|
|||||||
use graph_craft::proto::ProtoNetwork;
|
use graph_craft::proto::ProtoNetwork;
|
||||||
use graph_craft::util::{DEMO_ART, compile, load_from_name};
|
use graph_craft::util::{DEMO_ART, compile, load_from_name};
|
||||||
use graphene_std::application_io::EditorApi;
|
use graphene_std::application_io::EditorApi;
|
||||||
use graphene_std::application_io::resource::ResourceRegistry;
|
|
||||||
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||||
use interpreted_executor::util::wrap_network_in_scope;
|
use interpreted_executor::util::wrap_network_in_scope;
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ pub fn setup_network(name: &str) -> (DynamicExecutor, ProtoNetwork) {
|
|||||||
let editor_api = std::sync::Arc::new(EditorApi::default());
|
let editor_api = std::sync::Arc::new(EditorApi::default());
|
||||||
let mut network = wrap_network_in_scope(network, editor_api);
|
let mut network = wrap_network_in_scope(network, editor_api);
|
||||||
let preprocessor = preprocessor::Preprocessor::new();
|
let preprocessor = preprocessor::Preprocessor::new();
|
||||||
preprocessor.preprocess(&mut network, &ResourceRegistry::default()).unwrap();
|
preprocessor.preprocess(&mut network, &|_| None).unwrap();
|
||||||
let proto_network = compile(network);
|
let proto_network = compile(network);
|
||||||
let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap();
|
let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap();
|
||||||
(executor, proto_network)
|
(executor, proto_network)
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub use graphene_hash;
|
|||||||
pub use graphene_hash::CacheHash;
|
pub use graphene_hash::CacheHash;
|
||||||
pub use list::{
|
pub use list::{
|
||||||
ATTR_BACKGROUND, ATTR_BLEND_MODE, ATTR_CLIP, ATTR_CLIPPING_MASK, ATTR_DIMENSIONS, ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_LAYER_PATH, ATTR_EDITOR_MERGED_LAYERS, ATTR_EDITOR_TEXT_FRAME, ATTR_END,
|
ATTR_BACKGROUND, ATTR_BLEND_MODE, ATTR_CLIP, ATTR_CLIPPING_MASK, ATTR_DIMENSIONS, ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_LAYER_PATH, ATTR_EDITOR_MERGED_LAYERS, ATTR_EDITOR_TEXT_FRAME, ATTR_END,
|
||||||
ATTR_FONT, ATTR_FONT_SIZE, ATTR_GRADIENT_LEGACY, ATTR_GRADIENT_TYPE, ATTR_LETTER_SPACING, ATTR_LETTER_TILT, ATTR_LINE_HEIGHT, ATTR_LOCATION, ATTR_MAX_HEIGHT, ATTR_MAX_WIDTH, ATTR_NAME,
|
ATTR_FONT, ATTR_FONT_SIZE, ATTR_GRADIENT_TYPE, ATTR_LETTER_SPACING, ATTR_LETTER_TILT, ATTR_LINE_HEIGHT, ATTR_LOCATION, ATTR_MAX_HEIGHT, ATTR_MAX_WIDTH, ATTR_NAME, ATTR_OPACITY, ATTR_OPACITY_FILL,
|
||||||
ATTR_OPACITY, ATTR_OPACITY_FILL, ATTR_SPREAD_METHOD, ATTR_START, ATTR_TEXT_ALIGN, ATTR_TRANSFORM, ATTR_TYPE,
|
ATTR_SPREAD_METHOD, ATTR_START, ATTR_TEXT_ALIGN, ATTR_TRANSFORM, ATTR_TYPE,
|
||||||
};
|
};
|
||||||
pub use memo::MemoHash;
|
pub use memo::MemoHash;
|
||||||
pub use no_std_types::AsU32;
|
pub use no_std_types::AsU32;
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ pub const ATTR_CLIP: &str = "clip";
|
|||||||
pub const ATTR_SPREAD_METHOD: &str = "spread_method";
|
pub const ATTR_SPREAD_METHOD: &str = "spread_method";
|
||||||
/// Gradient's `GradientType` (`Linear` or `Radial`).
|
/// Gradient's `GradientType` (`Linear` or `Radial`).
|
||||||
pub const ATTR_GRADIENT_TYPE: &str = "gradient_type";
|
pub const ATTR_GRADIENT_TYPE: &str = "gradient_type";
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
/// `bool` runtime marker (never serialized) flagging a gradient that came from the legacy bounding-box-relative `Fill::Gradient`,
|
|
||||||
/// so the renderer reproduces the pre-#4241 positioning instead of the new absolute path.
|
|
||||||
pub const ATTR_GRADIENT_LEGACY: &str = "gradient_legacy";
|
|
||||||
/// Vector graphics object's filled area paint, of type List<T> where T is any graphic type.
|
/// Vector graphics object's filled area paint, of type List<T> where T is any graphic type.
|
||||||
pub const ATTR_FILL: &str = "fill";
|
pub const ATTR_FILL: &str = "fill";
|
||||||
/// Vector graphics object's stroke paint, of type List<T> where T is any graphic type.
|
/// Vector graphics object's stroke paint, of type List<T> where T is any graphic type.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use core_types::list::{ATTR_FILL, ATTR_STROKE, Item, List};
|
|||||||
use core_types::ops::{FromAnchorPosition, ListConvert};
|
use core_types::ops::{FromAnchorPosition, ListConvert};
|
||||||
use core_types::render_complexity::RenderComplexity;
|
use core_types::render_complexity::RenderComplexity;
|
||||||
use core_types::uuid::NodeId;
|
use core_types::uuid::NodeId;
|
||||||
use core_types::{ATTR_CLIPPING_MASK, ATTR_EDITOR_LAYER_PATH, ATTR_GRADIENT_LEGACY, ATTR_GRADIENT_TYPE, ATTR_OPACITY, ATTR_OPACITY_FILL, ATTR_SPREAD_METHOD, ATTR_TRANSFORM, Color};
|
use core_types::{ATTR_CLIPPING_MASK, ATTR_EDITOR_LAYER_PATH, ATTR_GRADIENT_TYPE, ATTR_OPACITY, ATTR_OPACITY_FILL, ATTR_SPREAD_METHOD, ATTR_TRANSFORM, Color};
|
||||||
use dyn_any::DynAny;
|
use dyn_any::DynAny;
|
||||||
use glam::{DAffine2, DVec2};
|
use glam::{DAffine2, DVec2};
|
||||||
use raster_types::{CPU, GPU, Raster};
|
use raster_types::{CPU, GPU, Raster};
|
||||||
@@ -193,26 +193,15 @@ fn flatten_graphic_list<T>(content: List<Graphic>, extract_variant: fn(Graphic)
|
|||||||
|
|
||||||
/// Converts a `Fill` enum into the `List<Graphic>` representation used as paint storage.
|
/// Converts a `Fill` enum into the `List<Graphic>` representation used as paint storage.
|
||||||
/// TODO: Remove once all fill paint sources flow through `List<Graphic>` directly without going through the `Fill` enum.
|
/// TODO: Remove once all fill paint sources flow through `List<Graphic>` directly without going through the `Fill` enum.
|
||||||
pub fn fill_to_graphic_list(fill: &Fill, bounding_box_transform: DAffine2) -> Option<List<Graphic>> {
|
pub fn fill_to_graphic_list(fill: &Fill) -> Option<List<Graphic>> {
|
||||||
match fill {
|
match fill {
|
||||||
Fill::None => None,
|
Fill::None => None,
|
||||||
Fill::Solid(color) => Some(List::new_from_element((*color).into())),
|
Fill::Solid(color) => Some(List::new_from_element((*color).into())),
|
||||||
Fill::Gradient(gradient) => {
|
Fill::Gradient(gradient) => {
|
||||||
let gradient_transform = gradient.transform * gradient.to_transform();
|
|
||||||
|
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
// Absolute gradients carry their effective frame into the new pipeline; legacy bounding-box gradients bake the bbox
|
|
||||||
// in and flag the legacy render path until the deferred migration converts them.
|
|
||||||
let (transform, legacy) = if gradient.absolute {
|
|
||||||
(gradient_transform, false)
|
|
||||||
} else {
|
|
||||||
(bounding_box_transform * gradient_transform, true)
|
|
||||||
};
|
|
||||||
let gradient_item = Item::new_from_element(gradient.stops.clone())
|
let gradient_item = Item::new_from_element(gradient.stops.clone())
|
||||||
.with_attribute(ATTR_TRANSFORM, transform)
|
.with_attribute(ATTR_TRANSFORM, gradient.transform * gradient.to_transform())
|
||||||
.with_attribute(ATTR_GRADIENT_TYPE, gradient.gradient_type)
|
.with_attribute(ATTR_GRADIENT_TYPE, gradient.gradient_type)
|
||||||
.with_attribute(ATTR_SPREAD_METHOD, gradient.spread_method)
|
.with_attribute(ATTR_SPREAD_METHOD, gradient.spread_method);
|
||||||
.with_attribute(ATTR_GRADIENT_LEGACY, legacy);
|
|
||||||
let gradient_list = List::new_from_item(gradient_item);
|
let gradient_list = List::new_from_item(gradient_item);
|
||||||
|
|
||||||
Some(List::new_from_element(Graphic::Gradient(gradient_list)))
|
Some(List::new_from_element(Graphic::Gradient(gradient_list)))
|
||||||
@@ -257,9 +246,7 @@ pub fn has_paint_at(list: &List<Vector>, index: usize, attribute: &str) -> bool
|
|||||||
pub fn fill_graphic_list_at(list: &List<Vector>, index: usize) -> Option<Cow<'_, List<Graphic>>> {
|
pub fn fill_graphic_list_at(list: &List<Vector>, index: usize) -> Option<Cow<'_, List<Graphic>>> {
|
||||||
graphic_list_at(list, index, ATTR_FILL).or_else(|| {
|
graphic_list_at(list, index, ATTR_FILL).or_else(|| {
|
||||||
let vector = list.element(index)?;
|
let vector = list.element(index)?;
|
||||||
let bounds = vector.nonzero_bounding_box();
|
fill_to_graphic_list(vector.style.fill()).map(Cow::Owned)
|
||||||
let bounding_box_transform = DAffine2::from_scale_angle_translation(bounds[1] - bounds[0], 0., bounds[0]);
|
|
||||||
fill_to_graphic_list(vector.style.fill(), bounding_box_transform).map(Cow::Owned)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,8 +190,7 @@ where
|
|||||||
let mut last_b_srgb = 0u8;
|
let mut last_b_srgb = 0u8;
|
||||||
|
|
||||||
let mut result = vec![0; data.len() * 4];
|
let mut result = vec![0; data.len() * 4];
|
||||||
let mut i = 0;
|
for (color, out) in data.iter().zip(result.chunks_exact_mut(4)) {
|
||||||
for color in data {
|
|
||||||
let a = color.a().to_f32();
|
let a = color.a().to_f32();
|
||||||
// Smaller alpha values than this would map to fully transparent
|
// Smaller alpha values than this would map to fully transparent
|
||||||
// anyway, avoid expensive encoding.
|
// anyway, avoid expensive encoding.
|
||||||
@@ -215,13 +214,11 @@ where
|
|||||||
last_b_srgb = float_to_srgb_u8(b);
|
last_b_srgb = float_to_srgb_u8(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
result[i] = last_r_srgb;
|
out[0] = last_r_srgb;
|
||||||
result[i + 1] = last_g_srgb;
|
out[1] = last_g_srgb;
|
||||||
result[i + 2] = last_b_srgb;
|
out[2] = last_b_srgb;
|
||||||
result[i + 3] = (a * 255. + 0.5) as u8;
|
out[3] = (a * 255. + 0.5) as u8;
|
||||||
}
|
}
|
||||||
|
|
||||||
i += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(result, *width, *height)
|
(result, *width, *height)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use core_types::transform::Footprint;
|
|||||||
use core_types::uuid::{NodeId, generate_uuid};
|
use core_types::uuid::{NodeId, generate_uuid};
|
||||||
use core_types::{
|
use core_types::{
|
||||||
ATTR_BACKGROUND, ATTR_BLEND_MODE, ATTR_CLIP, ATTR_CLIPPING_MASK, ATTR_DIMENSIONS, ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_LAYER_PATH, ATTR_EDITOR_MERGED_LAYERS, ATTR_EDITOR_TEXT_FRAME, ATTR_FONT,
|
ATTR_BACKGROUND, ATTR_BLEND_MODE, ATTR_CLIP, ATTR_CLIPPING_MASK, ATTR_DIMENSIONS, ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_LAYER_PATH, ATTR_EDITOR_MERGED_LAYERS, ATTR_EDITOR_TEXT_FRAME, ATTR_FONT,
|
||||||
ATTR_FONT_SIZE, ATTR_GRADIENT_LEGACY, ATTR_GRADIENT_TYPE, ATTR_LETTER_SPACING, ATTR_LETTER_TILT, ATTR_LINE_HEIGHT, ATTR_LOCATION, ATTR_MAX_HEIGHT, ATTR_MAX_WIDTH, ATTR_OPACITY, ATTR_OPACITY_FILL,
|
ATTR_FONT_SIZE, ATTR_GRADIENT_TYPE, ATTR_LETTER_SPACING, ATTR_LETTER_TILT, ATTR_LINE_HEIGHT, ATTR_LOCATION, ATTR_MAX_HEIGHT, ATTR_MAX_WIDTH, ATTR_OPACITY, ATTR_OPACITY_FILL, ATTR_SPREAD_METHOD,
|
||||||
ATTR_SPREAD_METHOD, ATTR_TEXT_ALIGN, ATTR_TRANSFORM,
|
ATTR_TEXT_ALIGN, ATTR_TRANSFORM,
|
||||||
};
|
};
|
||||||
use dyn_any::DynAny;
|
use dyn_any::DynAny;
|
||||||
use glam::{DAffine2, DMat2, DVec2};
|
use glam::{DAffine2, DMat2, DVec2};
|
||||||
@@ -396,14 +396,12 @@ pub(crate) fn gradient_placement(transform: DAffine2, gradient_type: GradientTyp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_peniko_gradient_brush(gradient_list: &List<GradientStops>, parent_transform: &DAffine2, multiplied_transform: &DAffine2) -> Option<(peniko::Brush, DAffine2)> {
|
fn create_peniko_gradient_brush(gradient_list: &List<GradientStops>, multiplied_transform: &DAffine2) -> Option<(peniko::Brush, DAffine2)> {
|
||||||
let stops = gradient_list.element(0)?;
|
let stops = gradient_list.element(0)?;
|
||||||
|
|
||||||
let gradient_type: GradientType = gradient_list.attribute_cloned_or_default(ATTR_GRADIENT_TYPE, 0);
|
let gradient_type: GradientType = gradient_list.attribute_cloned_or_default(ATTR_GRADIENT_TYPE, 0);
|
||||||
let gradient_transform: DAffine2 = gradient_list.attribute_cloned_or_default(ATTR_TRANSFORM, 0);
|
let gradient_transform: DAffine2 = gradient_list.attribute_cloned_or_default(ATTR_TRANSFORM, 0);
|
||||||
let spread_method: GradientSpreadMethod = gradient_list.attribute_cloned_or_default(ATTR_SPREAD_METHOD, 0);
|
let spread_method: GradientSpreadMethod = gradient_list.attribute_cloned_or_default(ATTR_SPREAD_METHOD, 0);
|
||||||
// TODO: Eventually remove this document upgrade code
|
|
||||||
let legacy_bounding_box: bool = gradient_list.attribute_cloned_or_default(ATTR_GRADIENT_LEGACY, 0);
|
|
||||||
|
|
||||||
let mut peniko_stops = peniko::ColorStops::new();
|
let mut peniko_stops = peniko::ColorStops::new();
|
||||||
for (position, color, _) in stops.interpolated_samples() {
|
for (position, color, _) in stops.interpolated_samples() {
|
||||||
@@ -413,20 +411,8 @@ fn create_peniko_gradient_brush(gradient_list: &List<GradientStops>, parent_tran
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Eventually remove this document upgrade code
|
// The unit gradient is placed by the desheared frame so a non-uniform transform produces the intended ellipse
|
||||||
// Legacy bounding-box gradients reproduce the pre-#4241 renderer: literal endpoints in the layer's own space, with the
|
let (start, end, gradient_to_device) = (DVec2::ZERO, DVec2::X, gradient_placement(multiplied_transform * gradient_transform, gradient_type));
|
||||||
// parent transform applied as the brush so its shear bends the bands. New gradients use the unit gradient placed by the desheared frame.
|
|
||||||
let (start, end, gradient_to_device) = if legacy_bounding_box {
|
|
||||||
let inverse_parent_transform = if transform_is_invertible(*parent_transform) {
|
|
||||||
parent_transform.inverse()
|
|
||||||
} else {
|
|
||||||
Default::default()
|
|
||||||
};
|
|
||||||
let mod_points = inverse_parent_transform * *multiplied_transform * gradient_transform;
|
|
||||||
(mod_points.transform_point2(DVec2::ZERO), mod_points.transform_point2(DVec2::X), *parent_transform)
|
|
||||||
} else {
|
|
||||||
(DVec2::ZERO, DVec2::X, gradient_placement(multiplied_transform * gradient_transform, gradient_type))
|
|
||||||
};
|
|
||||||
|
|
||||||
let brush = peniko::Brush::Gradient(peniko::Gradient {
|
let brush = peniko::Brush::Gradient(peniko::Gradient {
|
||||||
kind: match gradient_type {
|
kind: match gradient_type {
|
||||||
@@ -1372,7 +1358,7 @@ impl Render for List<Vector> {
|
|||||||
scene.fill(fill_rule, kurbo::Affine::new(element_transform.to_cols_array()), &fill, None, path);
|
scene.fill(fill_rule, kurbo::Affine::new(element_transform.to_cols_array()), &fill, None, path);
|
||||||
}
|
}
|
||||||
Graphic::Gradient(list) => {
|
Graphic::Gradient(list) => {
|
||||||
let Some((brush, gradient_to_device)) = create_peniko_gradient_brush(list, &parent_transform, &multiplied_transform) else {
|
let Some((brush, gradient_to_device)) = create_peniko_gradient_brush(list, &multiplied_transform) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1454,7 +1440,7 @@ impl Render for List<Vector> {
|
|||||||
scene.stroke(&stroke, kurbo::Affine::new(element_transform.to_cols_array()), &brush, None, &path);
|
scene.stroke(&stroke, kurbo::Affine::new(element_transform.to_cols_array()), &brush, None, &path);
|
||||||
}
|
}
|
||||||
Graphic::Gradient(list) => {
|
Graphic::Gradient(list) => {
|
||||||
let Some((brush, gradient_to_device)) = create_peniko_gradient_brush(list, &parent_transform, &multiplied_transform) else {
|
let Some((brush, gradient_to_device)) = create_peniko_gradient_brush(list, &multiplied_transform) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let inverse_element_transform = if transform_is_invertible(element_transform) {
|
let inverse_element_transform = if transform_is_invertible(element_transform) {
|
||||||
@@ -2216,7 +2202,7 @@ impl Render for List<GradientStops> {
|
|||||||
interpolation_alpha_space: peniko::InterpolationAlphaSpace::Premultiplied,
|
interpolation_alpha_space: peniko::InterpolationAlphaSpace::Premultiplied,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let brush_transform = kurbo::Affine::new((gradient_transform).to_cols_array());
|
let brush_transform = kurbo::Affine::new(gradient_placement(gradient_transform, gradient_type).to_cols_array());
|
||||||
let rect = kurbo::Rect::from_origin_size(kurbo::Point::ZERO, kurbo::Size::new(1., 1.));
|
let rect = kurbo::Rect::from_origin_size(kurbo::Point::ZERO, kurbo::Size::new(1., 1.));
|
||||||
|
|
||||||
let mut layer = false;
|
let mut layer = false;
|
||||||
|
|||||||
@@ -274,6 +274,18 @@ impl GradientStops {
|
|||||||
index
|
index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Insert a copy of the stop at `source_index` (same color and midpoint) at `position`, keeping the stops sorted by position.
|
||||||
|
/// Returns the index where the copy was inserted, or `None` if `source_index` is out of range.
|
||||||
|
pub fn duplicate_stop(&mut self, source_index: usize, position: f64) -> Option<usize> {
|
||||||
|
let color = *self.color.get(source_index)?;
|
||||||
|
let midpoint = *self.midpoint.get(source_index)?;
|
||||||
|
let index = self.position.iter().position(|p| *p > position).unwrap_or(self.position.len());
|
||||||
|
self.position.insert(index, position);
|
||||||
|
self.midpoint.insert(index, midpoint);
|
||||||
|
self.color.insert(index, color);
|
||||||
|
Some(index)
|
||||||
|
}
|
||||||
|
|
||||||
/// Reset the midpoint for the interval starting at `index` to its default `0.5`.
|
/// Reset the midpoint for the interval starting at `index` to its default `0.5`.
|
||||||
pub fn reset_midpoint(&mut self, index: usize) {
|
pub fn reset_midpoint(&mut self, index: usize) {
|
||||||
if let Some(midpoint) = self.midpoint.get_mut(index) {
|
if let Some(midpoint) = self.midpoint.get_mut(index) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ impl graphene_hash::CacheHash for Vector {
|
|||||||
impl core_types::ops::FromAnchorPosition for Vector {
|
impl core_types::ops::FromAnchorPosition for Vector {
|
||||||
fn from_anchor_position(position: DVec2) -> Self {
|
fn from_anchor_position(position: DVec2) -> Self {
|
||||||
let mut point_domain = PointDomain::new();
|
let mut point_domain = PointDomain::new();
|
||||||
point_domain.push(PointId::generate(), position);
|
point_domain.push(PointId::ZERO, position);
|
||||||
|
|
||||||
Self { point_domain, ..Default::default() }
|
Self { point_domain, ..Default::default() }
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ mod tests {
|
|||||||
let vector = Vector::from_anchor_position(DVec2::new(3., 4.));
|
let vector = Vector::from_anchor_position(DVec2::new(3., 4.));
|
||||||
|
|
||||||
assert_eq!(vector.point_domain.positions(), [DVec2::new(3., 4.)]);
|
assert_eq!(vector.point_domain.positions(), [DVec2::new(3., 4.)]);
|
||||||
assert_eq!(vector.point_domain.ids().len(), 1);
|
assert_eq!(vector.point_domain.ids(), [PointId::ZERO], "expected the anchor position to be assigned the default PointId::ZERO",);
|
||||||
assert!(vector.segment_domain.ids().is_empty());
|
assert!(vector.segment_domain.ids().is_empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,12 +18,14 @@ impl Context {
|
|||||||
pub struct ContextBuilder {
|
pub struct ContextBuilder {
|
||||||
backends: Backends,
|
backends: Backends,
|
||||||
features: Features,
|
features: Features,
|
||||||
|
selection: Option<usize>,
|
||||||
}
|
}
|
||||||
impl ContextBuilder {
|
impl ContextBuilder {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
backends: Backends::all(),
|
backends: Backends::all(),
|
||||||
features: Features::empty(),
|
features: Features::empty(),
|
||||||
|
selection: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn with_backends(mut self, backends: Backends) -> Self {
|
pub fn with_backends(mut self, backends: Backends) -> Self {
|
||||||
@@ -34,21 +36,34 @@ impl ContextBuilder {
|
|||||||
self.features = features;
|
self.features = features;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
pub fn with_selection(mut self, index: usize) -> Self {
|
||||||
|
self.selection = Some(index);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
impl ContextBuilder {
|
impl ContextBuilder {
|
||||||
pub async fn build(self) -> Option<Context> {
|
pub async fn build(self) -> Option<Context> {
|
||||||
self.build_with_adapter_selection_inner(None::<fn(&[Adapter]) -> Option<usize>>).await
|
let instance = self.build_instance();
|
||||||
}
|
let mut adapters = enumerate_sorted(&instance, self.backends).await;
|
||||||
pub async fn build_with_adapter_selection<S>(self, select: S) -> Option<Context>
|
|
||||||
where
|
if let Some(index) = self.selection
|
||||||
S: Fn(&[Adapter]) -> Option<usize>,
|
&& index >= adapters.len()
|
||||||
{
|
{
|
||||||
self.build_with_adapter_selection_inner(Some(select)).await
|
let selected_adapter = adapters.remove(index);
|
||||||
|
adapters.insert(0, selected_adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
for adapter in adapters {
|
||||||
|
if let Some((device, queue)) = self.request_device(&adapter).await {
|
||||||
|
return Some(Context { device, queue, adapter, instance });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display {
|
pub async fn available_adapters_fmt(&self) -> impl std::fmt::Display {
|
||||||
let instance = self.build_instance();
|
let instance = self.build_instance();
|
||||||
fmt::AvailableAdaptersFormatter(instance.enumerate_adapters(self.backends).await)
|
fmt::AvailableAdaptersFormatter(enumerate_sorted(&instance, self.backends).await)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(target_family = "wasm")]
|
#[cfg(target_family = "wasm")]
|
||||||
@@ -67,6 +82,7 @@ impl ContextBuilder {
|
|||||||
..wgpu::InstanceDescriptor::new_without_display_handle()
|
..wgpu::InstanceDescriptor::new_without_display_handle()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
#[cfg(target_family = "wasm")]
|
||||||
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
|
async fn request_adapter(&self, instance: &Instance) -> Option<Adapter> {
|
||||||
let request_adapter_options = wgpu::RequestAdapterOptions {
|
let request_adapter_options = wgpu::RequestAdapterOptions {
|
||||||
power_preference: wgpu::PowerPreference::HighPerformance,
|
power_preference: wgpu::PowerPreference::HighPerformance,
|
||||||
@@ -88,38 +104,35 @@ impl ContextBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
impl ContextBuilder {
|
async fn enumerate_sorted(instance: &Instance, backends: Backends) -> Vec<Adapter> {
|
||||||
async fn build_with_adapter_selection_inner<S>(self, select: Option<S>) -> Option<Context>
|
let mut adapters = instance.enumerate_adapters(backends).await;
|
||||||
where
|
adapters.sort_by_key(adapter_priority);
|
||||||
S: Fn(&[Adapter]) -> Option<usize>,
|
adapters
|
||||||
{
|
}
|
||||||
let instance = self.build_instance();
|
#[cfg(not(target_family = "wasm"))]
|
||||||
|
fn adapter_priority(adapter: &Adapter) -> (u8, u8) {
|
||||||
let selected_adapter = if let Some(select) = select {
|
let info = adapter.get_info();
|
||||||
self.select_adapter(&instance, select).await
|
let backend = if cfg!(target_os = "linux") {
|
||||||
} else if cfg!(target_os = "windows") {
|
match info.backend {
|
||||||
self.select_adapter(&instance, |adapters: &[Adapter]| adapters.iter().position(|a| a.get_info().backend == wgpu::Backend::Dx12))
|
wgpu::Backend::Vulkan => 0,
|
||||||
.await
|
_ => 1,
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let adapter = if let Some(adapter) = selected_adapter { adapter } else { self.request_adapter(&instance).await? };
|
|
||||||
|
|
||||||
let (device, queue) = self.request_device(&adapter).await?;
|
|
||||||
Some(Context { device, queue, adapter, instance })
|
|
||||||
}
|
|
||||||
async fn select_adapter<S>(&self, instance: &Instance, select: S) -> Option<Adapter>
|
|
||||||
where
|
|
||||||
S: Fn(&[Adapter]) -> Option<usize>,
|
|
||||||
{
|
|
||||||
let mut adapters = instance.enumerate_adapters(self.backends).await;
|
|
||||||
let selected_index = select(&adapters)?;
|
|
||||||
if selected_index >= adapters.len() {
|
|
||||||
return None;
|
|
||||||
}
|
}
|
||||||
Some(adapters.remove(selected_index))
|
} else if cfg!(target_os = "windows") {
|
||||||
}
|
match info.backend {
|
||||||
|
wgpu::Backend::Dx12 => 0,
|
||||||
|
_ => 1,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
|
let device_type = match info.device_type {
|
||||||
|
wgpu::DeviceType::DiscreteGpu => 0,
|
||||||
|
wgpu::DeviceType::IntegratedGpu => 1,
|
||||||
|
wgpu::DeviceType::VirtualGpu => 2,
|
||||||
|
wgpu::DeviceType::Cpu => 3,
|
||||||
|
wgpu::DeviceType::Other => 4,
|
||||||
|
};
|
||||||
|
(backend, device_type)
|
||||||
}
|
}
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
mod fmt {
|
mod fmt {
|
||||||
|
|||||||
Loaded 100 of 129 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user