diff --git a/src/app/views/querying/relational-algebra/relational-algebra.component.html b/src/app/views/querying/relational-algebra/relational-algebra.component.html index be0fea36..08d0cd45 100644 --- a/src/app/views/querying/relational-algebra/relational-algebra.component.html +++ b/src/app/views/querying/relational-algebra/relational-algebra.component.html @@ -1,70 +1,62 @@ +
+
+ -
+
+
+ [hidden]="!showingAnalysis">
+ [hidden]="showingAnalysis"> - +
{{n.value.type}} -  ( - - - ) - -
+  ( + + + ) + + +
-
- - - + + + [attr.x2]="temporalLine.x2" [attr.y2]="temporalLine.y2" marker-end="url(#arrowhead)"> + [attr.y1]="getY1(conn.value.source)" [attr.x2]="getX2(conn.value.target)" + [attr.y2]="getY2(conn.value.target)" marker-end="url(#arrowhead)">
@@ -75,10 +67,10 @@
{{resultSet.generatedQuery}} + [ngClass]="{'badge-secondary': !resultSet.error, 'badge-danger': resultSet.error}"> ! - +
@@ -96,10 +88,10 @@
+ [config]="{create: false, update: false, delete: false, sort: false, search: false, exploring: false}" + (executeView)="createView($event)">
- + \ No newline at end of file diff --git a/src/app/views/querying/relational-algebra/relational-algebra.component.scss b/src/app/views/querying/relational-algebra/relational-algebra.component.scss index 5c5ea768..1ac8add8 100644 --- a/src/app/views/querying/relational-algebra/relational-algebra.component.scss +++ b/src/app/views/querying/relational-algebra/relational-algebra.component.scss @@ -1,7 +1,10 @@ #operatorList .rel-op:hover { background: rgba(0, 0, 0, 0.05); } - +.row{ + height: calc(100vh - 130px); + position: relative; +} .rel-op { cursor: grab; } @@ -9,7 +12,7 @@ #drop { border: 1px solid #c8ced3; border-radius: 0.25rem; - height: 1000px; + width: auto; } #drop .node, .cdk-drag-preview .node { @@ -106,7 +109,7 @@ svg { #run { position: absolute; top: 1em; - right: 1em; + right: 7em; cursor: pointer; z-index: 2; } diff --git a/src/app/views/querying/relational-algebra/relational-algebra.component.ts b/src/app/views/querying/relational-algebra/relational-algebra.component.ts index 4073420c..0051abfa 100644 --- a/src/app/views/querying/relational-algebra/relational-algebra.component.ts +++ b/src/app/views/querying/relational-algebra/relational-algebra.component.ts @@ -180,7 +180,6 @@ export class RelationalAlgebraComponent implements OnInit, AfterViewInit, OnDest ); this.subscriptions.add(sub); } - treeDrop(e) { const id = 'node' + this.counter++; const x = Math.max(0, Math.min(this.dropArea.nativeElement.offsetWidth - 270, e.event.offsetX)); @@ -590,6 +589,25 @@ export class RelationalAlgebraComponent implements OnInit, AfterViewInit, OnDest draggingNode(e, node: Node) { this.draggingNodeX = node.left + e.distance.x + document.documentElement.scrollLeft - this.scrollLeft; this.draggingNodeY = node.top + e.distance.y + document.documentElement.scrollTop - this.scrollTop; + // get max left on all nodes to take as ref to make the board bigger or not + let maxX=0 + let maxY=0 + for (const [key, value] of this.nodes.entries()) { + maxX=Math.max(maxX,value.left) + maxY=Math.max(maxY,value.top) + } + // check if the draging node has max left or right to make the board bigger or not + if(this.draggingNodeX >=maxX) + { + this.dropArea.nativeElement.style.minWidth = (this.draggingNodeX+node.width+400)+ 'px'; + + } + + if(this.draggingNodeY >=maxY) + { + this.dropArea.nativeElement.style.minHeight = (this.draggingNodeY+node.height+400)+ 'px'; + + } } /** @@ -602,10 +620,17 @@ export class RelationalAlgebraComponent implements OnInit, AfterViewInit, OnDest const nodeHeight = $(nodeElement).height(); const scrollTopDistance = document.documentElement.scrollTop - this.scrollTop; const scrollLeftDistance = document.documentElement.scrollLeft - this.scrollLeft; - node.left = Math.max(0, Math.min(node.left + e.distance.x + scrollLeftDistance, this.dropArea.nativeElement.offsetWidth - nodeWidth - 4)); - node.top = Math.max(0, Math.min(node.top + e.distance.y + scrollTopDistance, this.dropArea.nativeElement.offsetHeight - nodeHeight - 4)); + // node.left = Math.max(0, Math.min(node.left + e.distance.x + scrollLeftDistance, this.dropArea.nativeElement.offsetWidth - nodeWidth - 4)); + // node.top = Math.max(0, Math.min(node.top + e.distance.y + scrollTopDistance, this.dropArea.nativeElement.offsetHeight - nodeHeight - 4)); + + node.left=Math.max(0,node.left + e.distance.x + scrollLeftDistance); + node.top= Math.max(0,node.top + e.distance.y + scrollTopDistance); + + console.log("ces") + console.log(node.top) this.draggingNodeX = undefined; this.draggingNodeY = undefined; + } trackNode(index: number, n: Node) { @@ -640,9 +665,16 @@ export class RelationalAlgebraComponent implements OnInit, AfterViewInit, OnDest const inputObj = JSON.parse(input); if (inputObj.nodes) { const importedNodes = new Map(); + let maxX=0 + let maxY=0 for (const [k, v] of Object.entries(inputObj.nodes)) { importedNodes.set(v[0], Node.fromJson(v[1], this.dropArea.nativeElement.offsetWidth, this.dropArea.nativeElement.offsetHeight)); + maxX=Math.max(maxX,v[1].left) + maxY=Math.max(maxY,v[1].top) } + this.dropArea.nativeElement.style.minWidth = (maxX+400)+ 'px'; + this.dropArea.nativeElement.style.minHeight = (maxY+400)+ 'px'; + this.nodes = importedNodes; this.counter = importedNodes.size; }