Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
06636fea
Verified
Commit
06636fea
authored
4 months ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: check rendering #271
parent
6bbfdd6a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
development/issues/closed/271.html
+39
-0
39 additions, 0 deletions
development/issues/closed/271.html
development/issues/closed/271.mjs
+15
-0
15 additions, 0 deletions
development/issues/closed/271.mjs
source/components/layout/tabs.mjs
+35
-23
35 additions, 23 deletions
source/components/layout/tabs.mjs
with
89 additions
and
23 deletions
development/issues/closed/271.html
0 → 100644
+
39
−
0
View file @
06636fea
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
check size calc of tabs #271
</title>
<script
src=
"271.mjs"
type=
"module"
></script>
</head>
<body>
<h1>
check size calc of tabs #271
</h1>
<p>
When the tab is resized, it first becomes small and then large again. This causes the display to jump.
</p>
<ul>
<li><a
href=
"https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/271"
>
Issue #271
</a></li>
<li><a
href=
"/"
>
Back to overview
</a></li>
</ul>
<main
style=
"width: 990px; border:1px solid red"
>
<monster-tabs>
<div>
tab 1
</div>
<div>
tab 2
</div>
<div
data-monster-button-label=
"22"
>
<monster-tabs>
<div>
tab 11
</div>
<div>
tab 12
</div>
<div>
tab 13
</div>
<div>
tab 14
</div>
<div>
tab 15
</div>
</monster-tabs>
</div>
<div>
tab 4
</div>
<div>
tab 5
</div>
</monster-tabs>
</main>
</body>
</html>
This diff is collapsed.
Click to expand it.
development/issues/closed/271.mjs
0 → 100644
+
15
−
0
View file @
06636fea
/**
* @file development/issues/open/271.mjs
* @url https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/271
* @description check size calc of tabs
* @issue 271
*/
import
"
../../../source/components/style/property.pcss
"
;
import
"
../../../source/components/style/link.pcss
"
;
import
"
../../../source/components/style/color.pcss
"
;
import
"
../../../source/components/style/theme.pcss
"
;
import
"
../../../source/components/style/normalize.pcss
"
;
import
"
../../../source/components/style/typography.pcss
"
;
import
"
../../../source/components/layout/tabs.mjs
"
;
This diff is collapsed.
Click to expand it.
source/components/layout/tabs.mjs
+
35
−
23
View file @
06636fea
...
@@ -36,7 +36,7 @@ import {
...
@@ -36,7 +36,7 @@ import {
findTargetElementFromEvent
,
findTargetElementFromEvent
,
fireCustomEvent
,
fireCustomEvent
,
}
from
"
../../dom/events.mjs
"
;
}
from
"
../../dom/events.mjs
"
;
import
{
getDocument
}
from
"
../../dom/util.mjs
"
;
import
{
getDocument
,
getWindow
}
from
"
../../dom/util.mjs
"
;
import
{
random
}
from
"
../../math/random.mjs
"
;
import
{
random
}
from
"
../../math/random.mjs
"
;
import
{
getGlobal
}
from
"
../../types/global.mjs
"
;
import
{
getGlobal
}
from
"
../../types/global.mjs
"
;
import
{
ID
}
from
"
../../types/id.mjs
"
;
import
{
ID
}
from
"
../../types/id.mjs
"
;
...
@@ -150,6 +150,7 @@ const resizeObserverSymbol = Symbol("resizeObserver");
...
@@ -150,6 +150,7 @@ const resizeObserverSymbol = Symbol("resizeObserver");
* @example /examples/components/layout/tabs-removable
* @example /examples/components/layout/tabs-removable
*
*
* @issue https://localhost.alvine.dev:8443/development/issues/closed/268.html
* @issue https://localhost.alvine.dev:8443/development/issues/closed/268.html
* @issue https://localhost.alvine.dev:8443/development/issues/closed/271.html
*
*
* @since 3.74.0
* @since 3.74.0
* @copyright schukai GmbH
* @copyright schukai GmbH
...
@@ -1027,35 +1028,43 @@ function calcBoxWidth(node) {
...
@@ -1027,35 +1028,43 @@ function calcBoxWidth(node) {
* @return {Object}
* @return {Object}
*/
*/
function
rearrangeButtons
()
{
function
rearrangeButtons
()
{
const
standardButtons
=
[];
const
popperButtons
=
[];
let
sum
=
0
;
getWindow
().
requestAnimationFrame
(()
=>
{
const
space
=
this
[
dimensionsSymbol
].
getVia
(
"
data.space
"
);
const
buttons
=
this
.
getOption
(
"
buttons.standard
"
);
const
standardButtons
=
[];
for
(
const
[,
button
]
of
buttons
.
entries
())
{
const
popperButtons
=
[];
const
ref
=
button
?.
reference
;
let
sum
=
0
;
const
space
=
this
[
dimensionsSymbol
].
getVia
(
"
data.space
"
);
if
(
space
<=
0
)
{
return
;
}
sum
+=
this
[
dimensionsSymbol
].
getVia
(
`data.button.
${
ref
}
`
);
const
buttons
=
this
.
getOption
(
"
buttons.standard
"
);
for
(
const
[,
button
]
of
buttons
.
entries
())
{
const
ref
=
button
?.
reference
;
if
(
sum
>
space
)
{
sum
+=
this
[
dimensionsSymbol
].
getVia
(
`data.button.
${
ref
}
`
);
popperButtons
.
push
(
clone
(
button
));
}
else
{
if
(
sum
>
space
)
{
standardButtons
.
push
(
clone
(
button
));
popperButtons
.
push
(
clone
(
button
));
}
else
{
standardButtons
.
push
(
clone
(
button
));
}
}
}
}
this
.
setOption
(
"
buttons.standard
"
,
standardButtons
);
this
.
setOption
(
"
buttons.standard
"
,
standardButtons
);
this
.
setOption
(
"
buttons.popper
"
,
popperButtons
);
this
.
setOption
(
"
buttons.popper
"
,
popperButtons
);
if
(
this
[
switchElementSymbol
])
{
if
(
this
[
switchElementSymbol
])
{
if
(
popperButtons
.
length
>
0
)
{
if
(
popperButtons
.
length
>
0
)
{
this
[
switchElementSymbol
].
classList
.
remove
(
"
hidden
"
);
this
[
switchElementSymbol
].
classList
.
remove
(
"
hidden
"
);
}
else
{
}
else
{
this
[
switchElementSymbol
].
classList
.
add
(
"
hidden
"
);
this
[
switchElementSymbol
].
classList
.
add
(
"
hidden
"
);
}
}
}
}
});
}
}
/**
/**
...
@@ -1105,8 +1114,11 @@ function calculateNavigationButtonsDimensions() {
...
@@ -1105,8 +1114,11 @@ function calculateNavigationButtonsDimensions() {
slot
.
classList
.
remove
(
"
invisible
"
);
slot
.
classList
.
remove
(
"
invisible
"
);
}
}
this
[
dimensionsSymbol
].
setVia
(
"
data.calculated
"
,
true
);
this
.
setOption
(
"
buttons.standard
"
,
clone
(
buttons
));
this
.
setOption
(
"
buttons.standard
"
,
clone
(
buttons
));
getWindow
().
requestAnimationFrame
(()
=>
{
this
[
dimensionsSymbol
].
setVia
(
"
data.calculated
"
,
true
);
});
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment