-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd4ca20
commit e860d45
Showing
15 changed files
with
156 additions
and
106 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 was deleted.
Oops, something went wrong.
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,6 @@ | ||
export const GIZMO_MOVE = 0; | ||
export const GIZMO_SCALE = 1; | ||
|
||
export interface Gizmo extends HTMLElement { | ||
get type(): number; | ||
} |
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,51 @@ | ||
$handle-size: 15px; | ||
$size: 20px; | ||
$padding: $size - $handle-size; | ||
|
||
phred-scale-gizmo { | ||
position: absolute; | ||
display: block; | ||
box-sizing: border-box; | ||
width: $size; | ||
height: $size; | ||
margin: -($size + $handle-size * 0.5)/2; | ||
background-color: transparent; | ||
pointer-events: all; | ||
|
||
.handle { | ||
box-sizing: border-box; | ||
width: $handle-size; | ||
height: $handle-size; | ||
background-color: chocolate; | ||
border: 1px solid white; | ||
pointer-events: none; | ||
} | ||
|
||
&.top-left { | ||
padding: $padding 0 0 $padding; | ||
top: 0; | ||
left: 0; | ||
cursor: nwse-resize; | ||
} | ||
|
||
&.top-right { | ||
padding: $padding $padding 0 0; | ||
top: 0; | ||
right: 0; | ||
cursor: nesw-resize; | ||
} | ||
|
||
&.bottom-left { | ||
padding: 0 0 $padding $padding; | ||
bottom: 0; | ||
left: 0; | ||
cursor: nesw-resize; | ||
} | ||
|
||
&.bottom-right { | ||
padding: 0 $padding $padding 0; | ||
bottom: 0; | ||
right: 0; | ||
cursor: nwse-resize; | ||
} | ||
} |
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,14 @@ | ||
import { Gizmo, GIZMO_SCALE } from './gizmo'; | ||
import './scale-gizmo.scss'; | ||
|
||
export class ScaleGizmo extends HTMLElement implements Gizmo { | ||
public static readonly tagName = 'phred-scale-gizmo'; | ||
public readonly type = GIZMO_SCALE; | ||
|
||
public init(corner: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right') { | ||
this.classList.add(corner); | ||
this.appendChild(document.createElement('div')).classList.add('handle'); | ||
} | ||
} | ||
|
||
customElements.define(ScaleGizmo.tagName, ScaleGizmo); |
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,8 @@ | ||
phred-selection-gizmo { | ||
position: absolute; | ||
display: none; | ||
padding: 0; | ||
margin: 0; | ||
border: 2px solid white; | ||
box-sizing: border-box; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface DraggingHandler { | ||
startHandling(e: MouseEvent): void; | ||
handle(e: MouseEvent): void; | ||
stopHandling(e: MouseEvent): void; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { DraggingHandler } from './dragging-handler'; | ||
|
||
export class ScaleHandler implements DraggingHandler { | ||
public startHandling(e: MouseEvent): void { | ||
} | ||
|
||
public handle(e: MouseEvent): void { | ||
} | ||
|
||
public stopHandling(e: MouseEvent): void { | ||
} | ||
} |
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
Oops, something went wrong.