diff options
| author | Benoit Socias <bso@odoo.com> | 2020-11-23 08:28:01 +0000 |
|---|---|---|
| committer | Benoit Socias <bso@odoo.com> | 2020-12-16 11:07:19 +0000 |
| commit | a9e221e85ba229498ef3a46180dfe2c5992bf97b (patch) | |
| tree | 0ada76810fed71466b2ec2398df2a13dcee0b897 /addons/web_tour | |
| parent | a408494c6be551e169a8eec2d76cd57acda97fee (diff) | |
[FIX] web_tour: display the full text of tour tip steps
Before this commit the dimensions of the tour tip text obtained from
the text content was forced onto the complete active tooltip, sometimes
hiding a part of the text because the complete tooltip had additional
borders that prevent the text from using the same space as during the
measurement.
After this commit the dimensions of the tour tip text is computed by
taking the measure on the full tip by temporarily switching it to the
text display during initialization.
task-2391201
closes odoo/odoo#62142
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_tour')
| -rw-r--r-- | addons/web_tour/static/src/js/tip.js | 16 | ||||
| -rw-r--r-- | addons/web_tour/static/src/xml/tip.xml | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/addons/web_tour/static/src/js/tip.js b/addons/web_tour/static/src/js/tip.js index afafd86d764..98372d33dc2 100644 --- a/addons/web_tour/static/src/js/tip.js +++ b/addons/web_tour/static/src/js/tip.js @@ -78,11 +78,19 @@ var Tip = Widget.extend({ this.init_width = this.$el.outerWidth(); this.init_height = this.$el.outerHeight(); this.double_border_width = 0; // TODO remove me in master - this.content_width = this.$tooltip_content.outerWidth(true); - this.content_height = this.$tooltip_content.outerHeight(true); + this.$el.addClass('active'); + this.el.style.setProperty('width', `${this.info.width}px`, 'important'); + this.el.style.setProperty('height', 'auto', 'important'); + this.el.style.setProperty('transition', 'none', 'important'); + this.content_width = this.$el.outerWidth(true); + this.content_height = this.$el.outerHeight(true); this.$tooltip_content.html(this.info.scrollContent); - this.scrollContentWidth = this.$tooltip_content.outerWidth(true); - this.scrollContentHeight = this.$tooltip_content.outerHeight(true); + this.scrollContentWidth = this.$el.outerWidth(true); + this.scrollContentHeight = this.$el.outerHeight(true); + this.$el.removeClass('active'); + this.el.style.removeProperty('width'); + this.el.style.removeProperty('height'); + this.el.style.removeProperty('transition'); this.$tooltip_content.html(this.info.content); this.$window = $(window); diff --git a/addons/web_tour/static/src/xml/tip.xml b/addons/web_tour/static/src/xml/tip.xml index 09bad5610eb..eba661f65ca 100644 --- a/addons/web_tour/static/src/xml/tip.xml +++ b/addons/web_tour/static/src/xml/tip.xml @@ -2,7 +2,7 @@ <templates id="template" xml:space="preserve"> <div t-name="Tip" t-attf-class="o_tooltip #{widget.info.position} #{widget.is_anchor_fixed_position ? 'o_tooltip_fixed' : ''}"> <div class="o_tooltip_overlay"/> - <div class="o_tooltip_content" t-attf-style="width: #{widget.info.width}px;"> + <div class="o_tooltip_content"> <t t-raw="widget.info.content"/> </div> </div> |
