canvas-confetti
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
// canvas-confetti v1.9.1 built on 2023-11-16T06:04:29.288Z | ||
// canvas-confetti v1.9.2 built on 2023-11-25T06:01:06.267Z | ||
!(function (window, module) { | ||
@@ -814,3 +814,3 @@ // source content | ||
// see https://nolanlawson.com/2022/04/08/the-struggle-of-using-native-emoji-on-the-web/ | ||
fontFamily = '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "system emoji", sans-serif'; | ||
fontFamily = '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif'; | ||
@@ -836,5 +836,11 @@ if (typeof textData === 'string') { | ||
var size = ctx.measureText(text); | ||
var width = Math.floor(size.width); | ||
var height = Math.floor(size.fontBoundingBoxAscent + size.fontBoundingBoxDescent); | ||
var width = Math.ceil(size.actualBoundingBoxRight + size.actualBoundingBoxLeft); | ||
var height = Math.ceil(size.actualBoundingBoxAscent + size.actualBoundingBoxDescent); | ||
var padding = 2; | ||
var x = size.actualBoundingBoxLeft + padding; | ||
var y = size.actualBoundingBoxAscent + padding; | ||
width += padding + padding; | ||
height += padding + padding; | ||
canvas = new OffscreenCanvas(width, height); | ||
@@ -845,3 +851,3 @@ ctx = canvas.getContext('2d'); | ||
ctx.fillText(text, 0, fontSize); | ||
ctx.fillText(text, x, y); | ||
@@ -848,0 +854,0 @@ var scale = 1 / scalar; |
{ | ||
"name": "canvas-confetti", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"description": "performant confetti animation in the browser", | ||
@@ -34,3 +34,3 @@ "main": "src/confetti.js", | ||
"cross-env": "^5.1.3", | ||
"eslint": "^4.16.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-ava": "9.0.0", | ||
@@ -43,3 +43,2 @@ "jimp": "^0.2.28", | ||
}, | ||
"dependencies": {}, | ||
"keywords": [ | ||
@@ -46,0 +45,0 @@ "canvas", |
@@ -33,3 +33,3 @@ # [](https://github.com/catdad/canvas-confetti/) | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.1/dist/confetti.browser.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.2/dist/confetti.browser.min.js"></script> | ||
``` | ||
@@ -36,0 +36,0 @@ |
@@ -811,3 +811,3 @@ /* globals Map */ | ||
// see https://nolanlawson.com/2022/04/08/the-struggle-of-using-native-emoji-on-the-web/ | ||
fontFamily = '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "system emoji", sans-serif'; | ||
fontFamily = '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif'; | ||
@@ -833,5 +833,11 @@ if (typeof textData === 'string') { | ||
var size = ctx.measureText(text); | ||
var width = Math.floor(size.width); | ||
var height = Math.floor(size.fontBoundingBoxAscent + size.fontBoundingBoxDescent); | ||
var width = Math.ceil(size.actualBoundingBoxRight + size.actualBoundingBoxLeft); | ||
var height = Math.ceil(size.actualBoundingBoxAscent + size.actualBoundingBoxDescent); | ||
var padding = 2; | ||
var x = size.actualBoundingBoxLeft + padding; | ||
var y = size.actualBoundingBoxAscent + padding; | ||
width += padding + padding; | ||
height += padding + padding; | ||
canvas = new OffscreenCanvas(width, height); | ||
@@ -842,3 +848,3 @@ ctx = canvas.getContext('2d'); | ||
ctx.fillText(text, 0, fontSize); | ||
ctx.fillText(text, x, y); | ||
@@ -845,0 +851,0 @@ var scale = 1 / scalar; |
Sorry, the diff of this file is not supported yet
92154
0.73%2199
0.69%