feat(svelte): make selection draggable
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user