Revert "add: avater decoration multiple select layer resolve #54"

This reverts commit 35cd4adf
This commit is contained in:
NoriDev 2023-12-13 17:29:02 +09:00
parent ee393cfba1
commit d01696fb93
6 changed files with 5 additions and 68 deletions

View file

@ -1,8 +1,6 @@
---
_lang_: "English"
cannotBeUsedFunc: "This feature is currently unavailable."
maxinumLayerError: "You cannot stack more than 6 layers. Please delete other layers."
layer: "Layer"
Xcoordinate: "X-Coordinate"
Ycoordinate: "Y-Coordinate"
scale: "Scale"

View file

@ -1,8 +1,6 @@
_lang_: "日本語"
cannotBeUsedFunc: "この機能は現在使用できません。"
maxinumLayerError: "6枚以上重ねることはできません。他のレイヤーを削除してください。"
layer: "レイヤー"
Xcoordinate: "X座標"
Ycoordinate: "Y座標"
scale: "大きさ"

View file

@ -1,7 +1,5 @@
---
_lang_: "日本語 (関西弁)"
maxinumLayerError: "6枚以上重ねられんで。他のレイヤーを削除してなー"
layer: "レイヤー"
headlineMisskey: "ノートでつながるネットワーク"
introMisskey: "ようお越しCherryPickは、オープンソースの分散型マイクロブログサービスやねん。\n「ート」を作って、いま起こっとることを共有したり、あんたについて皆に発信しよう📡\n「ツッコミ」機能で、皆のートに素早く反応を追加したりもできるで✌\nほな、新しい世界を探検しよか🚀"
poweredByMisskeyDescription: "{name}は、オープンソースのプラットフォーム<b>CherryPick</b>のサーバーのひとつなんやで。"

View file

@ -137,7 +137,7 @@ export const paramDef = {
birthday: { ...birthdaySchema, nullable: true },
lang: { type: 'string', enum: [null, ...Object.keys(langmap)] as string[], nullable: true },
avatarId: { type: 'string', format: 'misskey:id', nullable: true },
avatarDecorations: { type: 'array', maxItems: 5, items: {
avatarDecorations: { type: 'array', maxItems: 1, items: {
type: 'object',
properties: {
id: { type: 'string', format: 'misskey:id' },

View file

@ -20,14 +20,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkAvatar style="width: 64px; height: 64px; margin-bottom: 20px;" :user="$i" :decoration="{ url: decoration.url, angle, flipH, scale, moveX, moveY, opacity }" forceShowDecoration/>
</div>
<div class="_gaps_s">
<MkRadios v-model="insertLayer">
<template #label>{{ i18n.ts.layer }}</template>
<option value="0">1</option>
<option value="1">2</option>
<option value="2">3</option>
<option value="3">4</option>
<option value="4">5</option>
</MkRadios>
<MkRange v-model="angle" continuousUpdate :min="-0.5" :max="0.5" :step="0.025" :textConverter="(v) => `${Math.floor(v * 360)}°`">
<template #label>{{ i18n.ts.angle }}</template>
</MkRange>
@ -61,7 +53,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { shallowRef, ref, computed } from 'vue';
import MkButton from '@/components/MkButton.vue';
import MkRadios from '@/components/MkRadios.vue';
import MkModalWindow from '@/components/MkModalWindow.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { i18n } from '@/i18n.js';
@ -84,18 +75,6 @@ const emit = defineEmits<{
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
const using = computed(() => $i.avatarDecorations.some(x => x.id === props.decoration.id));
const layerNum = (() => {
let result = -1;
$i.avatarDecorations.some((x, i) => {
if (x.id === props.decoration.id) {
result = i;
return true;
}
return false;
});
return result;
})();
const insertLayer = ref(layerNum === -1 ? String($i.avatarDecorations.length) : String(layerNum));
const angle = ref(using.value ? $i.avatarDecorations.find(x => x.id === props.decoration.id).angle ?? 0 : 0);
const flipH = ref(using.value ? $i.avatarDecorations.find(x => x.id === props.decoration.id).flipH ?? false : false);
const scale = ref(using.value ? $i.avatarDecorations.find(x => x.id === props.decoration.id).scale ?? 1 : 1);
@ -117,22 +96,19 @@ async function attach() {
moveY: moveY.value,
opacity: opacity.value,
};
const updatedDecorations = $i.avatarDecorations.toSpliced(layerNum, layerNum === -1 ? 0 : 1).toSpliced(Number(insertLayer.value), 0, decoration);
await os.apiWithDialog('i/update', {
avatarDecorations: updatedDecorations,
avatarDecorations: [decoration],
});
$i.avatarDecorations = updatedDecorations;
$i.avatarDecorations = [decoration];
dialog.value.close();
}
async function detach() {
if (layerNum === -1) return;
const deletedDecorations = $i.avatarDecorations.toSpliced(layerNum, 1);
await os.apiWithDialog('i/update', {
avatarDecorations: deletedDecorations,
avatarDecorations: [],
});
$i.avatarDecorations = deletedDecorations;
$i.avatarDecorations = [];
dialog.value.close();
}

View file

@ -97,7 +97,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.avatarDecorationName"><MkCondensedLine :minScale="0.5">{{ avatarDecoration.name }}</MkCondensedLine></div>
<MkAvatar style="width: 60px; height: 60px;" :user="$i" :decoration="{ url: avatarDecoration.url }" forceShowDecoration/>
<i v-if="avatarDecoration.roleIdsThatCanBeUsedThisDecoration.length > 0 && !$i.roles.some(r => avatarDecoration.roleIdsThatCanBeUsedThisDecoration.includes(r.id))" :class="$style.avatarDecorationLock" class="ti ti-lock"></i>
<span v-if="$i.avatarDecorations.some(x => x.id === avatarDecoration.id)" :class="$style.layerNum">{{ indexOfDecoration(v => v.id === avatarDecoration.id) + 1 }}</span>
</div>
</div>
</MkFolder>
@ -164,18 +163,6 @@ watch(() => profile, () => {
deep: true,
});
function indexOfDecoration(f) {
let result = -1;
$i.avatarDecorations.some((e, i) => {
if (f(e)) {
result = i;
return true;
}
return false;
});
return result;
}
const fields = ref($i?.fields.map(field => ({ id: Math.random().toString(), name: field.name, value: field.value })) ?? []);
const fieldEditMode = ref(false);
@ -293,14 +280,6 @@ function changeBanner(ev) {
}
function openDecoration(avatarDecoration) {
if (indexOfDecoration(v => v.id === avatarDecoration.id) === -1 && $i.avatarDecorations.length >= 5) {
os.alert({
type: 'error',
title: i18n.ts.error,
text: i18n.ts.maxinumLayerError,
});
return;
}
os.popup(defineAsyncComponent(() => import('./profile.avatar-decoration-dialog.vue')), {
decoration: avatarDecoration,
}, {}, 'closed');
@ -439,16 +418,4 @@ definePageMetadata({
bottom: 12px;
right: 12px;
}
.layerNum {
position: absolute;
left: 0;
top: 0;
margin: 10px;
color: var(--accent);
border: solid 1px var(--accent);
padding: 0 5px;
border-radius: 4px;
font-weight: bold;
}
</style>