Supprime la couche de formes libres, déplace la navigation de page dans le panneau gauche
Build and deploy / test-python (push) Successful in 7m43s
Build and deploy / test-js (push) Successful in 57s
Build and deploy / lint-python (push) Successful in 5m29s
Build and deploy / lint-js (push) Failing after 1m16s
Build and deploy / build-and-push (push) Skipped
Build and deploy / deploy (push) Skipped
Build and deploy / sonarqube (push) Failing after 5m42s
Build and deploy / test-python (push) Successful in 7m43s
Build and deploy / test-js (push) Successful in 57s
Build and deploy / lint-python (push) Successful in 5m29s
Build and deploy / lint-js (push) Failing after 1m16s
Build and deploy / build-and-push (push) Skipped
Build and deploy / deploy (push) Skipped
Build and deploy / sonarqube (push) Failing after 5m42s
Formes libres (rectangle/cercle/triangle/trait) retirées de bout en bout (bibliothèque, rendu, panneau Propriétés, grille d'accroche, JS/CSS associés) — fonctionnalité non retenue. La bande de vignettes visuelles des pages au-dessus du canevas est remplacée par une section "Pages" dans le panneau de gauche (liste simple : ajouter/renommer/réordonner (haut/bas)/supprimer), à la place de l'ex-catégorie "Mise en page" de la bibliothèque. La route document_edit ne rend plus qu'une seule page (celle affichée) au chargement, au lieu de toutes les pages pour alimenter les anciennes vignettes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
57c4de3d8a
commit
8dc4b35dcf
@@ -3,8 +3,6 @@ import json
|
||||
import random
|
||||
from typing import Any
|
||||
|
||||
_SHAPE_TAGS = {"rectangle": "rect", "cercle": "circle", "trait": "line"}
|
||||
|
||||
|
||||
def render_document(elements: list[dict[str, Any]]) -> str:
|
||||
"""Assemble le document ENTIER à partir de la liste à plat renvoyée
|
||||
@@ -39,40 +37,6 @@ def _render_row(el: dict[str, Any], children_by_parent: dict[int | None, list[di
|
||||
return f'<div class="docRow" data-element-id="{el["id"]}" data-kind="row" style="{style}">{inner}</div>'
|
||||
|
||||
|
||||
def _render_shape(el: dict[str, Any], _children_by_parent: dict[int | None, list[dict[str, Any]]]) -> str:
|
||||
a = el["attributes"]
|
||||
x, y, width, height = a["x"], a["y"], a["width"], a["height"]
|
||||
rotation, z_index = a.get("rotation", 0), a.get("z_index", 1)
|
||||
fill = html_lib.escape(str(a.get("fill", "#ff5f2e")))
|
||||
stroke = html_lib.escape(str(a.get("stroke", "#232a38")))
|
||||
stroke_width = a.get("stroke_width", 2)
|
||||
label = html_lib.escape(str(a.get("label", "")))
|
||||
wrap_style = (
|
||||
f"position:absolute; left:{x}px; top:{y}px; width:{width}px; height:{height}px; "
|
||||
f"transform:rotate({rotation}deg); z-index:{z_index};"
|
||||
)
|
||||
kind = el["kind"]
|
||||
stroke_attrs = f'stroke="{stroke}" stroke-width="{stroke_width}"'
|
||||
if kind == "triangle":
|
||||
points = f"{width / 2},0 {width},{height} 0,{height}"
|
||||
shape_svg = f'<polygon points="{points}" fill="{fill}" {stroke_attrs}></polygon>'
|
||||
else:
|
||||
tag = _SHAPE_TAGS.get(kind, "rect")
|
||||
if tag == "circle":
|
||||
cx, cy, r = width / 2, height / 2, min(width, height) / 2
|
||||
shape_svg = f'<circle cx="{cx}" cy="{cy}" r="{r}" fill="{fill}" {stroke_attrs}></circle>'
|
||||
elif tag == "line":
|
||||
shape_svg = f'<line x1="0" y1="{height / 2}" x2="{width}" y2="{height / 2}" {stroke_attrs}></line>'
|
||||
else:
|
||||
shape_svg = f'<rect width="{width}" height="{height}" fill="{fill}" {stroke_attrs}></rect>'
|
||||
label_attr = f' aria-label="{label}"' if label else ' aria-hidden="true"'
|
||||
return (
|
||||
f'<div class="docShape" data-element-id="{el["id"]}" data-kind="{kind}" style="{wrap_style}"{label_attr}>'
|
||||
f'<svg width="{width}" height="{height}" viewBox="0 0 {width} {height}">{shape_svg}</svg>'
|
||||
f"</div>"
|
||||
)
|
||||
|
||||
|
||||
_STYLE_PRESETS = {
|
||||
"titre1": ("clamp(1.6rem,4vw,2rem)", 800, 1.15),
|
||||
"titre2": ("1.3rem", 800, 1.25),
|
||||
@@ -530,10 +494,6 @@ def _render_unknown(el: dict[str, Any], _children_by_parent: dict[int | None, li
|
||||
|
||||
_RENDERERS = {
|
||||
"row": _render_row,
|
||||
"rectangle": _render_shape,
|
||||
"cercle": _render_shape,
|
||||
"triangle": _render_shape,
|
||||
"trait": _render_shape,
|
||||
"titre": _render_text,
|
||||
"paragraphe": _render_text,
|
||||
"image": _render_image,
|
||||
|
||||
Reference in New Issue
Block a user