-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(actions): implement preliminary flip/rotate dialog
- Loading branch information
1 parent
b9451bf
commit e1e3aaa
Showing
4 changed files
with
117 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export class FlipRotateAction { | ||
execute() { | ||
const app = document.querySelector('paint-app').shadowRoot; | ||
const dialog = document.createElement('paint-dialog-flip-and-rotate'); | ||
dialog.addEventListener('close', () => { | ||
app.removeChild(dialog); | ||
}); | ||
app.appendChild(dialog); | ||
} | ||
} |
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,104 @@ | ||
import { css, html, LitElement } from '../../web_modules/lit-element.js'; | ||
import { renderMnemonic } from '../../helpers/render-mnemonic.js'; | ||
|
||
export class FlipAndRotate extends LitElement { | ||
static get styles() { | ||
return css` | ||
:host { | ||
position: absolute; | ||
left: 0; | ||
bottom: 0; | ||
top: 0; | ||
right: 0; | ||
} | ||
.content { | ||
display: flex; | ||
padding: 13px; | ||
} | ||
.options { | ||
width: 174px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.options input[name='degree'] { | ||
margin-left: 50px; | ||
} | ||
.buttons { | ||
width: 75px; | ||
display: flex; | ||
flex-direction: column; | ||
margin-left: 8px; | ||
} | ||
.buttons button { | ||
margin-bottom: 5px; | ||
} | ||
span.mnemonic { | ||
text-decoration: underline; | ||
} | ||
`; | ||
} | ||
|
||
render() { | ||
return html` | ||
<paint-window caption="Flip and Rotate"> | ||
<div class="content"> | ||
<div> | ||
<fieldset> | ||
<legend>Flip and Rotate</legend> | ||
<div class="options"> | ||
<label | ||
><input type="radio" name="mode" disabled /> ${renderMnemonic( | ||
'Flip horizontal', | ||
'F', | ||
)}</label | ||
> | ||
<label | ||
><input type="radio" name="mode" disabled /> ${renderMnemonic( | ||
'Flip vertical', | ||
'v', | ||
)}</label | ||
> | ||
<label | ||
><input type="radio" name="mode" disabled /> ${renderMnemonic( | ||
'Rotate by angle', | ||
'R', | ||
)}</label | ||
> | ||
<label | ||
><input type="radio" name="degree" disabled /> | ||
${renderMnemonic('90°', '9')}</label | ||
> | ||
<label | ||
><input type="radio" name="degree" disabled /> | ||
${renderMnemonic('180°', '1')}</label | ||
> | ||
<label | ||
><input type="radio" name="degree" disabled /> | ||
${renderMnemonic('270°', '2')}</label | ||
> | ||
</div> | ||
</fieldset> | ||
</div> | ||
<div class="buttons"> | ||
<button @click="${this.onCancel}">OK</button> | ||
<button @click="${this.onCancel}">Cancel</button> | ||
</div> | ||
</div> | ||
</paint-window> | ||
`; | ||
} | ||
|
||
onCancel() { | ||
this.dispatchEvent( | ||
new CustomEvent('close', { bubbles: true, composed: true }), | ||
); | ||
} | ||
} | ||
|
||
customElements.define('paint-dialog-flip-and-rotate', FlipAndRotate); |
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