feat(svelte): make selection draggable

This commit is contained in:
moklick
2023-02-21 11:35:15 +01:00
parent 1f44bc4da5
commit 6b192d90d5
9 changed files with 30 additions and 19 deletions
@@ -94,7 +94,7 @@ export default function drag(
const dragHandler = d3Drag()
.on('start', (event: UseDragEvent) => {
const pointerPos = getPointerPosition(event);
console.log(pointerPos);
lastPos = pointerPos;
dragItems = getDragItems(get(nodesStore), pointerPos, nodeId);
})
@@ -41,7 +41,6 @@ export function hasSelector(target: Element, selector: string, domNode: Element)
// looks for all selected nodes and created a NodeDragItem for each of them
export function getDragItems(nodes: Node[], mousePos: XYPosition, nodeId?: string): NodeDragItem[] {
console.log(mousePos, nodes);
return nodes
.filter(
(n) => (n.selected || n.id === nodeId) && (!n.parentNode || !isParentSelected(n, nodes))
@@ -40,9 +40,9 @@ function filter(event: any, params: ZoomParams): boolean {
// }
// // if the target element is inside an element with the nopan class, we prevent panning
// if (isWrappedWithClass(event, noPanClassName) && event.type !== 'wheel') {
// return false;
// }
if (isWrappedWithClass(event, 'nopan') && event.type !== 'wheel') {
return false;
}
// if (!zoomOnPinch && event.ctrlKey && event.type === 'wheel') {
// return false;