-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can now use shit plus ctrl to drag to deselect multiple nodes from se… #688
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1090,6 +1090,7 @@ export class GraphRenderer { | |||||||||||||||||
|
||||||||||||||||||
static mouseMove(eagle: Eagle, event: JQuery.TriggeredEvent) : void { | ||||||||||||||||||
const e: MouseEvent = event.originalEvent as MouseEvent; | ||||||||||||||||||
GraphRenderer.ctrlDrag = event.ctrlKey; | ||||||||||||||||||
|
||||||||||||||||||
GraphRenderer.dragCurrentPosition = {x:e.pageX,y:e.pageY} | ||||||||||||||||||
if (eagle.isDragging()){ | ||||||||||||||||||
|
@@ -1101,7 +1102,6 @@ export class GraphRenderer { | |||||||||||||||||
const node:Node = eagle.draggingNode() | ||||||||||||||||||
$('.node.transition').removeClass('transition') //this is for the bubble jump effect which we dont want here | ||||||||||||||||||
|
||||||||||||||||||
GraphRenderer.ctrlDrag = event.ctrlKey; | ||||||||||||||||||
|
||||||||||||||||||
// move node | ||||||||||||||||||
eagle.selectedObjects().forEach(function(obj){ | ||||||||||||||||||
|
@@ -1186,13 +1186,10 @@ export class GraphRenderer { | |||||||||||||||||
|
||||||||||||||||||
static endDrag(node: Node) : void { | ||||||||||||||||||
const eagle = Eagle.getInstance(); | ||||||||||||||||||
|
||||||||||||||||||
GraphRenderer.ctrlDrag = false; | ||||||||||||||||||
|
||||||||||||||||||
// if we dragged a selection region | ||||||||||||||||||
if (GraphRenderer.isDraggingSelectionRegion){ | ||||||||||||||||||
const nodes: Node[] = GraphRenderer.findNodesInRegion(GraphRenderer.selectionRegionStart.x, GraphRenderer.selectionRegionEnd.x, GraphRenderer.selectionRegionStart.y, GraphRenderer.selectionRegionEnd.y); | ||||||||||||||||||
|
||||||||||||||||||
//checking if there was no drag distance, if so we are clicking a single object and we will toggle its selection | ||||||||||||||||||
if(Math.abs(GraphRenderer.selectionRegionStart.x-GraphRenderer.selectionRegionEnd.x)+Math.abs(GraphRenderer.selectionRegionStart.y - GraphRenderer.selectionRegionEnd.y)<3){ | ||||||||||||||||||
if(GraphRenderer.altSelect){ | ||||||||||||||||||
|
@@ -1203,22 +1200,36 @@ export class GraphRenderer { | |||||||||||||||||
const edges: Edge[] = GraphRenderer.findEdgesContainedByNodes(eagle.logicalGraph().getEdges(), nodes); | ||||||||||||||||||
const objects: (Node | Edge)[] = []; | ||||||||||||||||||
|
||||||||||||||||||
// only add those objects which are not already selected | ||||||||||||||||||
for (const node of nodes){ | ||||||||||||||||||
if (!eagle.objectIsSelected(node)){ | ||||||||||||||||||
objects.push(node); | ||||||||||||||||||
// depending on if its shift+ctrl or just shift we are either only adding or only removing nodes | ||||||||||||||||||
if(!GraphRenderer.ctrlDrag){ | ||||||||||||||||||
for (const node of nodes){ | ||||||||||||||||||
if (!eagle.objectIsSelected(node)){ | ||||||||||||||||||
objects.push(node); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
for (const edge of edges){ | ||||||||||||||||||
if (!eagle.objectIsSelected(edge)){ | ||||||||||||||||||
objects.push(edge); | ||||||||||||||||||
for (const edge of edges){ | ||||||||||||||||||
if (!eagle.objectIsSelected(edge)){ | ||||||||||||||||||
objects.push(edge); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
}else{ | ||||||||||||||||||
for (const node of nodes){ | ||||||||||||||||||
if (eagle.objectIsSelected(node)){ | ||||||||||||||||||
objects.push(node); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
for (const edge of edges){ | ||||||||||||||||||
if (eagle.objectIsSelected(edge)){ | ||||||||||||||||||
objects.push(edge); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
objects.forEach(function(element){ | ||||||||||||||||||
eagle.editSelection(Eagle.RightWindowMode.Hierarchy, element, Eagle.FileType.Graph ) | ||||||||||||||||||
}) | ||||||||||||||||||
} | ||||||||||||||||||
GraphRenderer.ctrlDrag = false; | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Reset 'ctrlDrag' earlier in the method. Consider resetting 'ctrlDrag' earlier in the method to ensure it is always reset, even if an exception occurs later in the method.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
GraphRenderer.selectionRegionStart.x = 0; | ||||||||||||||||||
GraphRenderer.selectionRegionStart.y = 0; | ||||||||||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider renaming 'ctrlDrag' for clarity.
The variable name 'ctrlDrag' might be misleading as it suggests dragging with the control key. Consider renaming it to something more descriptive like 'isCtrlPressed' to better reflect its purpose.