mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-18 07:48:02 +08:00
* unfinished implementation * Add frontend for the empty panel screen * Add an icon for Folder based on NodeFolder * fixed messages causing peicees of ui not to render on new document * Standardize nextTick syntax * WIP generisization of component subscriptions (not compiling yet) * Fix crash when loading font and there is no active document * Only advertise tool actions with a document * Fix failure to create new document * Initalise the properties panel * Fix highlight tab, canvas jump, warns and layer tree * Fix tests * Possibly fix some things? * Move WorkingColors layout definition to backend * Standardize action macro formatting * Provide typing for widgets in TS/Vue and associated cleanup * Fix viewport positioning initialization * Fix menu bar init at startup not document creation * Fix no viewport bounds bug * Change !=0 to >0 * Simplify the init system Closes #656 Co-authored-by: Keavon Chambers <keavon@keavon.com> Co-authored-by: 0hypercube <0hypercube@gmail.com>
94 lines
1.9 KiB
Vue
94 lines
1.9 KiB
Vue
<template>
|
|
<LayoutRow class="radio-input">
|
|
<button :class="{ active: index === selectedIndex }" v-for="(entry, index) in entries" :key="index" @click="() => handleEntryClick(entry)" :title="entry.tooltip">
|
|
<IconLabel v-if="entry.icon" :icon="entry.icon" />
|
|
<TextLabel v-if="entry.label">{{ entry.label }}</TextLabel>
|
|
</button>
|
|
</LayoutRow>
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
.radio-input {
|
|
button {
|
|
background: var(--color-5-dullgray);
|
|
fill: var(--color-e-nearwhite);
|
|
height: 24px;
|
|
padding: 0 4px;
|
|
outline: none;
|
|
border: none;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
&:hover {
|
|
background: var(--color-6-lowergray);
|
|
color: var(--color-f-white);
|
|
|
|
svg {
|
|
fill: var(--color-f-white);
|
|
}
|
|
}
|
|
|
|
&.active {
|
|
background: var(--color-accent);
|
|
color: var(--color-f-white);
|
|
|
|
svg {
|
|
fill: var(--color-f-white);
|
|
}
|
|
}
|
|
|
|
& + button {
|
|
margin-left: 1px;
|
|
}
|
|
|
|
&:first-of-type {
|
|
border-radius: 2px 0 0 2px;
|
|
}
|
|
|
|
&:last-of-type {
|
|
border-radius: 0 2px 2px 0;
|
|
}
|
|
}
|
|
|
|
.text-label {
|
|
margin: 0 4px;
|
|
}
|
|
|
|
&.combined-before button:first-of-type,
|
|
&.combined-after button:last-of-type {
|
|
border-radius: 0;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, PropType } from "vue";
|
|
|
|
import { RadioEntries, RadioEntryData } from "@/wasm-communication/messages";
|
|
|
|
import LayoutRow from "@/components/layout/LayoutRow.vue";
|
|
import IconLabel from "@/components/widgets/labels/IconLabel.vue";
|
|
import TextLabel from "@/components/widgets/labels/TextLabel.vue";
|
|
|
|
export default defineComponent({
|
|
emits: ["update:selectedIndex"],
|
|
props: {
|
|
entries: { type: Array as PropType<RadioEntries>, required: true },
|
|
selectedIndex: { type: Number as PropType<number>, required: true },
|
|
},
|
|
methods: {
|
|
handleEntryClick(menuEntry: RadioEntryData) {
|
|
const index = this.entries.indexOf(menuEntry);
|
|
this.$emit("update:selectedIndex", index);
|
|
|
|
menuEntry.action?.();
|
|
},
|
|
},
|
|
components: {
|
|
IconLabel,
|
|
TextLabel,
|
|
LayoutRow,
|
|
},
|
|
});
|
|
</script>
|