Skip to content

Commit

Permalink
feat(landscape): add shuffle anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Dec 24, 2020
1 parent 125d1af commit 1b044c8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
4 changes: 4 additions & 0 deletions addons/landscape/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ module.exports = function (commas) {
commas.module.require('internal/landscape/landscape-slot.vue').default
)

commas.workspace.addAnchor(
commas.module.require('internal/landscape/landscape-anchor.vue').default
)

}
}
10 changes: 10 additions & 0 deletions renderer/internal/landscape/hooks.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ref } from 'vue'

export const nonceRef = ref(Date.now())
export function useNonce() {
return nonceRef
}

export function refreshLandscapeBackground() {
nonceRef.value = Date.now()
}
28 changes: 28 additions & 0 deletions renderer/internal/landscape/landscape-anchor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div class="landscape-anchor" @click="refresh">
<span class="feather-icon icon-shuffle"></span>
</div>
</template>

<script>
import { reactive, toRefs } from 'vue'
import { refreshLandscapeBackground } from './hooks.mjs'
export default {
name: 'landscape-anchor',
setup() {
const state = reactive({})
return {
...toRefs(state),
refresh: refreshLandscapeBackground,
}
},
}
</script>

<style>
.proxy-anchor.active {
color: var(--design-cyan);
}
</style>
5 changes: 3 additions & 2 deletions renderer/internal/landscape/landscape-slot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</mask>
<filter id="background-filter">
<feComponentTransfer>
<feFuncA type="linear" slope="5" intercept="-4.7" />
<feFuncA type="linear" slope="0.3" />
</feComponentTransfer>
</filter>
</defs>
Expand All @@ -35,12 +35,13 @@
<script>
import { computed, reactive, toRefs, unref } from 'vue'
import { useSettings } from '../../hooks/settings.mjs'
import { useNonce } from './hooks.mjs'
export default {
name: 'landscape-slot',
setup() {
const state = reactive({
nonce: Date.now(),
nonce: useNonce(),
})
const settingsRef = useSettings()
Expand Down

0 comments on commit 1b044c8

Please sign in to comment.