forked from kaitai-io/kaitai_struct_webide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added jump to selection start/end actions on HexViewer
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Components/HexViewer/ContextMenu/Actions/HexViewerCtxActionJumpToSelection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {MenuItem} from "@imengyu/vue3-context-menu/lib/ContextMenuDefine"; | ||
import {h} from "vue"; | ||
import {useCurrentBinaryFileStore} from "../../../../Stores/CurrentBinaryFileStore"; | ||
import {BarsArrowDownIcon, BarsArrowUpIcon} from "@heroicons/vue/16/solid"; | ||
import {useHexViewerConfigStore} from "../../Store/HexViewerConfigStore"; | ||
|
||
export const HexViewerCtxActionJumpToSelection = (jumpToEnd: boolean = false): MenuItem => { | ||
const currentBinaryFileStore = useCurrentBinaryFileStore(); | ||
|
||
const action = () => { | ||
const hexViewerStore = useHexViewerConfigStore(); | ||
const jumpIndex = jumpToEnd | ||
? currentBinaryFileStore.selectionEnd | ||
: currentBinaryFileStore.selectionStart; | ||
hexViewerStore.jumpToAddress(jumpIndex); | ||
}; | ||
|
||
return { | ||
label: jumpToEnd ? "Jump to selection end" : "Jump to selection start", | ||
onClick: action, | ||
customClass: "context-menu-item", | ||
disabled: currentBinaryFileStore.selectionStart === -1 || currentBinaryFileStore.selectionEnd === -1, | ||
icon: () => h(jumpToEnd ? BarsArrowDownIcon : BarsArrowUpIcon) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters