| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,7 +153,7 @@ public static Tooltip2 tooltip2(Supplier<HTMLElement> trigger, String text) { | |||
| 153 | 153 | this.distance = DISTANCE; | |
| 154 | 154 | this.entryDelay = ENTRY_DELAY; | |
| 155 | 155 | this.exitDelay = EXIT_DELAY; | |
| 156 | - this.placement = top; | ||
| 156 | + this.placement = auto; | ||
| 157 | 157 | this.aria = describedBy; | |
| 158 | 158 | this.showTimeout = 0; | |
| 159 | 159 | this.hideTimeout = 0; | |
@@ -188,7 +188,9 @@ public void attach(MutationRecord mutationRecord) { | |||
| 188 | 188 | trigger.style.setProperty("anchor-name", anchorName); | |
| 189 | 189 | style("position-anchor", anchorName); | |
| 190 | 190 | style("margin", distance + "px"); | |
| 191 | - applyPlacement(); | ||
| 191 | + | ||
| 192 | + // top is the default for auto and recalculated on show() | ||
| 193 | + applyPlacement(placement == auto ? top : placement); | ||
| 192 | 194 | ||
| 193 | 195 | // event listeners on trigger | |
| 194 | 196 | triggerHandlers = compose( | |
@@ -306,10 +308,10 @@ public void show() { | |||
| 306 | 308 | } | |
| 307 | 309 | ||
| 308 | 310 | public void show(Event event) { | |
| 309 | - if (!visible) { | ||
| 310 | - if (placement == auto && trigger != null) { | ||
| 311 | + if (!visible && trigger != null) { | ||
| 312 | + if (placement == auto) { | ||
| 311 | 313 | // Show invisibly to get measurable dimensions, calculate placement, then reveal | |
| 312 | - element().style.setProperty("visibility", "hidden"); | ||
| 314 | + style("visibility", "hidden"); | ||
| 313 | 315 | element().showPopover(); | |
| 314 | 316 | applyPlacement(bestPlacement()); | |
| 315 | 317 | element().style.removeProperty("visibility"); | |
@@ -359,14 +361,6 @@ private void cancelTimers(Event event) { | |||
| 359 | 361 | clearTimeout(hideTimeout); | |
| 360 | 362 | } | |
| 361 | 363 | ||
| 362 | - private void applyPlacement() { | ||
| 363 | - if (placement == auto) { | ||
| 364 | - applyPlacement(top); // default for auto, recalculated on show() | ||
| 365 | - } else { | ||
| 366 | - applyPlacement(placement); | ||
| 367 | - } | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | 364 | private void applyPlacement(Placement p) { | |
| 371 | 365 | for (String mod : Placement.modifiers) { | |
| 372 | 366 | classList().remove(mod); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,8 +62,8 @@ | |||
| 62 | 62 | !* Was top, flipped to bottom *! | |
| 63 | 63 | @container anchored(fallback: flip-block flip-inline) { | |
| 64 | 64 | .pf-v6-c-tooltip[popover].pf-m-top .pf-v6-c-tooltip__arrow { | |
| 65 | - --pf-v6-c-tooltip__arrow--InsetBlockEnd: auto; | ||
| 66 | 65 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-bottom--InsetBlockStart, 0); | |
| 66 | + --pf-v6-c-tooltip__arrow--InsetBlockEnd: auto; | ||
| 67 | 67 | --pf-v6-c-tooltip__arrow--InsetInlineStart: var(--pf-v6-c-tooltip--m-bottom--InsetInlineStart, 50%); | |
| 68 | 68 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-bottom--TranslateX); | |
| 69 | 69 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-bottom--TranslateY); | |
@@ -86,9 +86,9 @@ | |||
| 86 | 86 | !* Was left, flipped to right *! | |
| 87 | 87 | @container anchored(fallback: flip-block flip-inline) { | |
| 88 | 88 | .pf-v6-c-tooltip[popover].pf-m-left .pf-v6-c-tooltip__arrow { | |
| 89 | - --pf-v6-c-tooltip__arrow--InsetInlineEnd: auto; | ||
| 90 | 89 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-right--InsetBlockStart, 50%); | |
| 91 | 90 | --pf-v6-c-tooltip__arrow--InsetInlineStart: var(--pf-v6-c-tooltip--m-right--InsetInlineStart, 0); | |
| 91 | + --pf-v6-c-tooltip__arrow--InsetInlineEnd: auto; | ||
| 92 | 92 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-right--TranslateX); | |
| 93 | 93 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-right--TranslateY); | |
| 94 | 94 | --pf-v6-c-tooltip__arrow--Rotate: var(--pf-v6-c-tooltip__arrow--m-right--Rotate); | |
@@ -98,8 +98,8 @@ | |||
| 98 | 98 | !* Was right, flipped to left *! | |
| 99 | 99 | @container anchored(fallback: flip-block flip-inline) { | |
| 100 | 100 | .pf-v6-c-tooltip[popover].pf-m-right .pf-v6-c-tooltip__arrow { | |
| 101 | - --pf-v6-c-tooltip__arrow--InsetInlineStart: auto; | ||
| 102 | 101 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-left--InsetBlockStart, 50%); | |
| 102 | + --pf-v6-c-tooltip__arrow--InsetInlineStart: auto; | ||
| 103 | 103 | --pf-v6-c-tooltip__arrow--InsetInlineEnd: var(--pf-v6-c-tooltip--m-left--InsetInlineEnd, 0); | |
| 104 | 104 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-left--TranslateX); | |
| 105 | 105 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-left--TranslateY); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,8 +44,8 @@ const STYLES_TO_INSERT = ` | |||
| 44 | 44 | /* Was top, flipped to bottom */ | |
| 45 | 45 | @container anchored(fallback: flip-block flip-inline) { | |
| 46 | 46 | .pf-v6-c-tooltip[popover].pf-m-top .pf-v6-c-tooltip__arrow { | |
| 47 | - --pf-v6-c-tooltip__arrow--InsetBlockEnd: auto; | ||
| 48 | 47 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-bottom--InsetBlockStart, 0); | |
| 48 | + --pf-v6-c-tooltip__arrow--InsetBlockEnd: auto; | ||
| 49 | 49 | --pf-v6-c-tooltip__arrow--InsetInlineStart: var(--pf-v6-c-tooltip--m-bottom--InsetInlineStart, 50%); | |
| 50 | 50 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-bottom--TranslateX); | |
| 51 | 51 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-bottom--TranslateY); | |
@@ -68,9 +68,9 @@ const STYLES_TO_INSERT = ` | |||
| 68 | 68 | /* Was left, flipped to right */ | |
| 69 | 69 | @container anchored(fallback: flip-block flip-inline) { | |
| 70 | 70 | .pf-v6-c-tooltip[popover].pf-m-left .pf-v6-c-tooltip__arrow { | |
| 71 | - --pf-v6-c-tooltip__arrow--InsetInlineEnd: auto; | ||
| 72 | 71 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-right--InsetBlockStart, 50%); | |
| 73 | 72 | --pf-v6-c-tooltip__arrow--InsetInlineStart: var(--pf-v6-c-tooltip--m-right--InsetInlineStart, 0); | |
| 73 | + --pf-v6-c-tooltip__arrow--InsetInlineEnd: auto; | ||
| 74 | 74 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-right--TranslateX); | |
| 75 | 75 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-right--TranslateY); | |
| 76 | 76 | --pf-v6-c-tooltip__arrow--Rotate: var(--pf-v6-c-tooltip__arrow--m-right--Rotate); | |
@@ -80,8 +80,8 @@ const STYLES_TO_INSERT = ` | |||
| 80 | 80 | /* Was right, flipped to left */ | |
| 81 | 81 | @container anchored(fallback: flip-block flip-inline) { | |
| 82 | 82 | .pf-v6-c-tooltip[popover].pf-m-right .pf-v6-c-tooltip__arrow { | |
| 83 | - --pf-v6-c-tooltip__arrow--InsetInlineStart: auto; | ||
| 84 | 83 | --pf-v6-c-tooltip__arrow--InsetBlockStart: var(--pf-v6-c-tooltip--m-left--InsetBlockStart, 50%); | |
| 84 | + --pf-v6-c-tooltip__arrow--InsetInlineStart: auto; | ||
| 85 | 85 | --pf-v6-c-tooltip__arrow--InsetInlineEnd: var(--pf-v6-c-tooltip--m-left--InsetInlineEnd, 0); | |
| 86 | 86 | --pf-v6-c-tooltip__arrow--TranslateX: var(--pf-v6-c-tooltip__arrow--m-left--TranslateX); | |
| 87 | 87 | --pf-v6-c-tooltip__arrow--TranslateY: var(--pf-v6-c-tooltip__arrow--m-left--TranslateY); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments