fix: node selection rect not properly rendering on key press and mousemove

* issue came from some reactivity problems; a component shouldn't return null, else it'll basically do nothing ever again if it's not completely remounted
* some type fixes, removed some any's
This commit is contained in:
Braks
2021-07-17 19:34:32 +02:00
parent 087eb52f1f
commit 61ab006e94
7 changed files with 57 additions and 60 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ import { select, pointer } from 'd3-selection';
import { clamp } from '../../utils';
import { FlowTransform, TranslateExtent, PanOnScrollMode, KeyCode } from '../../types';
import { defineComponent, onMounted, PropType, ref, watch } from 'vue';
import { defineComponent, onMounted, PropType, ref, watch, watchEffect } from 'vue';
import store from '../../store';
import useKeyPress from '../../hooks/useKeyPress';
import useResizeHandler from '../../hooks/useResizeHandler';
@@ -193,7 +193,7 @@ const ZoomPane = defineComponent({
}
});
onMounted(() => {
watchEffect(() => {
if (pinia.d3Zoom) {
if (props.selectionKeyPressed) {
pinia.d3Zoom.on('zoom', null);
@@ -210,7 +210,7 @@ const ZoomPane = defineComponent({
}
});
onMounted(() => {
watchEffect(() => {
if (pinia.d3Zoom) {
if (props.onMoveStart) {
pinia.d3Zoom.on('start', (event: any) => {
@@ -227,7 +227,7 @@ const ZoomPane = defineComponent({
}
});
onMounted(() => {
watchEffect(() => {
if (pinia.d3Zoom) {
if (props.onMoveEnd) {
pinia.d3Zoom.on('end', (event: any) => {
@@ -244,7 +244,7 @@ const ZoomPane = defineComponent({
}
});
onMounted(() => {
watchEffect(() => {
if (pinia.d3Zoom) {
pinia.d3Zoom.filter((event: any) => {
const zoomScroll = props.zoomOnScroll;