mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-13 18:40:54 +01:00
Refactored tooltip origin computation
This commit is contained in:
parent
6a348e6e81
commit
183db0937c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
material/assets/stylesheets/main.cef86043.min.css.map
Normal file
1
material/assets/stylesheets/main.cef86043.min.css.map
Normal file
File diff suppressed because one or more lines are too long
@ -34,7 +34,7 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.2a4617e2.min.css' | url }}">
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.cef86043.min.css' | url }}">
|
||||
{% if config.theme.palette %}
|
||||
{% set palette = config.theme.palette %}
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.9204c3b2.min.css' | url }}">
|
||||
@ -213,7 +213,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.6baa0517.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.615eee59.min.js' | url }}"></script>
|
||||
{% for path in config["extra_javascript"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -134,8 +134,20 @@ export function mountAnnotation(
|
||||
map(() => container.getBoundingClientRect()),
|
||||
map(({ x }) => x)
|
||||
)
|
||||
.subscribe(origin => {
|
||||
el.style.setProperty("--md-tooltip-0", `${-origin}px`)
|
||||
.subscribe({
|
||||
|
||||
/* Handle emission */
|
||||
next(origin) {
|
||||
if (origin)
|
||||
el.style.setProperty("--md-tooltip-0", `${-origin}px`)
|
||||
else
|
||||
el.style.removeProperty("--md-tooltip-0")
|
||||
},
|
||||
|
||||
/* Handle complete */
|
||||
complete() {
|
||||
el.style.removeProperty("--md-tooltip-0")
|
||||
}
|
||||
})
|
||||
|
||||
/* Close open annotation on click */
|
||||
|
@ -56,9 +56,20 @@
|
||||
top: var(--md-tooltip-y);
|
||||
left:
|
||||
clamp(
|
||||
#{px2rem(16px)},
|
||||
calc(var(--md-tooltip-x) - #{px2rem(16px)}),
|
||||
calc(100vw - var(--md-tooltip-width) - #{px2rem(16px)})
|
||||
calc(
|
||||
var(--md-tooltip-0, #{px2rem(0px)}) +
|
||||
#{px2rem(16px)}
|
||||
),
|
||||
var(--md-tooltip-x),
|
||||
calc(
|
||||
100vw -
|
||||
var(--md-tooltip-width) +
|
||||
calc(
|
||||
var(--md-tooltip-0, #{px2rem(0px)}) +
|
||||
#{px2rem(16px)}
|
||||
) -
|
||||
2 * #{px2rem(16px)}
|
||||
)
|
||||
);
|
||||
// Hack: set an explicit `z-index` so we can transition it to ensure that any
|
||||
// following elements are not overlaying the tooltip during the transition.
|
||||
@ -144,23 +155,6 @@
|
||||
// Code annotation wrapper (= tooltip)
|
||||
&__inner {
|
||||
top: calc(var(--md-tooltip-y) + 1.2ch);
|
||||
left:
|
||||
clamp(
|
||||
calc(
|
||||
var(--md-tooltip-0, 0) +
|
||||
#{px2rem(16px)}
|
||||
),
|
||||
var(--md-tooltip-x),
|
||||
calc(
|
||||
100vw -
|
||||
var(--md-tooltip-width) +
|
||||
calc(
|
||||
var(--md-tooltip-0, 0) +
|
||||
#{px2rem(16px)}
|
||||
) -
|
||||
2 * #{px2rem(16px)}
|
||||
)
|
||||
);
|
||||
font-family: var(--md-text-font-family);
|
||||
|
||||
// Code annotation tooltip when not focused
|
||||
|
Loading…
Reference in New Issue
Block a user