Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/misskey-dev/misskey into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
noridev committed Dec 13, 2023
2 parents 9df37ca + 37820ad commit 6e723db
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
- Fix: チャンネルのノート一覧にてインスタンスミュートが効かない問題
- Fix: 「みつける」が年越し時に壊れる問題を修正
- Fix: アカウントをブロックした際に、自身のユーザーのページでノートが相手に表示される問題を修正
- Fix: モデレーションログがモデレーターは閲覧できないように修正

## 2023.11.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const meta = {
tags: ['admin'],

requireCredential: true,
requireModerator: true,
requireAdmin: true,

res: {
type: 'array',
Expand Down
32 changes: 27 additions & 5 deletions packages/frontend/src/components/MkAnimBg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ const props = withDefaults(defineProps<{
focus: 1.0,
});

function loadShader(gl, type, source) {
function loadShader(gl: WebGLRenderingContext, type: number, source: string) {
const shader = gl.createShader(type);
if (shader == null) return null;

gl.shaderSource(shader, source);
gl.compileShader(shader);
Expand All @@ -38,11 +39,13 @@ function loadShader(gl, type, source) {
return shader;
}

function initShaderProgram(gl, vsSource, fsSource) {
function initShaderProgram(gl: WebGLRenderingContext, vsSource: string, fsSource: string) {
const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource);
const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource);

const shaderProgram = gl.createProgram();
if (shaderProgram == null || vertexShader == null || fragmentShader == null) return null;

gl.attachShader(shaderProgram, vertexShader);
gl.attachShader(shaderProgram, fragmentShader);
gl.linkProgram(shaderProgram);
Expand All @@ -63,8 +66,10 @@ let handle: ReturnType<typeof window['requestAnimationFrame']> | null = null;

onMounted(() => {
const canvas = canvasEl.value!;
canvas.width = canvas.offsetWidth;
canvas.height = canvas.offsetHeight;
let width = canvas.offsetWidth;
let height = canvas.offsetHeight;
canvas.width = width;
canvas.height = height;

const gl = canvas.getContext('webgl', { premultipliedAlpha: true });
if (gl == null) return;
Expand Down Expand Up @@ -197,6 +202,7 @@ onMounted(() => {
gl_FragColor = vec4( color, max(max(color.x, color.y), color.z) );
}
`);
if (shaderProgram == null) return;

gl.useProgram(shaderProgram);
const u_resolution = gl.getUniformLocation(shaderProgram, 'u_resolution');
Expand Down Expand Up @@ -226,7 +232,23 @@ onMounted(() => {
gl!.uniform1f(u_time, 0);
gl!.drawArrays(gl!.TRIANGLE_STRIP, 0, 4);
} else {
function render(timeStamp) {
function render(timeStamp: number) {
let sizeChanged = false;
if (Math.abs(height - canvas.offsetHeight) > 2) {
height = canvas.offsetHeight;
canvas.height = height;
sizeChanged = true;
}
if (Math.abs(width - canvas.offsetWidth) > 2) {
width = canvas.offsetWidth;
canvas.width = width;
sizeChanged = true;
}
if (sizeChanged && gl) {
gl.uniform2fv(u_resolution, [width, height]);
gl.viewport(0, 0, width, height);
}

gl!.uniform1f(u_time, timeStamp);
gl!.drawArrays(gl!.TRIANGLE_STRIP, 0, 4);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,21 @@ async function attach() {
moveY: moveY.value,
opacity: opacity.value,
};
const update = [...$i.avatarDecorations, decoration];
await os.apiWithDialog('i/update', {
avatarDecorations: [...$i.avatarDecorations, decoration],
avatarDecorations: update,
});
$i.avatarDecorations = [...$i.avatarDecorations, decoration];
$i.avatarDecorations = update;

dialog.value.close();
}

async function detach() {
const update = $i.avatarDecorations.filter(x => x.id !== props.decoration.id);
await os.apiWithDialog('i/update', {
avatarDecorations: $i.avatarDecorations.filter(x => x.id !== props.decoration.id),
avatarDecorations: update,
});
$i.avatarDecorations = $i.avatarDecorations.filter(x => x.id !== props.decoration.id);
$i.avatarDecorations = update;

dialog.value.close();
}
Expand Down

0 comments on commit 6e723db

Please sign in to comment.