From 53f5fdabe532f18e8d56bbfe876bb2397872d954 Mon Sep 17 00:00:00 2001 From: David 'Epper' Marshall Date: Mon, 15 Nov 2021 14:25:57 -0500 Subject: [PATCH] Mct4207 (#4366) * MCT 4207 * fix lint Co-authored-by: Jamie V Co-authored-by: Shefali Joshi --- .../components/DisplayLayout.vue | 22 ++++++++++++++++++- .../components/DisplayLayoutGrid.vue | 10 +++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/plugins/displayLayout/components/DisplayLayout.vue b/src/plugins/displayLayout/components/DisplayLayout.vue index c6a6115b93..a7b21e7f0a 100644 --- a/src/plugins/displayLayout/components/DisplayLayout.vue +++ b/src/plugins/displayLayout/components/DisplayLayout.vue @@ -35,6 +35,7 @@ v-if="isEditing" :grid-size="gridSize" :show-grid="showGrid" + :grid-dimensions="gridDimensions" />
{ + if (item.x + item.width > wMax) { + wMax = item.x + item.width + 2; + } + + if (item.y + item.height > hMax) { + hMax = item.y + item.height + 2; + } + }); + this.gridDimensions = [wMax * this.gridSize[0], hMax * this.gridSize[1]]; + }, + deep: true } }, mounted() { @@ -213,6 +232,7 @@ export default { this.composition.on('add', this.addChild); this.composition.on('remove', this.removeChild); this.composition.load(); + this.gridDimensions = [this.$el.offsetWidth, this.$el.scrollHeight]; }, destroyed: function () { this.openmct.selection.off('change', this.setSelection); diff --git a/src/plugins/displayLayout/components/DisplayLayoutGrid.vue b/src/plugins/displayLayout/components/DisplayLayoutGrid.vue index e6127277cd..315ccbff01 100644 --- a/src/plugins/displayLayout/components/DisplayLayoutGrid.vue +++ b/src/plugins/displayLayout/components/DisplayLayoutGrid.vue @@ -6,12 +6,12 @@
@@ -28,6 +28,12 @@ export default { showGrid: { type: Boolean, required: true + }, + gridDimensions: { + type: Array, + required: true, + validator: (arr) => arr && arr.length === 2 + && arr.every(el => typeof el === 'number') } } };