Browse Source

supposingly fix shift translate

Maxim Sokhatsky 11 years ago
parent
commit
c03dca32c3
2 changed files with 8 additions and 12 deletions
  1. 7 8
      apps/web/priv/static/app/js/chat.js
  2. 1 4
      apps/web/priv/static/app/js/roster.js

+ 7 - 8
apps/web/priv/static/app/js/chat.js

@@ -2,8 +2,8 @@
 // Online User Chat and In-Game Chat
 // Online User Chat and In-Game Chat
 
 
 var scrollSensitivity = 0.2;
 var scrollSensitivity = 0.2;
-var scroll_left = 0;
-var scroll_left_chat = 0;
+var scroll_left = 5;
+var scroll_left_chat = 5;
 var scroll_right = -10000;
 var scroll_right = -10000;
 var currentChat = null;
 var currentChat = null;
 var user_count = 0;
 var user_count = 0;
@@ -126,7 +126,7 @@ function showOnlineList(evt)
     document.getElementById("Online-List").style.display = '';
     document.getElementById("Online-List").style.display = '';
     currentChat = null;
     currentChat = null;
 
 
-    scroll_left = 0;
+    scroll_left = 5;
     onlineHover();
     onlineHover();
     mouseWheelHandler({'detail':scroll_left,'wheelDelta':scroll_left});
     mouseWheelHandler({'detail':scroll_left,'wheelDelta':scroll_left});
     onlineHoverOut();
     onlineHoverOut();
@@ -148,7 +148,7 @@ function addOnlineUser(name,full_name,insertMode) {
     var events = ' onmouseover="onlineHover(evt);" onmouseout="onlineHoverOut(evt);" ' + clickEvent;
     var events = ' onmouseover="onlineHover(evt);" onmouseout="onlineHoverOut(evt);" ' + clickEvent;
     var eventsColor = ' onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);" ' + clickEvent;
     var eventsColor = ' onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);" ' + clickEvent;
     var color = insertMode == "insertTop" ? "red" : "green";
     var color = insertMode == "insertTop" ? "red" : "green";
-    var y = (insertMode == "insertTop") ? "0" : listElement.getBBox().height;
+    var y = (insertMode == "insertTop") ? 0 : listElement.getBBox().height;
     var html = '<g xmlns="http://www.w3.org/2000/svg" height="60" transform="translate(0, '+y+')">' +
     var html = '<g xmlns="http://www.w3.org/2000/svg" height="60" transform="translate(0, '+y+')">' +
             '<g xmlns:data="'+name+'" fill="#DBEBED" '+eventsColor+'>' +
             '<g xmlns:data="'+name+'" fill="#DBEBED" '+eventsColor+'>' +
             '    <rect cursor="pointer" xmlns:data="'+name+'" fill="#DBEBED" id="'+name+'" x="10" y="0" width="196" height="48" ' +'></rect></g>' +
             '    <rect cursor="pointer" xmlns:data="'+name+'" fill="#DBEBED" id="'+name+'" x="10" y="0" width="196" height="48" ' +'></rect></g>' +
@@ -164,7 +164,7 @@ function addOnlineUser(name,full_name,insertMode) {
         var firstElement = listElement.firstElementChild;
         var firstElement = listElement.firstElementChild;
         if (null == firstElement) listElement.appendChild(element); else {
         if (null == firstElement) listElement.appendChild(element); else {
             var first = firstElement.firstElementChild.getAttribute("xmlns:data");
             var first = firstElement.firstElementChild.getAttribute("xmlns:data");
-            shiftTranslate(first,1);
+            shiftTranslate(first, 1);
             listElement.insertBefore(element,firstElement);
             listElement.insertBefore(element,firstElement);
         }
         }
     } else listElement.appendChild(element);
     } else listElement.appendChild(element);
@@ -176,7 +176,7 @@ function shiftTranslate(name,shiftValue) {
     var remove = rect.parentNode.parentNode;
     var remove = rect.parentNode.parentNode;
     var children = document.getElementById("Online-List").childNodes;
     var children = document.getElementById("Online-List").childNodes;
     var removeIndex = -1;
     var removeIndex = -1;
-    for(var i = 0; i<children.length; ++i) { 
+    for(var i = 0; i<children.length; i++) { 
         var child = children[i];
         var child = children[i];
         if (child == remove) removeIndex = i;
         if (child == remove) removeIndex = i;
         if (removeIndex != -1 && i>=removeIndex)
         if (removeIndex != -1 && i>=removeIndex)
@@ -186,7 +186,7 @@ function shiftTranslate(name,shiftValue) {
     return rect.parentNode.parentNode;
     return rect.parentNode.parentNode;
 }
 }
 
 
-function removeOnlineUser(name) { shiftTranslate(name,-2).remove(); }
+function removeOnlineUser(name) { shiftTranslate(name,-1).remove(); }
 
 
 function openChat(evt) {
 function openChat(evt) {
     document.getElementById("Online-List").style.display = 'none';
     document.getElementById("Online-List").style.display = 'none';
@@ -261,7 +261,6 @@ function initChat()
     page.insertBefore(svg(onlineList),settings);
     page.insertBefore(svg(onlineList),settings);
     page.insertBefore(svg(onlineChat),settings);
     page.insertBefore(svg(onlineChat),settings);
 
 
-
     var clipPath1 = svg('<clipPath id="myClip1"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Left" x="0" y="0" width="216" height="400"/></clipPath>');
     var clipPath1 = svg('<clipPath id="myClip1"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Left" x="0" y="0" width="216" height="400"/></clipPath>');
     var clipPath2 = svg('<clipPath id="myClip2"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Right" x="0" y="0" width="216" height="400"/></clipPath>');
     var clipPath2 = svg('<clipPath id="myClip2"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Right" x="0" y="0" width="216" height="400"/></clipPath>');
     var clipPath3 = svg('<clipPath id="myClip3"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Left-Chat" x="0" y="0" width="216" height="400"/></clipPath>');
     var clipPath3 = svg('<clipPath id="myClip3"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Left-Chat" x="0" y="0" width="216" height="400"/></clipPath>');

+ 1 - 4
apps/web/priv/static/app/js/roster.js

@@ -34,10 +34,7 @@ function RosterHandlers(scope) {
 
 
     scope.apiProvider.on("roster_end", function (x) {
     scope.apiProvider.on("roster_end", function (x) {
         var e = {detail: x.detail.json, raw: x.detail.bert};
         var e = {detail: x.detail.json, raw: x.detail.bert};
-        onlineHover();
-        mouseWheelHandler({'detail':scroll,'wheelDelta':scroll});
-        onlineHoverOut();
-        document.getElementById("Online-List").style.display = '';
+        showOnlineList();
     });
     });
 
 
     scope.apiProvider.on("roster_group", function (x) {
     scope.apiProvider.on("roster_group", function (x) {