Explorar el Código

Add event to trigger syncToPdf so can be triggered by key bind

Alasdair Smith hace 8 años
padre
commit
5eb2410f5d

+ 3 - 0
services/web/public/coffee/ide/editor/directives/aceEditor/cursor-position/CursorPositionManager.coffee

@@ -37,6 +37,9 @@ define [], () ->
 		onCursorChange: () =>
 			@emitCursorUpdateEvent()
 
+		onSyncToPdf: () =>
+			@$scope.$emit "cursor:#{@$scope.name}:syncToPdf"
+
 		storeFirstVisibleLine: () ->
 			if @doc_id?
 				docPosition = @localStorage("doc.position.#{@doc_id}") || {}

+ 2 - 0
services/web/public/coffee/ide/pdf/controllers/PdfController.coffee

@@ -718,6 +718,8 @@ define [
 				.then (highlights) ->
 					$scope.pdf.highlights = highlights
 
+		ide.$scope.$on "cursor:editor:syncToPdf", $scope.syncToPdf
+
 		$scope.syncToCode = () ->
 			synctex
 				.syncToCode($scope.pdf.position, includeVisualOffset: true, fromPdfPosition: true)