diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-18 00:47:11 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-18 00:47:11 +0900 |
| commit | b274c4160e9bd2d2b79fbb054456da4a17d92064 (patch) | |
| tree | b7dbb5f71fd45c7c15c813d44e0906623881bbe2 | |
| parent | Improve doc (diff) | |
| parent | Merge pull request #1917 from syuilo/greenkeeper/vue-loader-15.2.5 (diff) | |
| download | misskey-b274c4160e9bd2d2b79fbb054456da4a17d92064.tar.gz misskey-b274c4160e9bd2d2b79fbb054456da4a17d92064.tar.bz2 misskey-b274c4160e9bd2d2b79fbb054456da4a17d92064.zip | |
Merge branch 'master' of https://github.com/syuilo/misskey
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/client/app/common/views/components/analog-clock.vue | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/package.json b/package.json index 079f104966..1c3b57b6c8 100644 --- a/package.json +++ b/package.json @@ -205,7 +205,7 @@ "vue-cropperjs": "2.2.1", "vue-js-modal": "1.3.16", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.2.4", + "vue-loader": "15.2.5", "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", "vuedraggable": "2.16.0", diff --git a/src/client/app/common/views/components/analog-clock.vue b/src/client/app/common/views/components/analog-clock.vue index 53fb2a8dad..e86a7567bd 100644 --- a/src/client/app/common/views/components/analog-clock.vue +++ b/src/client/app/common/views/components/analog-clock.vue @@ -45,7 +45,7 @@ export default Vue.extend({ data() { return { now: new Date(), - clock: null, + enabled: true, graduationsPadding: 0.5, handsPadding: 1, @@ -74,6 +74,9 @@ export default Vue.extend({ return themeColor; }, + ms(): number { + return this.now.getMilliseconds(); + } s(): number { return this.now.getSeconds(); }, @@ -85,13 +88,13 @@ export default Vue.extend({ }, hAngle(): number { - return Math.PI * (this.h % 12 + this.m / 60) / 6; + return Math.PI * (this.h % 12 + (this.m + (this.s + this.ms / 1000) / 60) / 60) / 6; }, mAngle(): number { - return Math.PI * (this.m + this.s / 60) / 30; + return Math.PI * (this.m + (this.s + this.ms / 1000) / 60) / 30; }, sAngle(): number { - return Math.PI * this.s / 30; + return Math.PI * (this.s + this.ms / 1000) / 30; }, graduations(): any { @@ -106,11 +109,17 @@ export default Vue.extend({ }, mounted() { - this.clock = setInterval(this.tick, 1000); + const update = () => { + if (this.enabled) { + this.tick(); + requestAnimationFrame(update); + } + }); + update(); }, beforeDestroy() { - clearInterval(this.clock); + this.enabled = false; }, methods: { |