From 6169acd478e9206eec65cf836ed8ff9dfa5302e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Tue, 17 Jul 2018 18:43:04 +0900 Subject: [PATCH 1/3] Update analog-clock.vue --- .../common/views/components/analog-clock.vue | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/client/app/common/views/components/analog-clock.vue b/src/client/app/common/views/components/analog-clock.vue index 53fb2a8da..d3a365b15 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); + enabled = false; }, methods: { From 4a25ed06276fb1cd18e5f5b43f686fbfb643957e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 17 Jul 2018 18:50:13 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=8C=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/views/components/analog-clock.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/analog-clock.vue b/src/client/app/common/views/components/analog-clock.vue index d3a365b15..e86a7567b 100644 --- a/src/client/app/common/views/components/analog-clock.vue +++ b/src/client/app/common/views/components/analog-clock.vue @@ -119,7 +119,7 @@ export default Vue.extend({ }, beforeDestroy() { - enabled = false; + this.enabled = false; }, methods: { From a3d34ba919796cb86e2db75c17c961eaa872b7fc Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 17 Jul 2018 15:08:22 +0000 Subject: [PATCH 3/3] fix(package): update vue-loader to version 15.2.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 079f10496..1c3b57b6c 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",