summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-25 13:43:19 +0800
committerWu Cheng-Han2015-09-25 13:43:19 +0800
commit9acd07058169b7b6a2ef700f7b671a06b77a0340 (patch)
tree3f440d00eb1801e7733b269f4006ac2913a9abcb /public/js
parentf8b029b2f4e9801aa20b80c77b452537ff463de5 (diff)
Fixed socket set wrong cursor data on receive, prevent buildCursor execute on view mode
Diffstat (limited to '')
-rw-r--r--public/js/index.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js
index ae3edb28..199be888 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1126,7 +1126,7 @@ socket.on('cursor focus', function (data) {
console.debug(data);
for (var i = 0; i < onlineUsers.length; i++) {
if (onlineUsers[i].id == data.id) {
- onlineUsers[i].cursor = data;
+ onlineUsers[i].cursor = data.cursor;
}
}
if (data.id != socket.id)
@@ -1142,7 +1142,7 @@ socket.on('cursor activity', function (data) {
console.debug(data);
for (var i = 0; i < onlineUsers.length; i++) {
if (onlineUsers[i].id == data.id) {
- onlineUsers[i].cursor = data;
+ onlineUsers[i].cursor = data.cursor;
}
}
if (data.id != socket.id)
@@ -1384,6 +1384,7 @@ function checkCursorTag(coord, ele) {
}
function buildCursor(user) {
+ if (currentMode == modeType.view) return;
if (!user.cursor) return;
var coord = editor.charCoords(user.cursor, 'windows');
coord.left = coord.left < 4 ? 4 : coord.left;
@@ -1497,6 +1498,9 @@ function buildCursor(user) {
cursortag.find('i').removeClass().addClass('fa').addClass(iconClass);
cursortag.find(".name").text(user.name);
+ cursor[0].style.left = coord.left + 'px';
+ cursor[0].style.top = coord.top + 'px';
+ /*
if (cursor.css('display') === 'none') {
cursor[0].style.left = coord.left + 'px';
cursor[0].style.top = coord.top + 'px';
@@ -1509,6 +1513,7 @@ function buildCursor(user) {
queue: false
});
}
+ */
if (user.idle && cursor.css('display') !== 'none')
cursor.stop(true).fadeOut();