-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a transparent div when dragging and resizing.
- Loading branch information
Xie, Ziyu
committed
Aug 3, 2018
1 parent
68138c9
commit afd2193
Showing
14 changed files
with
210 additions
and
19 deletions.
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
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
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"name": "angular2-draggable", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0", | ||
"peerDependencies": { | ||
"@angular/common": "^6.0.0-rc.0 || ^6.0.0", | ||
"@angular/core": "^6.0.0-rc.0 || ^6.0.0" | ||
"@angular/common": "^6.0.0-rc.0 || >=6.0.0", | ||
"@angular/core": "^6.0.0-rc.0 || >=6.0.0" | ||
} | ||
} |
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
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
43 changes: 43 additions & 0 deletions
43
projects/angular2-draggable/src/lib/widgets/helper-block.ts
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Renderer2 } from '@angular/core'; | ||
|
||
export class HelperBlock { | ||
protected _helper: Element; | ||
|
||
constructor( | ||
protected parent: Element, | ||
protected renderer: Renderer2 | ||
) { | ||
// generate helper div | ||
let helper = renderer.createElement('div'); | ||
renderer.setStyle(helper, 'position', 'absolute'); | ||
renderer.setStyle(helper, 'width', '100%'); | ||
renderer.setStyle(helper, 'height', '100%'); | ||
renderer.setStyle(helper, 'background-color', 'transparent'); | ||
renderer.setStyle(helper, 'top', '0'); | ||
renderer.setStyle(helper, 'left', '0'); | ||
|
||
// done | ||
this._helper = helper; | ||
} | ||
|
||
add() { | ||
// append div to parent | ||
if (this.parent) { | ||
this.parent.appendChild(this._helper); | ||
} | ||
} | ||
|
||
remove() { | ||
if (this.parent) { | ||
this.parent.removeChild(this._helper); | ||
} | ||
} | ||
|
||
dispose() { | ||
this._helper = null; | ||
} | ||
|
||
get el() { | ||
return this._helper; | ||
} | ||
} |
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
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
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
33 changes: 33 additions & 0 deletions
33
src/app/views/adv-demo/iframe-demo/iframe-demo.component.html
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div class="iframe-drag-bounds" #dragBounds> | ||
<div class="iframe-resize-container" | ||
ngResizable | ||
rzHandles="n,s,e,w,se,sw" | ||
ngDraggable | ||
[handle]="dragHandle" | ||
[bounds]="dragBounds" | ||
[inBounds]="true" | ||
[preventDefaultEvent]="true"> | ||
<div #dragHandle class="iframe-drag-handle"> | ||
<h6> Draggable & Resizable </h6> | ||
</div> | ||
<iframe src="assets/demo.pdf" scrolling="no" width="100%" class="iframe-content"></iframe> | ||
</div> | ||
</div> | ||
|
||
|
||
<!-- Documents --> | ||
<div class="row mt-4"> | ||
<div class="col"> | ||
<tabset> | ||
<tab heading="html"> | ||
<markdown [data]="demo_html | language: 'html'"></markdown> | ||
</tab> | ||
<tab heading="component"> | ||
<markdown [data]="demo_ts | language: 'typescript'"></markdown> | ||
</tab> | ||
<tab heading="component"> | ||
<markdown [data]="demo_scss | language: 'sass'"></markdown> | ||
</tab> | ||
</tabset> | ||
</div> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
src/app/views/adv-demo/iframe-demo/iframe-demo.component.scss
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.iframe-drag-bounds { | ||
width: 100%; | ||
height: 400px; | ||
border: 1px dashed #A4B7C1; | ||
} | ||
|
||
.iframe-resize-container { | ||
position: relative; | ||
width: 300px; | ||
height: 300px; | ||
} | ||
|
||
.iframe-drag-handle { | ||
position: absolute; | ||
top: 0; | ||
right: 35px; | ||
height: 2em; | ||
background: #cccccc; | ||
z-index: 8; | ||
padding: 0.25em; | ||
text-align: right; | ||
} | ||
|
||
.iframe-content { | ||
position: absolute; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/app/views/adv-demo/iframe-demo/iframe-demo.component.ts
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
declare const require: any; | ||
|
||
@Component({ | ||
selector: 'app-iframe-demo', | ||
templateUrl: './iframe-demo.component.html', | ||
styleUrls: ['./iframe-demo.component.scss'] | ||
}) | ||
export class IframeDemoComponent implements OnInit { | ||
demo_html = require('!!html-loader!./iframe-demo.component.html'); | ||
demo_ts = require('!!raw-loader!./iframe-demo.component.ts'); | ||
demo_scss = require('!!raw-loader!./iframe-demo.component.scss'); | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
Oops, something went wrong.