From 8c73360e417a32ad5730881fa7b082294c4602a2 Mon Sep 17 00:00:00 2001 From: Jason Henriquez Date: Wed, 22 Nov 2023 22:16:02 -0600 Subject: [PATCH 1/2] Revert "* Make tooltip auto-wrap" This reverts commit 7d932b936c7814349e50204a7979d2d0f5b0ea73. --- .../components/ft-tooltip/ft-tooltip.css | 10 +++-- .../components/ft-tooltip/ft-tooltip.js | 45 +------------------ .../components/ft-tooltip/ft-tooltip.vue | 2 - 3 files changed, 8 insertions(+), 49 deletions(-) diff --git a/src/renderer/components/ft-tooltip/ft-tooltip.css b/src/renderer/components/ft-tooltip/ft-tooltip.css index e0f5ba3b5..304b6f9b6 100644 --- a/src/renderer/components/ft-tooltip/ft-tooltip.css +++ b/src/renderer/components/ft-tooltip/ft-tooltip.css @@ -93,11 +93,13 @@ } .text.allowNewlines { - white-space: pre; - text-align: start; -} -.text.allowNewlines.wrap { white-space: pre-wrap; + text-align: start; + + @media only screen and (min-width: 1000px) { + /* Enough space to NOT wrap */ + white-space: pre; + } } .tooltip { diff --git a/src/renderer/components/ft-tooltip/ft-tooltip.js b/src/renderer/components/ft-tooltip/ft-tooltip.js index bf2c5334a..66ba1d1dd 100644 --- a/src/renderer/components/ft-tooltip/ft-tooltip.js +++ b/src/renderer/components/ft-tooltip/ft-tooltip.js @@ -2,26 +2,6 @@ import { defineComponent } from 'vue' let idCounter = 0 -function isOutOfViewport(el) { - if (el == null) { return {} } - - const bounding = el.getBoundingClientRect() - const out = {} - - out.top = bounding.top < 0 - out.left = bounding.left < 0 - out.bottom = bounding.bottom > (window.innerHeight || document.documentElement.clientHeight) - out.right = bounding.right > (window.innerWidth || document.documentElement.clientWidth) - out.horizontal = out.left || out.right - out.veritical = out.top || out.bottom - out.any = out.top || out.left || out.bottom || out.right - out.all = out.top && out.left && out.bottom && out.right - - out.bounding = bounding - - return out -} - export default defineComponent({ name: 'FtTooltip', props: { @@ -43,28 +23,7 @@ export default defineComponent({ const id = `ft-tooltip-${++idCounter}` return { - id, - isTooltipOutOfViewportResult: {} + id } - }, - computed: { - tooltipOutsideViewPort() { - return this.isTooltipOutOfViewportResult.horizontal - }, - }, - mounted() { - this.updateSizeRelatedStates() - window.addEventListener('resize', this.updateSizeRelatedStates) - }, - destroyed() { - window.removeEventListener('resize', this.updateSizeRelatedStates) - }, - methods: { - updateSizeRelatedStates() { - if (this.allowNewlines) { - // Only when newlines allowed have issue with wrapping - this.isTooltipOutOfViewportResult = isOutOfViewport(this.$refs.tooltip) - } - }, - }, + } }) diff --git a/src/renderer/components/ft-tooltip/ft-tooltip.vue b/src/renderer/components/ft-tooltip/ft-tooltip.vue index 6996d2836..494ee5af1 100644 --- a/src/renderer/components/ft-tooltip/ft-tooltip.vue +++ b/src/renderer/components/ft-tooltip/ft-tooltip.vue @@ -9,12 +9,10 @@