Show pin on pinned tooltips

This commit is contained in:
thepaperpilot 2022-04-23 14:48:25 -05:00
parent bef5272ab5
commit f04cb69726
2 changed files with 17 additions and 2 deletions

View file

@ -23,6 +23,7 @@ export interface Theme {
variables: ThemeVars; variables: ThemeVars;
floatingTabs: boolean; floatingTabs: boolean;
mergeAdjacent: boolean; mergeAdjacent: boolean;
showPin: boolean;
} }
declare module "@vue/runtime-dom" { declare module "@vue/runtime-dom" {
@ -53,7 +54,8 @@ const defaultTheme: Theme = {
"--feature-margin": "0px" "--feature-margin": "0px"
}, },
floatingTabs: true, floatingTabs: true,
mergeAdjacent: true mergeAdjacent: true,
showPin: true
}; };
export enum Themes { export enum Themes {

View file

@ -24,6 +24,7 @@
'--yoffset': unref(yoffset) || '0px' '--yoffset': unref(yoffset) || '0px'
}" }"
> >
<span v-if="showPin" class="material-icons pinned">push_pin</span>
<component v-if="comp" :is="comp" /> <component v-if="comp" :is="comp" />
</div> </div>
</transition> </transition>
@ -31,8 +32,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import themes from "data/themes";
import { CoercableComponent, jsx, StyleValue } from "features/feature"; import { CoercableComponent, jsx, StyleValue } from "features/feature";
import { Persistent } from "game/persistence"; import { Persistent } from "game/persistence";
import settings from "game/settings";
import { import {
coerceComponent, coerceComponent,
computeOptionalComponent, computeOptionalComponent,
@ -93,6 +96,8 @@ export default defineComponent({
} }
} }
const showPin = computed(() => unwrapRef(pinned) && themes[settings.theme].showPin);
return { return {
TooltipDirection, TooltipDirection,
isHovered, isHovered,
@ -100,7 +105,8 @@ export default defineComponent({
comp, comp,
elementComp, elementComp,
unref, unref,
togglePinned togglePinned,
showPin
}; };
} }
}); });
@ -210,4 +216,11 @@ export default defineComponent({
margin-top: -10px; margin-top: -10px;
border-color: transparent transparent var(--tooltip-background) transparent; border-color: transparent transparent var(--tooltip-background) transparent;
} }
.pinned {
position: absolute;
right: -5px;
top: -5px;
transform: rotateZ(45deg);
}
</style> </style>