mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
* ability to mark an open document as unsaved * unsaved detection now being triggered based on layer tree height * Changed responses to use classes instead of interfaces * - rust implementation of unsaved markers - upgraded eslint * updated eslint in package.json * - Renamed GetOpenDocumentsList -> UpdateOpenDocumentsList - is not -> was not * changed hash to current identifier to better reflect its meaning * resolve some merge conflicts * removed console.log statement leftover from debuging * - changed Response to jsMessage - split files - Array<> -> [] * -remove path from UpdateLayer * - remove unused if statements * - comment for reflect-metadata - registerJsMessageHandler -> subscribeJsMessage - readonly message properties - fixed binding filename and comment - toRgb -> toRgba * - newOpacity -> transformer - added comments * MessageMaker -> messageMaker
104 lines
2.0 KiB
Vue
104 lines
2.0 KiB
Vue
<template>
|
|
<div class="radio-input" ref="radioInput">
|
|
<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>
|
|
</div>
|
|
</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: inline-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;
|
|
}
|
|
}
|
|
|
|
.icon-label,
|
|
.text-label {
|
|
display: inline-block;
|
|
}
|
|
|
|
.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 IconLabel from "@/components/widgets/labels/IconLabel.vue";
|
|
import TextLabel from "@/components/widgets/labels/TextLabel.vue";
|
|
|
|
export interface RadioEntryData {
|
|
value?: string;
|
|
label?: string;
|
|
icon?: string;
|
|
tooltip?: string;
|
|
action?: () => void;
|
|
}
|
|
|
|
export type RadioEntries = RadioEntryData[];
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
entries: { type: Array as PropType<RadioEntries>, required: true },
|
|
selectedIndex: { type: Number, required: true },
|
|
},
|
|
methods: {
|
|
handleEntryClick(menuEntry: RadioEntryData) {
|
|
const index = this.entries.indexOf(menuEntry);
|
|
this.$emit("update:selectedIndex", index);
|
|
|
|
if (menuEntry.action) menuEntry.action();
|
|
},
|
|
},
|
|
components: {
|
|
IconLabel,
|
|
TextLabel,
|
|
},
|
|
});
|
|
</script>
|