From 4509f1bb6678eea735e5d6aacda5f534c5603640 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Tue, 24 Sep 2024 12:42:56 +0200 Subject: [PATCH 01/14] npm i --- package-lock.json | 158 ++++++++++++++++++++++++++-------------------- 1 file changed, 88 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32f53729..d2dcbf1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -717,208 +717,224 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.3.tgz", - "integrity": "sha512-MmKSfaB9GX+zXl6E8z4koOr/xU63AMVleLEa64v7R0QF/ZloMs5vcD1sHgM64GXXS1csaJutG+ddtzcueI/BLg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.3.tgz", - "integrity": "sha512-zrt8ecH07PE3sB4jPOggweBjJMzI1JG5xI2DIsUbkA+7K+Gkjys6eV7i9pOenNSDJH3eOr/jLb/PzqtmdwDq5g==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.3.tgz", - "integrity": "sha512-P0UxIOrKNBFTQaXTxOH4RxuEBVCgEA5UTNV6Yz7z9QHnUJ7eLX9reOd/NYMO3+XZO2cco19mXTxDMXxit4R/eQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.3.tgz", - "integrity": "sha512-L1M0vKGO5ASKntqtsFEjTq/fD91vAqnzeaF6sfNAy55aD+Hi2pBI5DKwCO+UNDQHWsDViJLqshxOahXyLSh3EA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.3.tgz", - "integrity": "sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.3.tgz", - "integrity": "sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.3.tgz", - "integrity": "sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.3.tgz", - "integrity": "sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.3.tgz", - "integrity": "sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.3.tgz", - "integrity": "sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.3.tgz", - "integrity": "sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.3.tgz", - "integrity": "sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.3.tgz", - "integrity": "sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.3.tgz", - "integrity": "sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.3.tgz", - "integrity": "sha512-nMIdKnfZfzn1Vsk+RuOvl43ONTZXoAPUUxgcU0tXooqg4YrAqzfKzVenqqk2g5efWh46/D28cKFrOzDSW28gTA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.3.tgz", - "integrity": "sha512-fOvu7PCQjAj4eWDEuD8Xz5gpzFqXzGlxHZozHP4b9Jxv9APtdxL6STqztDzMLuRXEc4UpXGGhx029Xgm91QBeA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -3564,10 +3580,11 @@ "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" }, "node_modules/rollup": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.3.tgz", - "integrity": "sha512-7sqRtBNnEbcBtMeRVc6VRsJMmpI+JU1z9VTvW8D4gXIYQFz0aLcsE6rRkyghZkLfEgUZgVvOG7A5CVz/VW5GIA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, + "license": "MIT", "dependencies": { "@types/estree": "1.0.5" }, @@ -3579,22 +3596,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.21.3", - "@rollup/rollup-android-arm64": "4.21.3", - "@rollup/rollup-darwin-arm64": "4.21.3", - "@rollup/rollup-darwin-x64": "4.21.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.3", - "@rollup/rollup-linux-arm-musleabihf": "4.21.3", - "@rollup/rollup-linux-arm64-gnu": "4.21.3", - "@rollup/rollup-linux-arm64-musl": "4.21.3", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.3", - "@rollup/rollup-linux-riscv64-gnu": "4.21.3", - "@rollup/rollup-linux-s390x-gnu": "4.21.3", - "@rollup/rollup-linux-x64-gnu": "4.21.3", - "@rollup/rollup-linux-x64-musl": "4.21.3", - "@rollup/rollup-win32-arm64-msvc": "4.21.3", - "@rollup/rollup-win32-ia32-msvc": "4.21.3", - "@rollup/rollup-win32-x64-msvc": "4.21.3", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, @@ -4088,10 +4105,11 @@ } }, "node_modules/vite": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.5.tgz", - "integrity": "sha512-pXqR0qtb2bTwLkev4SE3r4abCNioP3GkjvIDLlzziPpXtHgiJIjuKl+1GN6ESOT3wMjG3JTeARopj2SwYaHTOA==", + "version": "5.4.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.7.tgz", + "integrity": "sha512-5l2zxqMEPVENgvzTuBpHer2awaetimj2BGkhBPdnwKbPNOlHsODU+oiazEZzLK7KhAnOrO+XGYJYn4ZlUhDtDQ==", "dev": true, + "license": "MIT", "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", -- GitLab From f08b5c4082e2a6af92d20d7105153779d181d0ee Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Tue, 24 Sep 2024 16:35:11 +0200 Subject: [PATCH 02/14] node that displays an image --- public/miniMetabolicNetwork.json | 2 +- public/personne.json | 70 +++++++++++++++++++++++++++++ src/App.vue | 2 +- src/assets/anonymous.png | Bin 0 -> 2101 bytes src/components/ImageComponent.vue | 36 +++++++++++++++ src/composables/UsePolygonShape.ts | 16 +++++++ 6 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 public/personne.json create mode 100644 src/assets/anonymous.png create mode 100644 src/components/ImageComponent.vue diff --git a/public/miniMetabolicNetwork.json b/public/miniMetabolicNetwork.json index 6c873ad7..2012b074 100644 --- a/public/miniMetabolicNetwork.json +++ b/public/miniMetabolicNetwork.json @@ -8,7 +8,7 @@ "width": 25, "height": 25, "strokeWidth": 1, - "shape": "circle", + "shape": "image", "displayLabel": false }, "reaction": { diff --git a/public/personne.json b/public/personne.json new file mode 100644 index 00000000..2abc2442 --- /dev/null +++ b/public/personne.json @@ -0,0 +1,70 @@ +{ + "graph": { + "directed": true, + "metadata": { + "style": { + "nodeStyles": { + "personne": { + "width": 40, + "height": 40, + "strokeWidth": 1, + "shape": "image", + "displayLabel": true + }, + "lieu": { + "width": 50, + "height": 50, + "strokeWidth": 1, + "shape": "rect", + "displayLabel": true + } + } + } + }, + "id": "Membres", + "type": "personne", + "nodes": { + "Jean Valjean": { + "metadata": { + "classes": ["personne"], + "position": { + "x": 20, + "y": 100 + } + }, + "label": "Jean Valjean" + }, + "Cosette": { + "metadata": { + "classes": ["personne"], + "position": { + "x": 300, + "y": 100 + } + }, + "label": "Cosette" + }, + "Paris": { + "metadata": { + "classes": ["lieu"], + "position": { + "x": 140, + "y": 100 + } + }, + "label": "Paris" + } + }, + "edges": [ + { + "source": "Jean Valjean", + "target": "Paris" + }, + { + "source": "Cosette", + "target": "Paris" + } + ] + } + } + \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 08b3c18b..d7d1ece3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -109,7 +109,7 @@ async function callbackFunction() { } onMounted(() => { - importNetworkFromURL("/glycolysis_krebs.json", network, networkStyle, callbackFunction); + importNetworkFromURL("/personne.json", network, networkStyle, callbackFunction); // importNetworkFromURL("/oneNode.json", network, networkStyle); }); diff --git a/src/assets/anonymous.png b/src/assets/anonymous.png new file mode 100644 index 0000000000000000000000000000000000000000..432353b5910ecb051651cc452ca6c25b1665b088 GIT binary patch literal 2101 zcmV-52+H?~P)<h;3K|Lk000e1NJLTq007|t007_!0{{R3!ZGpf0001BP)t-s@bK_( zaB%eW^l52nzrVk2ZEf}S^=D^i>+9?2=;-e5?sj%|hK7c7b92?z)q8t;w6wI~;NZ~E z(5R@WqN1Y4#>SeOnvai<goK3I+1anJujAw6l$4aZy1Jd6oy*J1OMd#A000M&Nkl<Z zc%1E>XP2ug6ozFh_FiI%#{d5>FD6qGPZ|huGnePnDQjl&E?_rcYgq<^!C){L3<iV2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{uE+qqCSgMbeTe_jX=S!*uKiotH{O^d8K*O!`)w?gMh+*?@{wWV}Y<{*Sk;L z*!&wYM0!^70GmJh4w2j}c@xV2g=Al=ManiJuR=(XR}t6P+zNH_h6^5VwZ<K_+J?&w z8(xKaB)`9Kn;Ot;8xlHlDh#w!$Z1R=)y&Ya^n!06YH(h$hV#QofcWhG0TEv%!&UhO zAT=a>k*Rj>kSUz_6zY`zUf?{S(NG~7_!R0>XZwLKsL@d&-<Jklz4G5P2R?;59F5+> z8JOy*u;o*zp)KXxhcNH=P*e==7qpOfwpMif<;2p_ij@Bb-@1hycDMx^3<iV2U@#aA f27|$1(2D;6l--fIS75oe00000NkvXXu0mjfzX=cQ literal 0 HcmV?d00001 diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue new file mode 100644 index 00000000..236e29a8 --- /dev/null +++ b/src/components/ImageComponent.vue @@ -0,0 +1,36 @@ +<template> + <g ref="nodeElement" :x="node.x" :y="node.y" :height="style.height" :width="style.width" fill="white" + :style="cursor"> + <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" + :height="style.height" :width="style.width" :fill="style.fill"></rect> + <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + </g> +</template> + +<script setup lang="ts"> +import type { styleType } from '@/models/styleType'; +import type { NodeType } from '@/models/NodeType'; +import type { PropType } from 'vue'; +import { useDragAndDrop } from '@/composables/UseDragAndDrop'; + +// PROPS +const props = defineProps({ + node: { + type: Object as PropType<NodeType>, + required: true + }, + style: { + type: Object as PropType<styleType>, + default: () => { + return ({ + width: 20, height: 20, stroke: "grey", + strokeWidth: 0.5, + fill: "white" + }) + } + } +}) + +// DATA +const { nodeElement, cursor } = useDragAndDrop(props); +</script> diff --git a/src/composables/UsePolygonShape.ts b/src/composables/UsePolygonShape.ts index b6ef1b91..ad524a53 100644 --- a/src/composables/UsePolygonShape.ts +++ b/src/composables/UsePolygonShape.ts @@ -1,5 +1,6 @@ import PolygonComponent from "../components/PolygonComponent.vue"; import CircleComponent from "../components/CircleComponent.vue"; +import ImageComponent from "@/components/ImageComponent.vue"; import { Node } from "../types/Node"; import { NodeStyle } from "../types/NodeStyle"; import { Component } from "vue"; @@ -71,6 +72,21 @@ export function getNodeShape(node: Node, nodeStyle: NodeStyle): {shape: Componen points: initPos + ' ' + pos2 + ' ' + pos3 + ' ' + pos4 } } + + /** + * Return path for an image + */ + if (nodeStyle.shape === 'image') { + const initPos = node.x + ',' + node.y; + const pos2 = node.x + ',' + (node.y + height); + const pos3 = (node.x + width) + ',' + (node.y + height); + const pos4 = (node.x + width) + ',' + node.y; + + return { + shape: ImageComponent, + points: initPos + ' ' + pos2 + ' ' + pos3 + ' ' + pos4 + } + } /** * Return radius for a circle -- GitLab From b53fae7de9398da5c16711b8b8b5659b983c7c67 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 09:41:50 +0200 Subject: [PATCH 03/14] circle image --- src/components/ImageComponent.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 236e29a8..58a1e8f1 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -1,9 +1,19 @@ <template> <g ref="nodeElement" :x="node.x" :y="node.y" :height="style.height" :width="style.width" fill="white" :style="cursor"> + <!-- <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" :height="style.height" :width="style.width" :fill="style.fill"></rect> <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + + --> + <circle :cx="node.x +style.width/2" :cy="node.y + style.height/2" :r="style.width/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> + <defs> + <pattern id="circlepattern" height="1" width="1" x="0" y="0"> + <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height"></image> + + </pattern> + </defs> </g> </template> -- GitLab From 21ccee1582c623b111536d50318af9a8eb4aab53 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 09:47:34 +0200 Subject: [PATCH 04/14] debug types --- src/components/ImageComponent.vue | 10 +++++----- src/composables/UsePolygonShape.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 58a1e8f1..300da326 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -7,7 +7,7 @@ <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> --> - <circle :cx="node.x +style.width/2" :cy="node.y + style.height/2" :r="style.width/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> + <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height"></image> @@ -18,19 +18,19 @@ </template> <script setup lang="ts"> -import type { styleType } from '@/models/styleType'; -import type { NodeType } from '@/models/NodeType'; +import type { NodeStyle } from '@/types/NodeStyle'; +import type { Node } from '@/types/Node'; import type { PropType } from 'vue'; import { useDragAndDrop } from '@/composables/UseDragAndDrop'; // PROPS const props = defineProps({ node: { - type: Object as PropType<NodeType>, + type: Object as PropType<Node>, required: true }, style: { - type: Object as PropType<styleType>, + type: Object as PropType<NodeStyle>, default: () => { return ({ width: 20, height: 20, stroke: "grey", diff --git a/src/composables/UsePolygonShape.ts b/src/composables/UsePolygonShape.ts index ad524a53..8c51ab83 100644 --- a/src/composables/UsePolygonShape.ts +++ b/src/composables/UsePolygonShape.ts @@ -76,7 +76,7 @@ export function getNodeShape(node: Node, nodeStyle: NodeStyle): {shape: Componen /** * Return path for an image */ - if (nodeStyle.shape === 'image') { + if (nodeStyle.shape === 'image' || nodeStyle.shape === 'imageRect' || nodeStyle.shape === 'imageCircle') { const initPos = node.x + ',' + node.y; const pos2 = node.x + ',' + (node.y + height); const pos3 = (node.x + width) + ',' + (node.y + height); -- GitLab From 642ec9a5a01892eaf5a4f734366e6915a61f3022 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 09:54:06 +0200 Subject: [PATCH 05/14] choose between circle or rectangle --- src/components/ImageComponent.vue | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 300da326..270e76fc 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -1,19 +1,19 @@ <template> <g ref="nodeElement" :x="node.x" :y="node.y" :height="style.height" :width="style.width" fill="white" :style="cursor"> - <!-- - <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" + <g v-if="style.shape == 'imageCircle'"> + <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> + <defs> + <pattern id="circlepattern" height="1" width="1" x="0" y="0"> + <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height"></image> + </pattern> + </defs> + </g> + <g v-else> + <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" :height="style.height" :width="style.width" :fill="style.fill"></rect> - <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> - - --> - <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> - <defs> - <pattern id="circlepattern" height="1" width="1" x="0" y="0"> - <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height"></image> - - </pattern> - </defs> + <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + </g> </g> </template> -- GitLab From 92eca52fecdaaec9caaad2ea42754c69aff4ada5 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 09:59:21 +0200 Subject: [PATCH 06/14] dynamic image path --- public/personne.json | 13 ++++++++----- src/assets/paris.png | Bin 0 -> 1931 bytes src/components/ImageComponent.vue | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 src/assets/paris.png diff --git a/public/personne.json b/public/personne.json index 2abc2442..58e419e7 100644 --- a/public/personne.json +++ b/public/personne.json @@ -8,14 +8,14 @@ "width": 40, "height": 40, "strokeWidth": 1, - "shape": "image", + "shape": "imageCircle", "displayLabel": true }, "lieu": { "width": 50, "height": 50, "strokeWidth": 1, - "shape": "rect", + "shape": "imageRect", "displayLabel": true } } @@ -30,7 +30,8 @@ "position": { "x": 20, "y": 100 - } + }, + "image": "anonymous.png" }, "label": "Jean Valjean" }, @@ -40,7 +41,8 @@ "position": { "x": 300, "y": 100 - } + }, + "image": "anonymous.png" }, "label": "Cosette" }, @@ -50,7 +52,8 @@ "position": { "x": 140, "y": 100 - } + }, + "image": "paris.png" }, "label": "Paris" } diff --git a/src/assets/paris.png b/src/assets/paris.png new file mode 100644 index 0000000000000000000000000000000000000000..7375a753d709b02bdf4f21a68a740025655fd0ee GIT binary patch literal 1931 zcmV;62Xy#}P)<h;3K|Lk000e1NJLTq005@|005K-0{{R3!6wPw0001KP)t-s|Ns90 z007$B+J%LMTU%TF{QT+Z>GSjR?Ck7~jg7LhvibS><KyFbd3iuUK=1GGEG#U@$jFnE zlQT0ja&mGK5)x)+W<^Cs($dl$9UXsvf4I1~B_$<GOH0DS!WS18prD{rQ&Xv_sk{)Q z(f|Mk-AP12RCt{2T<MmwN(>YP9R*}lL`4+e{~_-+6<R<R^+VEg&eSiL87(`Vq>?nu zW+Njv?l8yx*s-yUi067KO{5>`=0H5Nvnx%d54NGOk>=8ep9fFFmL}7K#UIa6@yByq z{P7$Ye>}&<vcglEOD_sV)03vsi^VZOc3=6@R0iM?&q$i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L(cl5cQ0{~zR#NM4S< RX}<sf002ovPDHLkV1jO)!i)d_ literal 0 HcmV?d00001 diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 270e76fc..51d386be 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -5,14 +5,14 @@ <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> - <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height"></image> + <image :href="`/src/assets/${node.metadata!.image}`" :width="style.width" :height="style.height"></image> </pattern> </defs> </g> <g v-else> <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" :height="style.height" :width="style.width" :fill="style.fill"></rect> - <image href="/src/assets/anonymous.png" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + <image :href="`/src/assets/${node.metadata!.image}`" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> </g> </g> </template> -- GitLab From 42566513ca6fafe7feadda9c4e37795d239e9d01 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 10:28:26 +0200 Subject: [PATCH 07/14] undirected graph --- public/personne.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/personne.json b/public/personne.json index 58e419e7..399c0c12 100644 --- a/public/personne.json +++ b/public/personne.json @@ -1,6 +1,5 @@ { "graph": { - "directed": true, "metadata": { "style": { "nodeStyles": { @@ -9,14 +8,14 @@ "height": 40, "strokeWidth": 1, "shape": "imageCircle", - "displayLabel": true + "displayLabel": false }, "lieu": { "width": 50, "height": 50, "strokeWidth": 1, "shape": "imageRect", - "displayLabel": true + "displayLabel": false } } } @@ -61,11 +60,13 @@ "edges": [ { "source": "Jean Valjean", - "target": "Paris" + "target": "Paris", + "directed": false }, { "source": "Cosette", - "target": "Paris" + "target": "Paris", + "directed": false } ] } -- GitLab From 8531b9269e53876b2bf265d2c42961029b96c289 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 11:14:07 +0200 Subject: [PATCH 08/14] debug selection --- src/components/ImageComponent.vue | 7 ++++++- src/components/NodeData.vue | 24 +++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 51d386be..76d663d5 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -2,7 +2,8 @@ <g ref="nodeElement" :x="node.x" :y="node.y" :height="style.height" :width="style.width" fill="white" :style="cursor"> <g v-if="style.shape == 'imageCircle'"> - <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" fill="url(#circlepattern)"></circle> + <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" + :strokeWidth="style.strokeWidth" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> <image :href="`/src/assets/${node.metadata!.image}`" :width="style.width" :height="style.height"></image> @@ -44,3 +45,7 @@ const props = defineProps({ // DATA const { nodeElement, cursor } = useDragAndDrop(props); </script> + +<style scoped> +@import "@/assets/style.css"; +</style> diff --git a/src/components/NodeData.vue b/src/components/NodeData.vue index b39ea73a..3676a5d2 100644 --- a/src/components/NodeData.vue +++ b/src/components/NodeData.vue @@ -174,13 +174,23 @@ const labelY = computed((): number => { } }); -// Variables -------- -const selectedStyle = reactive({ - height: nodeStyle.value.height, - width: nodeStyle.value.width, - fill: '#000000', - opacity: 0.4, - shape: nodeShape +// Computed -------- +const selectedStyle = computed(() => { + if (nodeStyle.value.shape == "image" || nodeStyle.value.shape == "imageRect" ||nodeStyle.value.shape == "imageCircle") { + return { + height: nodeStyle.value.height, + width: nodeStyle.value.width, + stroke: "red", + shape: nodeStyle.value.shape + }; + } + return { + height: nodeStyle.value.height, + width: nodeStyle.value.width, + fill: '#000000', + opacity: 0.4, + shape: nodeShape + }; }); </script> -- GitLab From 4fa63887e4e9d93f5fc495eea0c4e261538f7e0a Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 11:26:46 +0200 Subject: [PATCH 09/14] update doc --- README.md | 4 +++- public/personne.json | 10 +++++----- src/components/ImageComponent.vue | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6fbfd9d0..a695fe96 100644 --- a/README.md +++ b/README.md @@ -466,9 +466,11 @@ A `<slot />` tag is also available in the component. This tag allows you to add | stroke | string | Node's border color | | displayLabel | boolean | Allows you to display or not nodes label | | label | string | Allows you to choose which node's attribut is display as label (id or label) | -| shape | string | Node's shape (rectangle, circle, diamond, triangle or inverseTriangle) | +| shape | string | Node's shape (rectangle, circle, diamond, triangle, inverseTriangle, imageRect or imageCircle) | | opacity | number | Node's opacity (between 0 and 1) | +If the shape is an image, you need to add the image file path in the nodes metadata (`metadata.image: string`). + ### LinkStyle | Attribut | Type | Description | diff --git a/public/personne.json b/public/personne.json index 399c0c12..17902ec2 100644 --- a/public/personne.json +++ b/public/personne.json @@ -8,14 +8,14 @@ "height": 40, "strokeWidth": 1, "shape": "imageCircle", - "displayLabel": false + "displayLabel": true }, "lieu": { "width": 50, "height": 50, "strokeWidth": 1, "shape": "imageRect", - "displayLabel": false + "displayLabel": true } } } @@ -30,7 +30,7 @@ "x": 20, "y": 100 }, - "image": "anonymous.png" + "image": "/src/assets/anonymous.png" }, "label": "Jean Valjean" }, @@ -41,7 +41,7 @@ "x": 300, "y": 100 }, - "image": "anonymous.png" + "image": "/src/assets/anonymous.png" }, "label": "Cosette" }, @@ -52,7 +52,7 @@ "x": 140, "y": 100 }, - "image": "paris.png" + "image": "src/assets/paris.png" }, "label": "Paris" } diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 76d663d5..25337424 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -6,14 +6,14 @@ :strokeWidth="style.strokeWidth" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> - <image :href="`/src/assets/${node.metadata!.image}`" :width="style.width" :height="style.height"></image> + <image :href="node.metadata!.image as string" :width="style.width" :height="style.height"></image> </pattern> </defs> </g> <g v-else> <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" :height="style.height" :width="style.width" :fill="style.fill"></rect> - <image :href="`/src/assets/${node.metadata!.image}`" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + <image :href="node.metadata!.image as string" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> </g> </g> </template> -- GitLab From 17f4c0e5c2fd45c17c3b800893c52fd645cc2cf4 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 14:11:55 +0200 Subject: [PATCH 10/14] move images --- {src/assets => public/images}/anonymous.png | Bin {src/assets => public/images}/paris.png | Bin public/personne.json | 6 +++--- 3 files changed, 3 insertions(+), 3 deletions(-) rename {src/assets => public/images}/anonymous.png (100%) rename {src/assets => public/images}/paris.png (100%) diff --git a/src/assets/anonymous.png b/public/images/anonymous.png similarity index 100% rename from src/assets/anonymous.png rename to public/images/anonymous.png diff --git a/src/assets/paris.png b/public/images/paris.png similarity index 100% rename from src/assets/paris.png rename to public/images/paris.png diff --git a/public/personne.json b/public/personne.json index 17902ec2..f1aa14be 100644 --- a/public/personne.json +++ b/public/personne.json @@ -30,7 +30,7 @@ "x": 20, "y": 100 }, - "image": "/src/assets/anonymous.png" + "image": "/public/images/anonymous.png" }, "label": "Jean Valjean" }, @@ -41,7 +41,7 @@ "x": 300, "y": 100 }, - "image": "/src/assets/anonymous.png" + "image": "/public/images/anonymous.png" }, "label": "Cosette" }, @@ -52,7 +52,7 @@ "x": 140, "y": 100 }, - "image": "src/assets/paris.png" + "image": "/public/images/paris.png" }, "label": "Paris" } -- GitLab From 918f63d930d673018009fe051482edc6a02debeb Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 14:16:27 +0200 Subject: [PATCH 11/14] update usePolygonShape --- src/components/ImageComponent.vue | 11 +++++++++-- src/composables/UsePolygonShape.ts | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 25337424..900ec145 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -2,7 +2,7 @@ <g ref="nodeElement" :x="node.x" :y="node.y" :height="style.height" :width="style.width" fill="white" :style="cursor"> <g v-if="style.shape == 'imageCircle'"> - <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="style.width!/2" :stroke="style.stroke" + <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="shape.radius" :stroke="style.stroke" :strokeWidth="style.strokeWidth" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> @@ -22,6 +22,7 @@ import type { NodeStyle } from '@/types/NodeStyle'; import type { Node } from '@/types/Node'; import type { PropType } from 'vue'; +import type { NodeShape } from "../types/NodeShape"; import { useDragAndDrop } from '@/composables/UseDragAndDrop'; // PROPS @@ -39,7 +40,13 @@ const props = defineProps({ fill: "white" }) } - } + }, + shape: { + type: Object as PropType<NodeShape>, + default: () => { + return {} + } + } }) // DATA diff --git a/src/composables/UsePolygonShape.ts b/src/composables/UsePolygonShape.ts index 8c51ab83..34354837 100644 --- a/src/composables/UsePolygonShape.ts +++ b/src/composables/UsePolygonShape.ts @@ -74,9 +74,9 @@ export function getNodeShape(node: Node, nodeStyle: NodeStyle): {shape: Componen } /** - * Return path for an image + * Return path for a rectangle image */ - if (nodeStyle.shape === 'image' || nodeStyle.shape === 'imageRect' || nodeStyle.shape === 'imageCircle') { + if (nodeStyle.shape === 'image' || nodeStyle.shape === 'imageRect') { const initPos = node.x + ',' + node.y; const pos2 = node.x + ',' + (node.y + height); const pos3 = (node.x + width) + ',' + (node.y + height); @@ -87,6 +87,16 @@ export function getNodeShape(node: Node, nodeStyle: NodeStyle): {shape: Componen points: initPos + ' ' + pos2 + ' ' + pos3 + ' ' + pos4 } } + + /** + * Return path for a rounded image + */ + if (nodeStyle.shape === 'imageCircle') { + return { + shape: ImageComponent, + radius: height / 2 + } + } /** * Return radius for a circle -- GitLab From e3241740eb663ab65de3993777e26e322768d4ae Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 14:17:36 +0200 Subject: [PATCH 12/14] debug style path --- src/components/ImageComponent.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 900ec145..9b3486f9 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -6,24 +6,24 @@ :strokeWidth="style.strokeWidth" fill="url(#circlepattern)"></circle> <defs> <pattern id="circlepattern" height="1" width="1" x="0" y="0"> - <image :href="node.metadata!.image as string" :width="style.width" :height="style.height"></image> + <image :href="(node.metadata!.image as string)" :width="style.width" :height="style.height"></image> </pattern> </defs> </g> <g v-else> <rect :x="node.x" :y="node.y" :stroke="style.stroke" :strokeWidth="style.strokeWidth" :height="style.height" :width="style.width" :fill="style.fill"></rect> - <image :href="node.metadata!.image as string" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> + <image :href="(node.metadata!.image as string)" :width="style.width" :height="style.height" :x="node.x" :y="node.y"></image> </g> </g> </template> <script setup lang="ts"> -import type { NodeStyle } from '@/types/NodeStyle'; -import type { Node } from '@/types/Node'; +import type { NodeStyle } from '../types/NodeStyle'; +import type { Node } from '../types/Node'; import type { PropType } from 'vue'; import type { NodeShape } from "../types/NodeShape"; -import { useDragAndDrop } from '@/composables/UseDragAndDrop'; +import { useDragAndDrop } from '../composables/UseDragAndDrop'; // PROPS const props = defineProps({ @@ -54,5 +54,5 @@ const { nodeElement, cursor } = useDragAndDrop(props); </script> <style scoped> -@import "@/assets/style.css"; +@import "../assets/style.css"; </style> -- GitLab From c64114d0d7a026354bfbba3e73e6eca66fccddc7 Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 14:18:48 +0200 Subject: [PATCH 13/14] remove default props --- src/components/ImageComponent.vue | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index 9b3486f9..e7cae93b 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -32,21 +32,11 @@ const props = defineProps({ required: true }, style: { - type: Object as PropType<NodeStyle>, - default: () => { - return ({ - width: 20, height: 20, stroke: "grey", - strokeWidth: 0.5, - fill: "white" - }) - } + type: Object as PropType<NodeStyle> }, - shape: { - type: Object as PropType<NodeShape>, - default: () => { - return {} - } - } + shape: { + type: Object as PropType<NodeShape>, + } }) // DATA -- GitLab From b74ec3b317e26fad11f3cdbc9b53adc5c0faa18f Mon Sep 17 00:00:00 2001 From: "marion.liotier" <marion.liotier@inrae.fr> Date: Wed, 25 Sep 2024 14:29:23 +0200 Subject: [PATCH 14/14] different images for the same class --- public/images/anonymous_woman.png | Bin 0 -> 3089 bytes public/personne.json | 2 +- src/components/ImageComponent.vue | 8 +++++--- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 public/images/anonymous_woman.png diff --git a/public/images/anonymous_woman.png b/public/images/anonymous_woman.png new file mode 100644 index 0000000000000000000000000000000000000000..63881db9767e18dc6d6a62734974cd43d93fe207 GIT binary patch literal 3089 zcmV+s4DR!ZP)<h;3K|Lk000e1NJLTq007$n008C)0{{R3Yq<ac0001oP)t-s00030 z|Nrsv@%#JxwY9bN_4Ne>1<=sY`1ttg>FMU?=HK7n;^N}Iz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|GYCSN5zg!}h9o*6}N|ji=c>yhQy~$^@d)Y}>qN z=%93xSBj0{>@7!ijBLK&5bRfL6B{wL>TT3Bu#sHgH_~3uR^0Xfsj-%gn7Z{w8tB+) zuh4og1sXQD^qlw5P{Wq@yjavxvayB{a#L5yhELsnODWm%o)nWB3bs#JC9mo$*c{*N z{5F~^*oqlSP-v88%X>;}nq=5M<#Cg??}&{f>HAI8OtZ11)xL)sX*MsB`g}A=v0>kR z`OZ3~*f6E6Z?6<v(IX`ZwUcZgVkqAgB-t1W9^OY`k}dD)u<Dp#EATOZN(r{l@VO(E zWwsBpxUL$>Y@ZO~k~Egt3YM5)Qz*0LJsD=rB(_hoCa?OH*qn<Z-%XX6t@sBxDV1Zk zPl<6wYQ$_G<aFQFi`hQPQobsT*sR?H3#W6$_F<N?c*OC<2U^NkMQk5tDPI+_6*cwF zp!Sn3^A3*UYxHExdm<iGeXxC;H7V|;TmofHj%%e(UeUhYc!{V~+dSC7wa4Wg;}7?v zUT}zb_+W!N-OqGqww^QyJ<|uFoyz|1Y+#G)SxB14ANTxS!D~bF#s>X({aG54hqw1U zQv*i`IyW}xRExzH+}NP;yJE40H#VqMQY^OVjSc$gVzJGyY~bXJVzFHoN&(*v3&u9O zuz`;P3dT0Ruz{_Ng0b~W0v-n{7~5}2z~ev#W4ruo@HkM>*g689SW+~$o`9d27LBbd f;3uX<W83~8dpxO;Q#vzQ00000NkvXXu0mjfQ0of3 literal 0 HcmV?d00001 diff --git a/public/personne.json b/public/personne.json index f1aa14be..22ac4d45 100644 --- a/public/personne.json +++ b/public/personne.json @@ -41,7 +41,7 @@ "x": 300, "y": 100 }, - "image": "/public/images/anonymous.png" + "image": "/public/images/anonymous_woman.png" }, "label": "Cosette" }, diff --git a/src/components/ImageComponent.vue b/src/components/ImageComponent.vue index e7cae93b..bf206f00 100644 --- a/src/components/ImageComponent.vue +++ b/src/components/ImageComponent.vue @@ -3,9 +3,9 @@ :style="cursor"> <g v-if="style.shape == 'imageCircle'"> <circle :cx="node.x +style.width!/2" :cy="node.y + style.height!/2" :r="shape.radius" :stroke="style.stroke" - :strokeWidth="style.strokeWidth" fill="url(#circlepattern)"></circle> + :strokeWidth="style.strokeWidth" :fill="`url(#${node.metadata!.image}.pattern)`"></circle> <defs> - <pattern id="circlepattern" height="1" width="1" x="0" y="0"> + <pattern :id="`${node.metadata!.image}.pattern`" height="1" width="1" x="0" y="0"> <image :href="(node.metadata!.image as string)" :width="style.width" :height="style.height"></image> </pattern> </defs> @@ -32,10 +32,12 @@ const props = defineProps({ required: true }, style: { - type: Object as PropType<NodeStyle> + type: Object as PropType<NodeStyle>, + required: true }, shape: { type: Object as PropType<NodeShape>, + required: true } }) -- GitLab