@meta2d/core
Advanced tools
Comparing version 1.0.29 to 1.0.30
{ | ||
"name": "@meta2d/core", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -276,10 +276,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function renderPenRaw(pen) { | ||
if (pen.calculative.singleton && pen.calculative.singleton.div) { | ||
try { | ||
handleSaveImg(pen); | ||
if (pen.thumbImg) { | ||
var img = new Image(); | ||
img.crossOrigin = | ||
pen.crossOrigin === 'undefined' | ||
? undefined | ||
: pen.crossOrigin || 'anonymous'; | ||
img.src = pen.thumbImg; | ||
pen.calculative.img = img; | ||
} | ||
else { | ||
if (pen.calculative.singleton && pen.calculative.singleton.div) { | ||
try { | ||
handleSaveImg(pen); | ||
} | ||
catch (e) { | ||
console.warn(e); | ||
pen.calculative.img = null; | ||
} | ||
} | ||
catch (e) { | ||
console.warn(e); | ||
pen.calculative.img = null; | ||
} | ||
} | ||
@@ -289,3 +300,3 @@ } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var iframeHtml, iframeBody, iframeScrollY, iframeScrollX, canvas, img; | ||
var iframeHtml, iframeBody, iframeScrollY, iframeScrollX, fillContent, canvas, img; | ||
return __generator(this, function (_a) { | ||
@@ -298,5 +309,9 @@ switch (_a.label) { | ||
iframeScrollX = iframeHtml.document.documentElement.scrollLeft; | ||
fillContent = document.createElement('div'); | ||
// 把需要转换成图片的元素内容赋给创建的元素 | ||
fillContent.innerHTML = iframeBody.outerHTML; | ||
document.body.appendChild(fillContent); | ||
iframeHtml.document.domain = getRootDomain(); | ||
if (!globalThis.html2canvas) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, globalThis.html2canvas(iframeBody, { | ||
return [4 /*yield*/, globalThis.html2canvas(fillContent, { | ||
allowTaint: true, | ||
@@ -308,9 +323,6 @@ useCORS: true, | ||
y: iframeScrollY, | ||
foreignObjectRendering: true, | ||
// foreignObjectRendering: true, | ||
})]; | ||
case 1: | ||
canvas = _a.sent(); | ||
canvas.getContext('2d', { | ||
willReadFrequently: true, | ||
}); | ||
img = new Image(); | ||
@@ -325,2 +337,3 @@ img.crossOrigin = | ||
} | ||
document.body.removeChild(fillContent); | ||
_a.label = 2; | ||
@@ -327,0 +340,0 @@ case 2: return [2 /*return*/]; |
@@ -227,2 +227,3 @@ import { Point } from '../point'; | ||
template?: boolean; | ||
thumbImg?: string; | ||
calculative?: { | ||
@@ -229,0 +230,0 @@ x?: number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
1603115
23031
13