增加删除所有选择信号的功能

This commit is contained in:
锦恢 2024-09-02 19:25:40 +08:00
parent 1ce4338248
commit 92c5c2b486
6 changed files with 34 additions and 12 deletions

View File

@ -63,22 +63,20 @@ function onMousemove(event) {
MovingPivot.label = formatTime(currentT, timescale); MovingPivot.label = formatTime(currentT, timescale);
MovingPivot.left = time2cursorX(currentT); MovingPivot.left = time2cursorX(currentT);
const pivot = UserPivots.get(currentT); // const pivot = UserPivots.get(currentT);
if (pivot !== undefined) { // if (pivot !== undefined) {
MovingPivot.show = false; // MovingPivot.show = false;
MovingPivot.currentTakenPivot = pivot; // MovingPivot.currentTakenPivot = pivot;
return; // return;
} // }
if (MovingPivot.currentTakenPivot !== undefined) {
return;
}
// //
const userPivot = getNearestUserPivot(currentT); const userPivot = getNearestUserPivot(currentT);
if (userPivot) { if (userPivot) {
const marginX = Math.abs(x - userPivot.x); const marginX = Math.abs(x - userPivot.x);
if (marginX < 25) { if (marginX < 12) {
// //
MovingPivot.show = false; MovingPivot.show = false;
MovingPivot.currentTakenPivot = userPivot; MovingPivot.currentTakenPivot = userPivot;

View File

@ -39,7 +39,6 @@ const containerStyle = computed(() => ({
const itemStyle = computed(() => ({ const itemStyle = computed(() => ({
left: getPivot().left - boxShift + 'px', left: getPivot().left - boxShift + 'px',
})); }));
function getPivot() { function getPivot() {

View File

@ -2,6 +2,7 @@ import { globalLookup } from "@/hook/global";
import { computed, nextTick, reactive } from "vue"; import { computed, nextTick, reactive } from "vue";
import { updateColorPickerManage } from "./color-picker"; import { updateColorPickerManage } from "./color-picker";
import { WaveContainerView } from "@/hook/wave-container-view"; import { WaveContainerView } from "@/hook/wave-container-view";
import { sidebarSelectedWires } from "@/hook/sidebar-select-wire";
/** /**
* @namespace contextmenu * @namespace contextmenu
@ -249,6 +250,21 @@ export function deleteSignalByView() {
const signal = contextmenu.currentWire; const signal = contextmenu.currentWire;
if (signal) { if (signal) {
WaveContainerView.delete(signal); WaveContainerView.delete(signal);
sidebarSelectedWires.delete(signal.link);
}
contextmenu.show = false;
}
export function deleteAllSelectedSignals() {
for (const link of globalLookup.sidebarSelectedWireLinks) {
const signal = globalLookup.link2CurrentWires.get(link);
if (signal) {
WaveContainerView.delete(signal);
sidebarSelectedWires.delete(link);
}
} }
contextmenu.show = false; contextmenu.show = false;

View File

@ -8,6 +8,13 @@
<span class="menu-item-icon iconfont icon-delete"></span> <span class="menu-item-icon iconfont icon-delete"></span>
<span class="menu-item-name">{{ t('context-menu.delete') }}</span> <span class="menu-item-name">{{ t('context-menu.delete') }}</span>
</div> </div>
<div
class="menu-item-container"
@click="deleteAllSelectedSignals()"
>
<span class="menu-item-icon iconfont icon-delete"></span>
<span class="menu-item-name">{{ t('context-menu.delete-all-select') }}</span>
</div>
<div <div
class="menu-item-container" class="menu-item-container"
@click="createGroup()" @click="createGroup()"
@ -74,7 +81,7 @@ import { defineComponent, reactive, ref } from 'vue';
import { globalLookup } from '@/hook/global'; import { globalLookup } from '@/hook/global';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { colorPicker, contextmenu, deleteSignalByView } from './handle-contextmenu'; import { colorPicker, contextmenu, deleteAllSelectedSignals, deleteSignalByView } from './handle-contextmenu';
import { makeIconClass } from '@/hook/utils'; import { makeIconClass } from '@/hook/utils';
import ColorPicker from './color-picker.vue'; import ColorPicker from './color-picker.vue';
import ExistGroup from './exist-group.vue'; import ExistGroup from './exist-group.vue';

View File

@ -58,6 +58,7 @@
"context-menu.join-group": "join created group", "context-menu.join-group": "join created group",
"context-menu.change-color": "change color", "context-menu.change-color": "change color",
"context-menu.delete": "delete signal", "context-menu.delete": "delete signal",
"context-menu.delete-all-select": "delete all the selected signals",
"context-menu.signal.name": "signal name", "context-menu.signal.name": "signal name",
"context-menu.signal.type": "signal type", "context-menu.signal.type": "signal type",

View File

@ -56,6 +56,7 @@
"context-menu.join-group": "加入已有分组", "context-menu.join-group": "加入已有分组",
"context-menu.change-color": "修改颜色", "context-menu.change-color": "修改颜色",
"context-menu.delete": "删除信号", "context-menu.delete": "删除信号",
"context-menu.delete-all-select": "删除所有选中信号",
"context-menu.signal.name": "信号名称", "context-menu.signal.name": "信号名称",
"context-menu.signal.type": "信号类型", "context-menu.signal.type": "信号类型",