hhu-stups / prob-issues

ProB issues (for probcli, ProB Tcl/Tk, ProB2, ProB2UI)
6 stars 0 forks source link

VisB support in ProB2-UI for groups and titles #341

Open leuschel opened 8 months ago

leuschel commented 8 months ago

We need to support groups and titles so that they work correctly in ProB2-UI. In this example, the rotation on the group has no effect and the hover/tooltip title is the same for all objects (but it gets updated based on the variable x). We may have to support the children attribute in ProB2-UI.

MACHINE TitleHoverExample2
 // simple example showing how to use title as a tooltip
 // this time using the title attribute, which VisB translates into children objects
DEFINITIONS
    "LibraryStrings.def"; "LibrarySVG.def"; "SORT.def";
    VISB_SVG_FILE == "";

    VISB_SVG_BOX == rec(height:400, width:450);

    VISB_SVG_OBJECTS2 == {i•i:0..9|rec(`id`:("r",i), svg_class:"rect",
                                   fill:IF i=x THEN "red" ELSE "green" END,
                                   title: ```Rectangle ${i} (selected=${x})```,
                                  // title: ```Rectangle ${i}```,
                                   x:10+10*i, y:100, height:20, width:8)};
    VISB_SVG_OBJECTS3 == rec(`id`:"g", svg_class:"g",
                             children: {i•i:0..9|("r",i)},
                             transform:```rotate(${x*40},50,100)```
                            );
VARIABLES x
INVARIANT x:NATURAL
INITIALISATION x:=0
OPERATIONS 
  inc = BEGIN x := (x+1) mod 10 END
END
leuschel commented 8 months ago

View in HTML export: Screenshot 2024-03-09 at 10 54 50

leuschel commented 8 months ago

View in ProB2-UI: Screenshot 2024-03-09 at 10 55 44

leuschel commented 8 months ago

In ProB2-UI, svg_objects seem ok: Screenshot 2024-03-09 at 10 56 39

leuschel commented 8 months ago

and the VisB Item updates as well: Screenshot 2024-03-09 at 10 57 23

leuschel commented 8 months ago

This seems fixed now in prob_prolog by inlining SVG objects into the SVG default contents:

0fda5432 perform inlining of SVG objects for ProB2-UI

We should probably still remove the inlined objects from the list of SVG objects returned to ProB2.