style: rename
This commit is contained in:
parent
0af76f7dfa
commit
7fb1a3fc81
|
@ -77,7 +77,7 @@
|
||||||
import { computed, onMounted, onBeforeUnmount, ref } from 'vue';
|
import { computed, onMounted, onBeforeUnmount, ref } from 'vue';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
import { globalEvents } from '@/events.js';
|
import { globalEvents } from '@/events.js';
|
||||||
import { defaultIdleRender } from '@/scripts/idle-render.js';
|
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/1878907/how-can-i-find-the-difference-between-two-angles
|
// https://stackoverflow.com/questions/1878907/how-can-i-find-the-difference-between-two-angles
|
||||||
const angleDiff = (a: number, b: number) => {
|
const angleDiff = (a: number, b: number) => {
|
||||||
|
@ -165,7 +165,7 @@ function tick() {
|
||||||
mAngle = Math.PI * (m + s / 60) / 30;
|
mAngle = Math.PI * (m + s / 60) / 30;
|
||||||
if (sOneRound && sLine.value) { // 秒針が一周した際のアニメーションをよしなに処理する(これが無いと秒が59->0になったときに期待したアニメーションにならない)
|
if (sOneRound && sLine.value) { // 秒針が一周した際のアニメーションをよしなに処理する(これが無いと秒が59->0になったときに期待したアニメーションにならない)
|
||||||
sAngle = Math.PI * 60 / 30;
|
sAngle = Math.PI * 60 / 30;
|
||||||
defaultIdleRender.delete(tick);
|
defaultIdlingRenderScheduler.delete(tick);
|
||||||
sLine.value.addEventListener('transitionend', () => {
|
sLine.value.addEventListener('transitionend', () => {
|
||||||
disableSAnimate = true;
|
disableSAnimate = true;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
|
@ -173,7 +173,7 @@ function tick() {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
disableSAnimate = false;
|
disableSAnimate = false;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
defaultIdleRender.add(tick);
|
defaultIdlingRenderScheduler.add(tick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -201,13 +201,13 @@ function calcColors() {
|
||||||
calcColors();
|
calcColors();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
defaultIdleRender.add(tick);
|
defaultIdlingRenderScheduler.add(tick);
|
||||||
globalEvents.on('themeChanged', calcColors);
|
globalEvents.on('themeChanged', calcColors);
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
defaultIdleRender.delete(tick);
|
defaultIdlingRenderScheduler.delete(tick);
|
||||||
globalEvents.off('themeChanged', calcColors);
|
globalEvents.off('themeChanged', calcColors);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
import { defaultIdleRender } from '@/scripts/idle-render.js';
|
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
showS?: boolean;
|
showS?: boolean;
|
||||||
|
@ -55,11 +55,11 @@ const tick = (): void => {
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
defaultIdleRender.add(tick);
|
defaultIdlingRenderScheduler.add(tick);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
defaultIdleRender.delete(tick);
|
defaultIdlingRenderScheduler.delete(tick);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import { onUnmounted } from 'vue';
|
import { onUnmounted } from 'vue';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { dateTimeFormat } from '@/scripts/intl-const';
|
import { dateTimeFormat } from '@/scripts/intl-const';
|
||||||
import { defaultIdleRender } from '@/scripts/idle-render.js';
|
import { defaultIdlingRenderScheduler } from '@/scripts/idle-render.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
time: Date | string | number | null;
|
time: Date | string | number | null;
|
||||||
|
@ -52,10 +52,10 @@ function tick(): void {
|
||||||
|
|
||||||
if (props.mode === 'relative' || props.mode === 'detail') {
|
if (props.mode === 'relative' || props.mode === 'detail') {
|
||||||
tick();
|
tick();
|
||||||
defaultIdleRender.add(tick);
|
defaultIdlingRenderScheduler.add(tick);
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
defaultIdleRender.delete(tick);
|
defaultIdlingRenderScheduler.delete(tick);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default class IdleRender {
|
export default class IdlingRenderScheduler {
|
||||||
#renderers: Set<FrameRequestCallback>;
|
#renderers: Set<FrameRequestCallback>;
|
||||||
#budget: number;
|
#budget: number;
|
||||||
#rafId: number;
|
#rafId: number;
|
||||||
|
@ -38,4 +38,4 @@ export default class IdleRender {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultIdleRender = new IdleRender();
|
export const defaultIdlingRenderScheduler = new IdlingRenderScheduler();
|
||||||
|
|
Loading…
Reference in New Issue