on master help sign in
Merge pull request #712 from michaelbjames/debugger-trace
0a1ccbbEvan Czaplicki
libraries/Debug.elm+3−3
@@ -9,7 +9,7 @@ module Debug where
9@docs watch, watchSummary, trace
9@docs watch, watchSummary, trace
10-}
10-}
11
11
12−import Graphics.Element (Element)
12+import Graphics.Collage (Form)
13import Native.Debug
13import Native.Debug
14import Native.Error
14import Native.Error
15
15
@@ -60,7 +60,7 @@ watch = Native.Debug.watch
60watchSummary : String -> (a -> b) -> a -> a
60watchSummary : String -> (a -> b) -> a -> a
61watchSummary = Native.Debug.watchSummary
61watchSummary = Native.Debug.watchSummary
62
62
63−{-| Trace an Element over time in the reactive debugger.
63+{-| Trace a Form over time in the reactive debugger.
64-}
64-}
65−trace : String -> Element -> Element
65+trace : String -> Form -> Form
66trace = Native.Debug.tracePath
66trace = Native.Debug.tracePath
libraries/Native/Debug.js+2−3
@@ -20,9 +20,8 @@ Elm.Native.Debug.make = function(elm) {
20 return value;
20 return value;
21 }
21 }
22
22
23− function tracePath(debugId, elem) {
23+ function tracePath(debugId, form) {
24− var props = replace([["debugTracePathId",debugId]], elem.props);
24+ return replace([["debugTracePathId",debugId]], form);
25− return replace([["props",props]], elem);
26 }
25 }
27
26
28 function WatchTracker() {
27 function WatchTracker() {
runtime/Debugger.js+9−4
@@ -391,10 +391,6 @@ function tracePathInit(runtime, signalGraphMain) {
391 {
391 {
392 List.map(F2(processForm)(offset))(elem.element.model.forms);
392 List.map(F2(processForm)(offset))(elem.element.model.forms);
393 }
393 }
394− if (elem.props.debugTracePathId)
395− {
396− positions[elem.props.debugTracePathId] = new Point(offset.x, offset.y);
397− }
398 }
394 }
399
395
400 function processForm(offset, form) {
396 function processForm(offset, form) {
@@ -402,6 +398,15 @@ function tracePathInit(runtime, signalGraphMain) {
402 {
398 {
403 processElement(form.form._0, offset.translate(form.x, -form.y));
399 processElement(form.form._0, offset.translate(form.x, -form.y));
404 }
400 }
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+ }
405 }
410 }
406
411
407 processElement(currentScene, new Point(0, 0));
412 processElement(currentScene, new Point(0, 0));