in progress
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = `
|
||||
<style>
|
||||
:host
|
||||
:host {
|
||||
position:relative;
|
||||
}
|
||||
:host(:hover) :not(.disabled)
|
||||
{
|
||||
position:absolute;
|
||||
background-color: #ffc;
|
||||
}
|
||||
img {
|
||||
border: none;
|
||||
@@ -28,12 +31,30 @@ template.innerHTML = `
|
||||
box-shadow: inset 1px 1px 2px white, 1px 1px 1px rgba(0,0,0,0.3);
|
||||
background-color: #E8E8E8;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.menu-button :hover
|
||||
{
|
||||
background-color: #ffc;
|
||||
.handle {
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
background: no-repeat url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHZpZXdCb3g9IjAgMCAzIDQiIHdpZHRoPSIzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwb2x5Z29uIGZpbGw9IiM4MDg2OEIiIHBvaW50cz0iNDg4LjI1IDY1Mi43NSA0ODYuMjUgNjU1LjI1IDQ4NC4yNSA2NTIuNzUiIHRyYW5zZm9ybT0icm90YXRlKC05MCAtODIuMjUgNTcwLjUpIi8+PC9zdmc+);
|
||||
transform: scale(2);
|
||||
position:absolute;
|
||||
bottom: 2px;
|
||||
right: 1px;
|
||||
}
|
||||
.button-icon {
|
||||
}
|
||||
.menu {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
top:-2px;
|
||||
left:32px;
|
||||
background: none !important;
|
||||
}
|
||||
.menu-item {
|
||||
display: inline;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
margin: 2px 2px 4px;
|
||||
@@ -41,55 +62,33 @@ template.innerHTML = `
|
||||
box-shadow: inset 1px 1px 2px white, 1px 1px 1px rgba(0,0,0,0.3);
|
||||
background-color: #E8E8E8;
|
||||
cursor: pointer;
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
}
|
||||
.handle {
|
||||
position: absolute;
|
||||
bottom: 6px;
|
||||
right: 3px;
|
||||
width: 3px;
|
||||
height: 4px;
|
||||
background: no-repeat url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHZpZXdCb3g9IjAgMCAzIDQiIHdpZHRoPSIzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwb2x5Z29uIGZpbGw9IiM4MDg2OEIiIHBvaW50cz0iNDg4LjI1IDY1Mi43NSA0ODYuMjUgNjU1LjI1IDQ4NC4yNSA2NTIuNzUiIHRyYW5zZm9ybT0icm90YXRlKC05MCAtODIuMjUgNTcwLjUpIi8+PC9zdmc+);
|
||||
display: block;
|
||||
transform: scale(2);
|
||||
}
|
||||
|
||||
.open .item1 {
|
||||
transition-duration: 190ms;
|
||||
transform: translate(35px);
|
||||
}
|
||||
.open .item2 {
|
||||
transition-duration: 290ms;
|
||||
transform: translate(70px);
|
||||
}
|
||||
.open .item3 {
|
||||
transition-duration: 390ms;
|
||||
transform: translate(105px);
|
||||
}
|
||||
.open .item4 {
|
||||
transition-duration: 490ms;
|
||||
transform: translate(140px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="menu-button open">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
<div class="handle"></div>
|
||||
<div class="menu-item item1" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
<div ">
|
||||
<div class="menu-button">
|
||||
<img class="button-icon" src="./images/logo.svg" alt="icon">
|
||||
<div class="handle"></div>
|
||||
</div>
|
||||
<div class="menu-item item2" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
<div class="menu-item item3" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
<div class="menu-item item4" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
<div class="menu">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
`;
|
||||
/**
|
||||
* @class FlyingButton
|
||||
@@ -106,6 +105,15 @@ export class FlyingButton extends HTMLElement {
|
||||
// locate the component
|
||||
this.$open = this._shadowRoot.querySelector('.menu-button');
|
||||
this.$img = this._shadowRoot.querySelector('img');
|
||||
// the last element of the div is the slot
|
||||
// we retrieve all elements added in the slot (i.e. se-buttons)
|
||||
this.$elements = this.$open.lastElementChild.assignedElements();
|
||||
this.$elements[0].style.transitionDuration = '190ms';
|
||||
this.$elements[0].style.transform = 'translate(2px,-3px)';
|
||||
this.$elements[1].style.transitionDuration = '`2500ms';
|
||||
this.$elements[1].style.transform = 'translate(0px,-3px)';
|
||||
this.$elements[2].style.transitionDuration = '`2500ms';
|
||||
this.$elements[2].style.transform = 'translate(0px,-3px)';
|
||||
}
|
||||
/**
|
||||
* @function observedAttributes
|
||||
@@ -124,9 +132,9 @@ export class FlyingButton extends HTMLElement {
|
||||
attributeChangedCallback (name, oldValue, newValue) {
|
||||
if (oldValue === newValue) return;
|
||||
switch (name) {
|
||||
case 'titloe':
|
||||
case 'title':
|
||||
{
|
||||
const shortcut = this.getAttribute('title');
|
||||
const shortcut = this.getAttribute('shortcut');
|
||||
this.$open.setAttribute('title', `${newValue} [${shortcut}]`);
|
||||
}
|
||||
break;
|
||||
@@ -227,3 +235,17 @@ export class FlyingButton extends HTMLElement {
|
||||
|
||||
// Register
|
||||
customElements.define('se-flyingbutton', FlyingButton);
|
||||
/*
|
||||
<div class="menu-item item1" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
<div class="menu-item item2" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
<div class="menu-item item3" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
<div class="menu-item item4" title="title">
|
||||
<img class="svg_icon" src="./images/logo.svg" alt="icon">
|
||||
</div>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user