Skip to content

Commit

Permalink
Merge branch 'html-graph-renderer' of https://github.com/icrar/EAGLE
Browse files Browse the repository at this point in the history
…into html-graph-renderer
  • Loading branch information
M-Wicenec committed Oct 13, 2023
2 parents c98763f + fe7210b commit e0aa6aa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/GraphRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ export class GraphRenderer {
}
})


//construct resizing
if(node.getParentKey() != null){
if(oldParent.getRadius()>GraphRenderer.NodeParentRadiusPreDrag+GraphConfig.CONSTRUCT_DRAG_OUT_DISTANCE){
Expand Down Expand Up @@ -571,7 +570,7 @@ export class GraphRenderer {

static startDrag = (node: Node, event: MouseEvent) : void => {
const eagle = Eagle.getInstance();
if(node === null){
if(node === null || event.which === 2){
eagle.isDragging(true);

} else if(!node.isEmbedded()){
Expand All @@ -587,8 +586,8 @@ export class GraphRenderer {
}
}

//select handlers

//select handlers
if(node !== null){
// check if shift key is down, if so, add or remove selected node to/from current selection
if (node !== null && event.shiftKey && !event.altKey){
Expand Down
2 changes: 2 additions & 0 deletions src/Setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export class Setting {
static readonly SNAP_TO_GRID: string = "SnapToGrid";
static readonly SNAP_TO_GRID_SIZE: string = "SnapToGridSize";
static readonly SHOW_INSPECTOR_WARNINGS: string = "ShowInspectorWarnings";
static readonly SHOW_ALL_CATEGORY_OPTIONS: string = "ShowAllCategoryOptions";
}

export namespace Setting {
Expand Down Expand Up @@ -402,6 +403,7 @@ const settings : SettingsGroup[] = [
new Setting(true, "Create Applications for Construct Ports", Setting.CREATE_APPLICATIONS_FOR_CONSTRUCT_PORTS, "When loading old graph files with ports on construct nodes, move the port to an embedded application",false, Setting.Type.Boolean, true,true,true, true, true),
new Setting(true, "Skip 'closes loop' edges in JSON output", Setting.SKIP_CLOSE_LOOP_EDGES, "We've recently added edges to the LinkDataArray that 'close' loop constructs and set the 'group_start' and 'group_end' automatically. In the short-term, such edges are not supported by the translator. This setting will keep the new edges during saving/loading, but remove them before sending the graph to the translator.", false, Setting.Type.Boolean, true, true, true,true,true),
new Setting(true, "Print Undo state to JS Console", Setting.PRINT_UNDO_STATE_TO_JS_CONSOLE, "Prints the state of the undo memory whenever a change occurs. The state is written to the browser's javascript console", false, Setting.Type.Boolean, false,false ,false, false, false),
new Setting(true, "Display all Category options", Setting.SHOW_ALL_CATEGORY_OPTIONS, "Displays all category options when changing the category of a node", false, Setting.Type.Boolean, false,false ,false, false, false),
]
)
];
26 changes: 15 additions & 11 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ export class Utils {
}else{
$('#confirmModalDontShowAgain button').text('check_box_outline_blank')
}
console.log($('#confirmModalDontShowAgain button').text())
})
}

Expand Down Expand Up @@ -1081,19 +1080,24 @@ export class Utils {
const result: Category[] = [];
for (const [categoryName, categoryData] of Object.entries(CategoryData.cData)){

if (categoryData.categoryType !== categoryType){
continue;
}

// if input ports required, skip nodes with too few
if (numRequiredInputs > categoryData.maxInputs){
continue;
}
if(!Setting.findValue(Setting.SHOW_ALL_CATEGORY_OPTIONS)){

if (categoryData.categoryType !== categoryType){
continue;
}

// if input ports required, skip nodes with too few
if (numRequiredInputs > categoryData.maxInputs){
continue;
}

// if output ports required, skip nodes with too few
if (numRequiredOutputs > categoryData.maxOutputs){
continue;
// if output ports required, skip nodes with too few
if (numRequiredOutputs > categoryData.maxOutputs){
continue;
}
}

result.push(categoryName as Category);
}

Expand Down
5 changes: 4 additions & 1 deletion src/graphConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const colors: { name: string; color: string; }[] = [
color: '#d4d4d4'
},{
name: 'constructBg',
color: '#0000001f'
color: '#0000001a'
},{
name: 'embeddedApp',
color: '#c5c5c5'
},{
name: 'constructIcon',
color: '#0000000f'
Expand Down

0 comments on commit e0aa6aa

Please sign in to comment.