[feat] protrait

This commit is contained in:
kwaroran
2023-11-09 14:38:58 +09:00
parent 858818923c
commit 26f51e9615
7 changed files with 32 additions and 7 deletions

View File

@@ -10,6 +10,7 @@
import { risuChatParser } from "src/ts/process/scripts";
export let message = ''
export let name = ''
export let largePortrait = false
export let isLastMemory:boolean
export let img:string|Promise<string> = ''
export let idx = -1
@@ -80,8 +81,13 @@
<div class="shadow-lg bg-textcolor2 mt-2" style={`height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
{:then m}
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
{#if largePortrait && (!$DataBase.roundIcons)}
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100 / 0.75}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
{:else}
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
{/if}
{/await}
<span class="flex flex-col ml-4 w-full max-w-full min-w-0">
<div class="flexium items-center chat">

View File

@@ -450,6 +450,7 @@
unReroll={unReroll}
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
character={$CurrentSimpleCharacter}
largePortrait={$CurrentCharacter.largePortrait}
/>
{:else}
<Chat
@@ -462,6 +463,7 @@
img={getCharImage(findCharacterbyId(chat.saying).image, 'css')}
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
character={chat.saying}
largePortrait={findCharacterbyId(chat.saying).largePortrait}
/>
{/if}
{:else}
@@ -485,6 +487,7 @@
img={getCharImage($CurrentCharacter.image, 'css')}
idx={-1}
altGreeting={$CurrentCharacter.alternateGreetings.length > 0}
largePortrait={$CurrentCharacter.largePortrait}
onReroll={() => {
const cha = $CurrentCharacter
if(cha.type !== 'group'){

View File

@@ -283,14 +283,20 @@
{#if currentChar.data.image === ''}
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" />
{:else}
{#await getCharImage(currentChar.data.image, 'css')}
{#await getCharImage(currentChar.data.image, (currentChar.type === 'character' && currentChar.data.largePortrait) ? 'lgcss' : 'css')}
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500"></div>
{:then im}
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" style={im} />
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" style={im} />
{/await}
{/if}
</button>
{#if currentChar.type === 'character' && currentChar.data.image !== ''}
<div class="flex items-center mt-4">
<Check bind:check={currentChar.data.largePortrait} name={language.largePortrait}/>
</div>
{/if}
{#if currentChar.type === 'group'}
<button
on:click={makeGroupImage}