Skip to content

Commit

Permalink
Modern Web Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bmartinson committed Nov 10, 2021
1 parent 6163506 commit 4b27648
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
/dist
/tmp
/out-tsc
.angular

# Only exists if Bazel was run
/bazel-out

Expand Down
14 changes: 13 additions & 1 deletion projects/ngx-draggable-dom/src/lib/classes/ngx-draggable-rect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class NgxDraggableRect implements ClientRect {
export class NgxDraggableRect implements DOMRect {

/* * * * * Internal Properties * * * * */
public x: number;
Expand Down Expand Up @@ -52,6 +52,18 @@ export class NgxDraggableRect implements ClientRect {
}
}

/**
* Receive the draggable rect in json format.
*/
public get toJSON(): any {
return {
height: this.height,
width: this.width,
x: this.left,
y: this.top,
};
}

public constructor(x: number, y: number, width: number, height: number) {
this.x = (!!x) ? x : 0;
this.y = (!!y) ? y : 0;
Expand Down

0 comments on commit 4b27648

Please sign in to comment.