This repository was archived by the owner on Jul 13, 2024. It is now read-only.
File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,8 @@ function createGitgraph(
211
211
moveElement ( tag , x ) ;
212
212
213
213
// BBox width misses box padding and offset
214
- // => they are set later, on branch label update.
215
- // We would need to make branch label update happen before to solve it.
214
+ // => they are set later, on tag update.
215
+ // We would need to make tag update happen before to solve it.
216
216
const offset = parseFloat ( tag . getAttribute ( "data-offset" ) || "0" ) ;
217
217
const tagWidth = tag . getBBox ( ) . width + 2 * TAG_PADDING_X + offset ;
218
218
x += tagWidth + padding ;
@@ -469,6 +469,12 @@ function createGitgraph(
469
469
translate : { x : 0 , y : commit . style . dot . size } ,
470
470
children : [ tagElement ] ,
471
471
} ) ;
472
+ // `data-offset` is used to position tag element in `positionCommitsElements`.
473
+ // => because when it's executed, tag offsets are not resolved yet
474
+ tagContainer . setAttribute (
475
+ "data-offset" ,
476
+ tag . style . pointerWidth . toString ( ) ,
477
+ ) ;
472
478
473
479
setTagRef ( commit , tagContainer ) ;
474
480
Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ function createTag(tag: Tag<SVGElement>): SVGGElement {
20
20
} ) ;
21
21
22
22
const result = createG ( { children : [ path ] } ) ;
23
- // Pass computed box width to gitgraph so it can adapt.
24
23
const offset = tag . style . pointerWidth ;
25
- result . setAttribute ( "data-offset" , offset . toString ( ) ) ;
26
24
27
25
const observer = new MutationObserver ( ( ) => {
28
26
const { height, width } = text . getBBox ( ) ;
You can’t perform that action at this time.
0 commit comments