on master help sign in
Merge pull request #712 from michaelbjames/debugger-trace

Change type of Debug.trace to String -> Form -> Form

commit0a1ccbbc0936f03d75f643cdc1fe3b6b874da943 authorEvan Czaplicki <info@elm-lang.org> dateFri 1 Aug 2014, 13:44 (12 years ago) parentc3d3c3340a01df
3 files changed+14−10
libraries/Debug.elm+3−3 libraries/Native/Debug.js+2−3 runtime/Debugger.js+9−4
libraries/Debug.elm+3−3
@@ -9,7 +9,7 @@ module Debug where
99@docs watch, watchSummary, trace
1010-}
1111
12−import Graphics.Element (Element)
12+import Graphics.Collage (Form)
1313import Native.Debug
1414import Native.Error
1515
@@ -60,7 +60,7 @@ watch = Native.Debug.watch
6060watchSummary : String -> (a -> b) -> a -> a
6161watchSummary = Native.Debug.watchSummary
6262
63−{-| Trace an Element over time in the reactive debugger.
63+{-| Trace a Form over time in the reactive debugger.
6464-}
65−trace : String -> Element -> Element
65+trace : String -> Form -> Form
6666trace = Native.Debug.tracePath
libraries/Native/Debug.js+2−3
@@ -20,9 +20,8 @@ Elm.Native.Debug.make = function(elm) {
2020 return value;
2121 }
2222
23− function tracePath(debugId, elem) {
24− var props = replace([["debugTracePathId",debugId]], elem.props);
25− return replace([["props",props]], elem);
23+ function tracePath(debugId, form) {
24+ return replace([["debugTracePathId",debugId]], form);
2625 }
2726
2827 function WatchTracker() {
runtime/Debugger.js+9−4
@@ -391,10 +391,6 @@ function tracePathInit(runtime, signalGraphMain) {
391391 {
392392 List.map(F2(processForm)(offset))(elem.element.model.forms);
393393 }
394− if (elem.props.debugTracePathId)
395− {
396− positions[elem.props.debugTracePathId] = new Point(offset.x, offset.y);
397− }
398394 }
399395
400396 function processForm(offset, form) {
@@ -402,6 +398,15 @@ function tracePathInit(runtime, signalGraphMain) {
402398 {
403399 processElement(form.form._0, offset.translate(form.x, -form.y));
404400 }
401+ if (form.form.ctor == "FGroup")
402+ {
403+ var newOffset = offset.translate(form.x, -form.y);
404+ List.map(F2(processForm)(newOffset))(form.form._1);
405+ }
406+ if (form.debugTracePathId)
407+ {
408+ positions[form.debugTracePathId] = new Point(form.x + offset.x, -form.y + offset.y);
409+ }
405410 }
406411
407412 processElement(currentScene, new Point(0, 0));