From f67f03af47ac4d2e22e8cca7ccb39a0dff14ea96 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 15 Aug 2018 12:43:32 -0700 Subject: [PATCH 1/2] new multipane --- src/ui/components/controls/multipane.vue | 88 ++++++++++++++++++++++++ src/ui/components/controls/pane.vue | 71 +++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 src/ui/components/controls/multipane.vue create mode 100644 src/ui/components/controls/pane.vue diff --git a/src/ui/components/controls/multipane.vue b/src/ui/components/controls/multipane.vue new file mode 100644 index 0000000000..24f4c0e22a --- /dev/null +++ b/src/ui/components/controls/multipane.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/ui/components/controls/pane.vue b/src/ui/components/controls/pane.vue new file mode 100644 index 0000000000..5e4f0d6689 --- /dev/null +++ b/src/ui/components/controls/pane.vue @@ -0,0 +1,71 @@ + + + From 43f978e185094231d326a6e14d5d1df01d2948dd Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 15 Aug 2018 13:52:34 -0700 Subject: [PATCH 2/2] Use multipane instead of splitter --- src/ui/components/controls/multipane.vue | 132 +++++++++++++++++----- src/ui/components/controls/pane.vue | 41 +++++-- src/ui/components/layout/Layout.vue | 32 +++--- src/ui/components/layout/MctInspector.vue | 21 ++-- 4 files changed, 168 insertions(+), 58 deletions(-) diff --git a/src/ui/components/controls/multipane.vue b/src/ui/components/controls/multipane.vue index 24f4c0e22a..1043d794d3 100644 --- a/src/ui/components/controls/multipane.vue +++ b/src/ui/components/controls/multipane.vue @@ -10,66 +10,142 @@ diff --git a/src/ui/components/controls/pane.vue b/src/ui/components/controls/pane.vue index 5e4f0d6689..e62d2e006f 100644 --- a/src/ui/components/controls/pane.vue +++ b/src/ui/components/controls/pane.vue @@ -1,13 +1,20 @@ @@ -20,13 +27,34 @@ export default { validator: function (value) { return ['before', 'after'].indexOf(value) !== -1; } + }, + collapsable: Boolean + }, + data() { + return { + collapsed: false } }, mounted() { this.type = this.$parent.type; + if (this.type === 'horizontal') { + this.styleProp = 'width'; + } else { + this.styleProp = 'height'; + } this.trackSize(); }, methods: { + toggleCollapse: function () { + this.collapsed = !this.collapsed; + if (this.collapsed) { + this.currentSize = this.$el.style[this.styleProp]; + this.$el.style[this.styleProp] = ''; + } else { + this.$el.style[this.styleProp] = this.currentSize; + delete this.currentSize; + } + }, trackSize: function() { if (this.type === 'vertical') { this.initial = this.$el.offsetHeight; @@ -50,14 +78,11 @@ export default { }, updatePosition: function (event) { let size = this.getNewSize(event); - if (this.type === 'horizontal') { - this.$el.style.width = size; - } else { - this.$el.style.height = size; - } + this.$el.style[this.styleProp] = size; }, start: function (event) { this.startPosition = this.getPosition(event); + this.trackSize(); document.body.addEventListener('mousemove', this.updatePosition); document.body.addEventListener('mouseup', this.end); }, diff --git a/src/ui/components/layout/Layout.vue b/src/ui/components/layout/Layout.vue index c7a6285683..e42aee0e74 100644 --- a/src/ui/components/layout/Layout.vue +++ b/src/ui/components/layout/Layout.vue @@ -1,27 +1,31 @@