Skip to content
Snippets Groups Projects
Verified Commit 807e5819 authored by Björn Eßwein's avatar Björn Eßwein
Browse files

Display the label for the scroll solution

parent d551cbce
No related branches found
No related tags found
No related merge requests found
......@@ -89,9 +89,9 @@ private async void SetScrollContent(Scroll scroll)
var description = scroll.description;
if (Regex.IsMatch(description, ".*<scroll-description.*"))
{
// replace slot templates
description = Regex.Replace(description, "<scroll-slot([^>]*)>([^<]*)</scroll-slot>", match =>
{
Debug.LogWarning($"Regex: Value'{match.Value}', Group[{match.Groups.Count - 1}]={match.Groups[match.Groups.Count -1]}");
var extraAttributes = match.Groups[1].Value;
var slotId = match.Groups[2].Value;
var assignment = SwitchScrollUI.activeScrollData.Assignments[slotId];
......@@ -99,6 +99,13 @@ private async void SetScrollContent(Scroll scroll)
var label = assignment.IsSet ? assignment.fact.GetLabel(StageStatic.stage.factState) : scroll.requiredFacts.Find(fact => fact.@ref.uri == slotId).label;
return $"<mi dropzone='copy' data-slot-id='{slotId}' {(assignment.IsSet ? $"data-fact-id='{assignment.fact.Id}'" : "")} {extraAttributes}>{label}</mi>";
});
// replace solution templates
description = Regex.Replace(description, "<scroll-solution([^>]*)>([^<]*)</scroll-solution>", match =>
{
var extraAttributes = match.Groups[1].Value;
var solutionId = match.Groups[2].Value;
return $"<mi data-solution-id='{solutionId}' {extraAttributes}>{scroll.acquiredFacts.Find(fact => fact.@ref.uri == solutionId).label}</mi>";
});
}
else
{
......
......@@ -19,15 +19,11 @@
position: absolute;
background-color: red;
}
.demoFact {
font-size: initial;
margin-top: 20px;
}
</style>
</head>
<body>
<div id="scrollContainer">
<div>Default Scroll</div>
<div>No scroll selected</div>
<math>
<mi>E</mi>
<mo>=</mo>
......@@ -70,7 +66,7 @@
</math>
</div>
<button type="button" title="Apply the scroll" onclick="applyScroll('')">Magic</button><br>
<button type="button" title="Hint" onclick="getHint('http://mathhub.info/FrameIT/frameworld?TriangleProblem_RightAngleAtC?rightAngleC')">Hint</button>
<p>Right click on a slot to get a hint.</p>
</body>
<script>
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment