Skip to content
Snippets Groups Projects
Commit 2401d514 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

show how to do hover with dynamic infos

parent 2530bfdd
Branches
No related tags found
No related merge requests found
...@@ -8,6 +8,18 @@ ...@@ -8,6 +8,18 @@
"value":"svg_train(train_rear_end, train_length ,100.0/real(TrackElementNumber+1),1.0,3.0)", "value":"svg_train(train_rear_end, train_length ,100.0/real(TrackElementNumber+1),1.0,3.0)",
"comment":"show train position using a slanted polygon" "comment":"show train position using a slanted polygon"
}, },
{
"id":"train_info_text",
"attr":"x",
"value":"real(train_rear_end)*100.0/real(TrackElementNumber+1)",
"comment":"move info field above train"
},
{
"id":"train_info_text",
"attr":"text",
"value":"\"Train1: \" ^ TO_STRING(train_rear_end) ^ \"..\" ^ TO_STRING(train_rear_end+train_length)",
"comment":"move info field above train"
},
{ {
"id":"track_polyline", "id":"track_polyline",
...@@ -53,8 +65,8 @@ ...@@ -53,8 +65,8 @@
"id":"train_polygon", "id":"train_polygon",
"event":"TrainMoveForward", "event":"TrainMoveForward",
"optional" : true, "optional" : true,
"hovers": [{ "attr":"fill", "enter":"red", "leave":"lightgray"}, "hovers": [{ "attr":"class", "enter":"train-hover", "leave":"train-normal"},
{ "attr":"stroke-width", "enter":"0.5", "leave":"0.3"}] { "id":"train_info_text", "attr":"visibility", "enter":"visible", "leave":"hidden"}]
} }
] ]
} }
\ No newline at end of file
...@@ -19,13 +19,28 @@ ...@@ -19,13 +19,28 @@
.blue-cleared-ttd { .blue-cleared-ttd {
fill : blue fill : blue
} }
.train-normal {
stroke-width: 0.25;
stroke : black;
fill : lightgray
}
.train-hover {
fill : red;
stroke-width: 0.5;
stroke : black;
}
</style> </style>
<polygon id = "train_polygon" <polygon id = "train_polygon"
points="0,0 100,0" points="0,0 100,0"
style="stroke-width: 0.3" class="train-normal"
stroke="black" fill="lightgray"
transform="translate(10,16.8)" /> transform="translate(10,16.8)" />
<g transform="translate(10,16.8)">
<text text-align="left" x="0" y="-2"
font-size ="2" fill="gray" font-family="sans-serif ">
<tspan x="3" id="train_info_text" visibility="hidden">Train 1</tspan>
</text>
</g>
<polygon id = "track_polyline" <polygon id = "track_polyline"
points="0,0 1,0, 1,1 1,0 50,0 50,1 50,0 100,0" points="0,0 1,0, 1,1 1,0 50,0 50,1 50,0 100,0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment