AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
fix(native_objects): preserve explicit chart bounds and point colors
hugohe3831f98b7c328
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.pyindex 06b49dc1..22864b33 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py@@ -344,7 +344,10 @@ def _series_xml(if chart_type == "of_pie"else len(categories))- point_colors_xml = _data_point_colors_xml(point_count, colors)+ point_colors_xml = _data_point_colors_xml(+ point_count,+ item.get("point_colors") or colors,+ )elif chart_type in {"bar", "column"} and item.get("point_colors"):point_colors_xml = _data_point_colors_xml(len(item["values"]),@@ -557,8 +560,10 @@ def _bar_chart_group_xml(*,cat_ax_id: str,val_ax_id: str,+ vary_colors: bool = False,) -> str:bar_dir = "bar" if chart_type == "bar" else "col"+ vary_colors_xml = '<c:varyColors val="1"/>' if vary_colors else '<c:varyColors val="0"/>'overlap_xml = ('<c:overlap val="100"/>'if grouping in {"stacked", "percentStacked"}@@ -567,7 +572,7 @@ def _bar_chart_group_xml(return ("<c:barChart>"f'<c:barDir val="{bar_dir}"/><c:grouping val="{grouping}"/>'- '<c:varyColors val="0"/>'+ f"{vary_colors_xml}"f"{ser_xml}"'<c:gapWidth val="150"/>'f"{overlap_xml}"@@ -702,6 +707,7 @@ def _combo_plot_xml(ser_xml,cat_ax_id=cat_ax_id,val_ax_id=val_ax_id,+ vary_colors=any(item.get("point_colors") for item in plot["series"]),))elif chart_type in {"area", "line"}:parts.append(_line_area_chart_group_xml(@@ -861,9 +867,15 @@ def _chart_plot_xml(if grouping in {"stacked", "percentStacked"}else "")+ vary_colors_xml = (+ '<c:varyColors val="1"/>'+ if any(item.get("point_colors") for item in series)+ else '<c:varyColors val="0"/>'+ )return ("<c:barChart>"f'<c:barDir val="{bar_dir}"/><c:grouping val="{grouping}"/>'+ f"{vary_colors_xml}"f"{ser_xml}"'<c:gapWidth val="150"/>'f"{overlap_xml}"diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.pyindex ca2f9658..2eae315a 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py@@ -539,8 +539,9 @@ def _bounds(elem: ET.Element, payload: dict[str, Any], ctx: ConvertContext) -> traw_y = payload.get("y", elem.get("data-pptx-y"))raw_width = payload.get("width", elem.get("data-pptx-width"))raw_height = payload.get("height", elem.get("data-pptx-height"))+ explicit_bounds = all(value is not None for value in (raw_x, raw_y, raw_width, raw_height))inferred = None- if any(value is None for value in (raw_x, raw_y, raw_width, raw_height)):+ if not explicit_bounds:inferred = _inferred_bounds(elem)if inferred is None:raise RuntimeError(@@ -560,10 +561,16 @@ def _bounds(elem: ET.Element, payload: dict[str, Any], ctx: ConvertContext) -> tif width <= 0 or height <= 0:raise RuntimeError("Native PPTX object width/height must be positive")- resolved_x = ctx_x(x, ctx)- resolved_y = ctx_y(y, ctx)- resolved_w = ctx_w(width, ctx)- resolved_h = ctx_h(height, ctx)+ if explicit_bounds:+ resolved_x = x+ resolved_y = y+ resolved_w = width+ resolved_h = height+ else:+ resolved_x = ctx_x(x, ctx)+ resolved_y = ctx_y(y, ctx)+ resolved_w = ctx_w(width, ctx)+ resolved_h = ctx_h(height, ctx)off_x = px_to_emu(resolved_x)off_y = px_to_emu(resolved_y)ext_cx = px_to_emu(resolved_w)