Skip to content

Commit b3b1b91

Browse files
committed
Fix for Firefox compatibility
- Links: Change to label drawing code to account for Firefox (in)compatibility
1 parent 24704ca commit b3b1b91

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

demo/demo.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tag/js/tag.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40201,12 +40201,13 @@ function () {
4020140201
this.fontSize = parseInt($(this.svgText.node).css("font-size"));
4020240202
this.svgText.transform({
4020340203
y: -this.fontSize + 1
40204-
}); // Background (rectangle)
40204+
});
40205+
this.svgTextBbox = this.svgText.bbox(); // Background (rectangle)
4020540206

40206-
this.svgBackground = this.svg.rect(this.svgText.length() + 2, this.fontSize + 2).addClass("tag-element").addClass("link-text-bg").addClass(addClass).radius(2.5).back(); // Transform the rectangle to sit nicely behind the label
40207+
this.svgBackground = this.svg.rect(this.svgTextBbox.width + 2, this.fontSize + 2).addClass("tag-element").addClass("link-text-bg").addClass(addClass).radius(2.5).back(); // Transform the rectangle to sit nicely behind the label
4020740208

4020840209
this.svgBackground.transform({
40209-
x: -this.svgText.length() / 2 - 1,
40210+
x: -this.svgTextBbox.width / 2 - 1,
4021040211
y: -this.fontSize + 2.5
4021140212
}); // // Background (text)
4021240213
// this.svgBackground = this.svg.text(text)

dist/tag/js/tag.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/components/link.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,9 +1298,11 @@ class Label {
12981298
y: -this.fontSize + 1
12991299
});
13001300

1301+
this.svgTextBbox = this.svgText.bbox();
1302+
13011303
// Background (rectangle)
13021304
this.svgBackground = this.svg.rect(
1303-
this.svgText.length() + 2,
1305+
this.svgTextBbox.width + 2,
13041306
this.fontSize + 2
13051307
)
13061308
.addClass("tag-element")
@@ -1310,7 +1312,7 @@ class Label {
13101312
.back();
13111313
// Transform the rectangle to sit nicely behind the label
13121314
this.svgBackground.transform({
1313-
x: -this.svgText.length() / 2 - 1,
1315+
x: -this.svgTextBbox.width / 2 - 1,
13141316
y: -this.fontSize + 2.5
13151317
});
13161318

0 commit comments

Comments
 (0)