fix: schemaToPptxBlob 传递 rotate 给 pptxgenjs + 清理 debug

This commit is contained in:
李进
2026-07-27 18:14:25 +08:00
parent dc8b688cb1
commit 64c86bcd63
+1 -7
View File
@@ -1,5 +1,3 @@
// VERSION: 2026-07-27-18:10
console.log("[WebToPPT] convert-browser.js loaded: 2026-07-27-18:10");
/** /**
* convert-browser.js — 浏览器兼容版转化逻辑 * convert-browser.js — 浏览器兼容版转化逻辑
* *
@@ -444,10 +442,6 @@ async function convertToPptx(input, onProgress) {
} }
} }
// Debug: log card nodes
if ((n.name||'').includes('card') || (n.name||'').includes('rotate')) {
console.log('[WebToPPT] NODE:', (n.name||'').slice(0,25), 'type=', n.type, 'fillColor=', fillColor, 'bg=', (n.styles?.backgroundColor||'none').slice(0,20));
}
if (fillColor) { if (fillColor) {
var shapeOpts = { x: opts.x, y: opts.y, w: opts.w, h: opts.h, fill: { color: fillColor } }; var shapeOpts = { x: opts.x, y: opts.y, w: opts.w, h: opts.h, fill: { color: fillColor } };
if (fillTransparency) shapeOpts.fill.transparency = fillTransparency; if (fillTransparency) shapeOpts.fill.transparency = fillTransparency;
@@ -472,7 +466,6 @@ async function convertToPptx(input, onProgress) {
// 旋转 // 旋转
if (n.styles.transform && n.styles.transform !== 'none') { if (n.styles.transform && n.styles.transform !== 'none') {
console.log('[WebToPPT] ROTATE CHECK:', (n.name||'').slice(0,20), 'transform=', n.styles.transform.slice(0,40));
var rotateMatch = n.styles.transform.match(/rotate\(([-\d.]+)deg\)/); var rotateMatch = n.styles.transform.match(/rotate\(([-\d.]+)deg\)/);
if (rotateMatch) { if (rotateMatch) {
shapeOpts.rotate = parseFloat(rotateMatch[1]); shapeOpts.rotate = parseFloat(rotateMatch[1]);
@@ -601,6 +594,7 @@ async function schemaToPptxBlob(schema) {
else shapeOpts.line = { type: 'none' }; else shapeOpts.line = { type: 'none' };
if (o.shadow) shapeOpts.shadow = o.shadow; if (o.shadow) shapeOpts.shadow = o.shadow;
if (o.rectRadius) shapeOpts.rectRadius = o.rectRadius; if (o.rectRadius) shapeOpts.rectRadius = o.rectRadius;
if (o.rotate) shapeOpts.rotate = o.rotate;
slide.addShape(pres.ShapeType[st] || pres.ShapeType.rect, shapeOpts); slide.addShape(pres.ShapeType[st] || pres.ShapeType.rect, shapeOpts);
} else if (obj.type === 'image') { } else if (obj.type === 'image') {
slide.addImage({ x: o.x, y: o.y, w: o.w, h: o.h, data: o.data || o.path }); slide.addImage({ x: o.x, y: o.y, w: o.w, h: o.h, data: o.data || o.path });