 
             if factor > 1 and panelBody = element[0].querySelector('.panel-body')
               totalHeight = ystep * factor - margin
+              console.log totalHeight, ystep, factor
               panelBody.style.height = "#{ totalHeight - (p1.y - panelBody.offsetTop) }px"
               element.addClass 'expanded'
 
           $window.addEventListener 'resize', ->
             element[0].querySelector('.panel-body')?.style.height = null
             element.removeClass 'expanded'
-            setTimeout doResize, 10
-
-          setTimeout doResize, 10
+            $timeout doResize, 10
+
+          $timeout doResize, 10
+
+  toolCssLoaded = {}
 
   Directives.directive 'nativeTool', ($window, $compile, $injector) ->
     restrict: 'E'
     scope:
       tool: '=tool'
+      actions: '=actions'
+      state: '=state'
     link: (scope, element, attrs) ->
 
       scope.$watch 'tool.controllerURI', ->
         if scope.tool
+
+          if scope.tool.style and not toolCssLoaded[scope.tool.style]
+            link = $window.document.createElement('link')
+            link.rel = 'stylesheet'
+            link.href = scope.tool.style
+            document.getElementsByTagName('head')[0].appendChild(link)
+            toolCssLoaded[scope.tool.style] = true
 
           ctrl = $window.location.origin + scope.tool.controllerURI
           tmpl = $window.location.origin + scope.tool.templateURI

require ['angular', 'lodash', 'lines', 'jschannel', 'services'], (ng, L, lines, Channel) ->

  Directives = ng.module('steps.directives', ['steps.services'])

  Directives.directive 'appVersion', ['version', (v) -> (scope, elm) -> elm.text(version)]


            maxy = L.max offsets.map (o) -> o.top + o.height
            topBars = getTopBars offsets
            ystep = element[0].offsetHeight
            unless ystep
              $timeout doResize, 10
              return

            p1 =
              x: element[0].offsetLeft
              y: element[0].offsetTop + 1 # Don't get intersects with own top bar.
