From ab86ca9ae921d7bf01442c974eac887241cada7d Mon Sep 17 00:00:00 2001 From: Shogo Fukushima <59794072+fksms@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:01:35 +0900 Subject: [PATCH] Remove node test --- src/components/ShowContextMenu.js | 69 ----- src/components/ViewBreadcrumbsList.vue | 4 +- src/components/ViewDirectoryFileList.vue | 4 +- src/components/ViewSunburstChart.vue | 307 ++++++++++++++++++----- 4 files changed, 249 insertions(+), 135 deletions(-) delete mode 100644 src/components/ShowContextMenu.js diff --git a/src/components/ShowContextMenu.js b/src/components/ShowContextMenu.js deleted file mode 100644 index df22cd3..0000000 --- a/src/components/ShowContextMenu.js +++ /dev/null @@ -1,69 +0,0 @@ -import { invoke } from "@tauri-apps/api"; -import { listen } from "@tauri-apps/api/event"; -import { writeText } from '@tauri-apps/api/clipboard'; - - -// コンテキストメニューを表示する関数 -async function showContextMenu(node) { - - // イベントを受信するためのリスナーを起動 - const unlisten1 = await listen("writeToClipboard", event => { - // クリップボードに書き込む - writeToClipboard(event.payload); - // リスナーをまとめて停止 - unlistenAll(); - }); - - // イベントを受信するためのリスナーを起動 - const unlisten2 = await listen("openFileManager", event => { - // ファイルマネージャーを開く - openFileManager(event.payload); - // リスナーをまとめて停止 - unlistenAll(); - }); - - // バックエンド側の関数を実行 - await invoke("plugin:context_menu|show_context_menu", { - items: [ - { - label: "Copy path", - disabled: false, - event: "writeToClipboard", - payload: node.data.name, - }, - { - label: "Open", - disabled: false, - event: "openFileManager", - payload: (node.children) ? node.data.name : node.parent.data.name, - } - ], - }); - - // リスナーをまとめて停止 - function unlistenAll() { - unlisten1(); - unlisten2(); - } -} - - -// ファイルマネージャーを開く関数 -async function openFileManager(path) { - await invoke("open_file_manager", { path: path }) - // 失敗した場合 - .catch((failure) => { - // エラーメッセージを出力 - console.error(failure); - }); -} - - -// クリップボードに書き込む関数 -async function writeToClipboard(path) { - await writeText(path); -} - - -// 外部に公開 -export { showContextMenu } \ No newline at end of file diff --git a/src/components/ViewBreadcrumbsList.vue b/src/components/ViewBreadcrumbsList.vue index 9d4592b..d7fc2cf 100644 --- a/src/components/ViewBreadcrumbsList.vue +++ b/src/components/ViewBreadcrumbsList.vue @@ -10,9 +10,9 @@ const props = defineProps(["viewSunburstChart", "viewDirectoryFileList"]); const ancestors = ref([]); -// パンくずリストを作成 +// パンくずリストを作成(入力されたノードデータのancestorsをパンくずリストにして表示) // -// node: カーソルを合わせた円弧or円のデータ +// node: ノードデータ function generateBreadcrumbs(node) { // 配列を初期化 diff --git a/src/components/ViewDirectoryFileList.vue b/src/components/ViewDirectoryFileList.vue index e60bbf0..4cfb207 100644 --- a/src/components/ViewDirectoryFileList.vue +++ b/src/components/ViewDirectoryFileList.vue @@ -17,9 +17,9 @@ const ownSize = ref(); const children = ref([]); -// リストを作成 +// リストを作成(入力されたノードデータのchildrenをリストにして表示) // -// node: カーソルを合わせた円弧or円のデータ +// node: ノードデータ // option: オプション function generateDirectoryList(node, option) { diff --git a/src/components/ViewSunburstChart.vue b/src/components/ViewSunburstChart.vue index 88b67a5..2b7002f 100644 --- a/src/components/ViewSunburstChart.vue +++ b/src/components/ViewSunburstChart.vue @@ -1,11 +1,12 @@