-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lot of code, some chunky refactors, but FX Presets
- Loading branch information
1 parent
bd8f7ba
commit 6716c3a
Showing
14 changed files
with
433 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<template> | ||
<div v-show="is_active"> | ||
<ul ref="menuList" class="context-menu" v-click-outside="onClickOutside"> | ||
<li v-for="(option, index) in options" :key="index" @click.stop="optionClicked(option)" class="item"> | ||
<span v-html="option.name"/> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "DropMenu", | ||
emits: ['menu-closed', 'option-clicked'], | ||
props: { | ||
options: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
identifier: null, | ||
is_active: false, | ||
}; | ||
}, | ||
methods: { | ||
showMenu(event, identifier, scrollTop) { | ||
if (scrollTop === undefined) { | ||
scrollTop = 0; | ||
} | ||
let positionElement = event.target; | ||
// If it's an SVG or Path, we need to locate the containing div.. | ||
let found = false; | ||
while (!found) { | ||
if (positionElement.nodeName === "svg" || positionElement.nodeName === "path") { | ||
positionElement = positionElement.parentNode; | ||
continue; | ||
} | ||
found = true; | ||
} | ||
// We want to pop out from the right of whatever element was pressed, note that scrollTop has | ||
// to be considered, otherwise it'll pop low on scrollers. | ||
let left = positionElement.offsetLeft; | ||
let top = positionElement.offsetTop - scrollTop; | ||
// Now we need to position it to the bottom right of the element clicked.. | ||
left += (positionElement.clientWidth); | ||
top += (positionElement.clientHeight / 2); | ||
this.identifier = identifier; | ||
const menu = this.$refs.menuList; | ||
let menuWidth = menu.offsetWidth; | ||
let menuHeight = menu.offsetHeight; | ||
let leftPosition = left + "px"; | ||
let topPosition = top + "px"; | ||
// Check if the Menu will break the window boundaries, and flip side if so. | ||
if (menuWidth + left >= window.innerWidth) { | ||
leftPosition = (left - menuWidth) + 'px'; | ||
} | ||
if (menuHeight + top >= window.innerHeight) { | ||
topPosition = (top - menuHeight) + 'px'; | ||
} | ||
// Set the Position.. | ||
menu.style.left = leftPosition; | ||
menu.style.top = topPosition; | ||
// Activate the Menu.. | ||
this.is_active = true; | ||
}, | ||
hideContextMenu() { | ||
this.is_active = false; | ||
this.$emit('menu-closed'); | ||
}, | ||
onClickOutside() { | ||
this.hideContextMenu(); | ||
}, | ||
optionClicked(option) { | ||
this.hideContextMenu(); | ||
this.$emit('option-clicked', { | ||
item: this.identifier, | ||
option: option, | ||
}); | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.context-menu { | ||
background-color: #252927; | ||
color: #fff; | ||
border: 1px solid #6e7676; | ||
list-style: none; | ||
position: absolute; | ||
left: 0; | ||
margin: 0; | ||
padding: 0; | ||
top: 0; | ||
z-index: 1000000; | ||
} | ||
.context-menu .item { | ||
align-items: center; | ||
color: #fff; | ||
cursor: pointer; | ||
display: flex; | ||
padding: 5px 15px; | ||
} | ||
.context-menu .item:hover { | ||
background-color: #59b1b6; | ||
color: white; | ||
} | ||
ul:first-child { | ||
margin-top: 4px; | ||
} | ||
ul:last-child { | ||
margin-bottom: 4px; | ||
} | ||
</style> |
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,24 @@ | ||
<template> | ||
<button class="modal-button"><slot /></button> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "ModalButton" | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.modal-button { | ||
background-color: #353937; | ||
color: #fff; | ||
padding: 8px 30px; | ||
border: none; | ||
margin: 8px; | ||
width: 120px; | ||
} | ||
.modal-button:hover { | ||
background-color: #737775; | ||
} | ||
</style> |
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 @@ | ||
<template> | ||
<input ref="inputBox" class="text" :value="modelValue" type="text" | ||
@input="$emit('update:modelValue', $event.target.value)" | ||
v-on:keyup.enter="$emit('on-enter')" | ||
:placeholder="placeholder" /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "ModalInput", | ||
props: { | ||
modelValue: String, | ||
placeholder: String, | ||
}, | ||
methods: { | ||
focusInput() { | ||
this.$refs.inputBox.focus(); | ||
}, | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
input[type=text] { | ||
width: calc(100% - 10px); | ||
background-color: #2B2F2D; | ||
border: 1px solid #3b413f; | ||
padding: 5px; | ||
color: #fff; | ||
} | ||
</style> |
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.