From ad7fa371dd2ddc7fe12dc61371e7206e36febf6e Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sun, 29 Sep 2019 14:28:36 +0900 Subject: [PATCH] refs #1046 Fix resize performance for sidebar --- .../components/TimelineSpace/Contents.vue | 67 +++++++++++++++---- .../TimelineSpace/Contents/SideBar.vue | 49 +++++--------- 2 files changed, 71 insertions(+), 45 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents.vue b/src/renderer/components/TimelineSpace/Contents.vue index 407f49a6..71d02fd6 100644 --- a/src/renderer/components/TimelineSpace/Contents.vue +++ b/src/renderer/components/TimelineSpace/Contents.vue @@ -1,5 +1,5 @@ @@ -25,7 +32,8 @@ export default { name: 'contents', data() { return { - sidebarWidth: 360 + sidebarWidth: 360, + dragging: false } }, components: { @@ -47,9 +55,17 @@ export default { }, methods: { resize(event) { - if (event.clientX) { + if (this.dragging && event.clientX) { this.sidebarWidth = window.innerWidth - event.clientX } + }, + dragStart() { + this.dragging = true + this.$refs.contents.style.setProperty('user-select', 'none') + }, + dragEnd() { + this.dragging = false + this.$refs.contents.style.setProperty('user-select', 'text') } } } @@ -62,6 +78,7 @@ export default { padding-top: 48px; height: 100%; box-sizing: border-box; + user-select: text; .timeline-wrapper { height: 100%; @@ -80,15 +97,26 @@ export default { } #resizer { - width: 8px; - background-color: var(--theme-border-color); - height: 72px; - position: fixed; - top: 50%; - right: calc(var(--current-sidebar-width) - 8px); - z-index: 1000; - border-radius: 0 8px 8px 0; - cursor: col-resize; + .border { + width: 1px; + background-color: var(--theme-border-color); + height: calc(100% - 48px); + position: fixed; + top: 48px; + right: var(--current-sidebar-width); + } + + .knob { + width: 8px; + background-color: var(--theme-border-color); + height: 72px; + position: fixed; + top: 50%; + right: calc(var(--current-sidebar-width) - 8px); + z-index: 1000; + border-radius: 0 8px 8px 0; + cursor: col-resize; + } } #side_bar { @@ -100,4 +128,15 @@ export default { border-left: solid 1px var(--theme-border-color); } } + +.slide-detail-enter-active, +.slide-detail-leave-active { + transition: all 0.5s; +} + +.slide-detail-enter, +.slide-detail-leave-to { + margin-right: -360px; + opacity: 0; +} diff --git a/src/renderer/components/TimelineSpace/Contents/SideBar.vue b/src/renderer/components/TimelineSpace/Contents/SideBar.vue index 5b1fab79..5418762a 100644 --- a/src/renderer/components/TimelineSpace/Contents/SideBar.vue +++ b/src/renderer/components/TimelineSpace/Contents/SideBar.vue @@ -1,25 +1,23 @@