mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 13:53:37 -05:00
always send the latest position when emitting updatePosition event
Avoid sending outdated position by capturing the current position in $scope.currentPostion on every call and sending it the when the timer for updatePosition runs.
This commit is contained in:
parent
c583903e04
commit
d0c759c6fb
1 changed files with 5 additions and 3 deletions
|
@ -82,13 +82,15 @@ define [
|
|||
|
||||
|
||||
sendCursorPositionUpdate: (position) ->
|
||||
if position?
|
||||
@$scope.currentPosition = position # keep track of the latest position
|
||||
if !@cursorUpdateTimeout?
|
||||
@cursorUpdateTimeout = setTimeout ()=>
|
||||
doc_id = @$scope.editor.open_doc_id
|
||||
|
||||
# always send the latest position to other clients
|
||||
@ide.socket.emit "clientTracking.updatePosition", {
|
||||
row: position.row
|
||||
column: position.column
|
||||
row: @$scope.currentPosition?.row
|
||||
column: @$scope.currentPosition?.column
|
||||
doc_id: doc_id
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue