Sfoglia il codice sorgente

fixed the classic "UI Layout Callback Error"

Henry Oswald 11 anni fa
parent
commit
69b5eaad19
1 ha cambiato i file con 21 aggiunte e 19 eliminazioni
  1. 21 19
      services/web/public/coffee/ide/directives/layout.coffee

+ 21 - 19
services/web/public/coffee/ide/directives/layout.coffee

@@ -40,13 +40,33 @@ define [
 						options.west = state.west
 						options.west = state.west
 						options.east = state.east
 						options.east = state.east
 
 
+					repositionControls = () ->
+						state = element.layout().readState()
+						if state.east?
+							controls = element.find("> .ui-layout-resizer-controls")
+							if state.east.initClosed
+								controls.hide()
+							else
+								controls.show()
+								controls.css({
+									position: "absolute"
+									right: state.east.size
+									"z-index": 10
+								})
+
+					resetOpenStates = () ->
+						state = element.layout().readState()
+						if attrs.openEast? and state.east?
+							openEast = $parse(attrs.openEast)
+							openEast.assign(scope, !state.east.initClosed)
+
 					# Someone moved the resizer
 					# Someone moved the resizer
 					onInternalResize = () ->
 					onInternalResize = () ->
 						state = element.layout().readState()
 						state = element.layout().readState()
 						scope.$broadcast "layout:#{name}:resize", state
 						scope.$broadcast "layout:#{name}:resize", state
 						repositionControls()
 						repositionControls()
 						resetOpenStates()
 						resetOpenStates()
-
+						
 					oldWidth = element.width()
 					oldWidth = element.width()
 					# Something resized our parent element
 					# Something resized our parent element
 					onExternalResize = () ->
 					onExternalResize = () ->
@@ -70,25 +90,7 @@ define [
 					$(window).unload () ->
 					$(window).unload () ->
 						$.localStorage("layout.#{name}", element.layout().readState())
 						$.localStorage("layout.#{name}", element.layout().readState())
 
 
-					repositionControls = () ->
-						state = element.layout().readState()
-						if state.east?
-							controls = element.find("> .ui-layout-resizer-controls")
-							if state.east.initClosed
-								controls.hide()
-							else
-								controls.show()
-								controls.css({
-									position: "absolute"
-									right: state.east.size
-									"z-index": 10
-								})
 
 
-					resetOpenStates = () ->
-						state = element.layout().readState()
-						if attrs.openEast? and state.east?
-							openEast = $parse(attrs.openEast)
-							openEast.assign(scope, !state.east.initClosed)
 
 
 					if attrs.openEast?
 					if attrs.openEast?
 						scope.$watch attrs.openEast, (value, oldValue) ->
 						scope.$watch attrs.openEast, (value, oldValue) ->