Browse Source

left and right bars

Maxim Sokhatsky 11 years ago
parent
commit
cd5f811826

BIN
apps/web/priv/static/doc/Kakaranet-Scene.sketch/Data


+ 1 - 1
apps/web/priv/static/doc/Kakaranet-Scene.sketch/metadata

@@ -15,7 +15,7 @@
 		<string>LucidaGrande-Bold</string>
 	</array>
 	<key>length</key>
-	<integer>2669832</integer>
+	<integer>2637832</integer>
 	<key>version</key>
 	<integer>36</integer>
 </dict>

+ 4 - 75
apps/web/priv/static/doc/Kakaranet-Scene.svg

@@ -7,7 +7,8 @@
     <title>Kakaranet-Scene</title>
     <description>Created with Sketch.</description>
     <defs>
-    <clipPath id="myClip"><rect id="Clip-Path" x="0" y="0" width="216" height="400"/></clipPath>
+    <clipPath id="myClip1"><rect id="Clip-Path-Left" x="0" y="0" width="216" height="400"/></clipPath>
+    <clipPath id="myClip2"><rect id="Clip-Path-Right" x="0" y="0" width="216" height="400"/></clipPath>
     </defs>
     <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
         <g id="Kakaranet-12-maxim" sketch:type="MSLayerGroup">
@@ -458,7 +459,7 @@
                     <path d="M39.941,28.652 L2.774,28.652 C1.229,28.652 -0.022,27.4 -0.022,25.855 C-0.022,24.31 1.229,23.059 2.774,23.059 L39.941,23.059 C41.485,23.059 42.738,24.31 42.738,25.855 C42.738,27.4 41.485,28.652 39.941,28.652" id="Shape"></path>
                 </g>
             </g>
-            <rect id="Left-Bar" opacity="0.64" fill="#FFFFFF" sketch:type="MSShapeGroup" x="2" y="94.6810161" width="213" height="443" rx="5"></rect>
+            <rect id="Left-Bar" opacity="0.64" fill="#FFFFFF" sketch:type="MSShapeGroup" x="2" y="91" width="213" height="443" rx="5"></rect>
             <g id="Have-8-Tashes" transform="translate(665.000000, 612.000000)">
                 <rect id="Rectangle" fill="#48AF5E" sketch:type="MSShapeGroup" x="0" y="0" width="40" height="35" rx="5"></rect>
                 <text id="8" fill="#FFFFFF" sketch:type="MSTextLayer" transform="translate(19.000000, 16.000000) scale(-1, 1) translate(-19.000000, -16.000000) " font-family="Exo 2" font-size="17" font-weight="normal" sketch:alignment="middle">
@@ -738,79 +739,7 @@
         <path d="M754.82681,16 L735.143994,16 C732.854843,16 731,17.8548426 731,20.1430683 L731,50.1835548 C731,52.4717805 732.854843,54.3266231 735.143994,54.3266231 L754.82681,54.3266231 C757.115036,54.3266231 758.969878,52.4717805 758.969878,50.1835548 L758.969878,20.1430683 C758.968952,17.8548426 757.115036,16 754.82681,16 L754.82681,16 L754.82681,16 Z M744.985865,41.0399123 C741.737344,41.0399123 739.108338,38.4072025 739.108338,35.1623855 C739.108338,31.9147904 741.737344,29.2848588 744.985865,29.2848588 C748.230682,29.2848588 750.863392,31.9147904 750.863392,35.1623855 C750.863392,38.4090546 748.230682,41.0399123 744.985865,41.0399123 L744.985865,41.0399123 L744.985865,41.0399123 Z" id="Okey-Tash-Logo-4" fill="#517ECE" sketch:type="MSShapeGroup"></path>
         <g id="Chat" sketch:type="MSLayerGroup" y="0" clip-path="url(#myClip)" transform="translate(857.000000, 107.000000)">
         </g>
-        <g id="Online-List" sketch:type="MSLayerGroup" y="0" clip-path="url(#myClip)" transform="translate(1.000000, 95.000000)">
-            <g id="Online-Maxim">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#48AF5E" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="7" y="7" width="60" height="60"></rect>
-                <text id="Максим-Сохацкий" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="72" y="25">Максим </tspan>
-                    <tspan x="72" y="43">Сохацкий</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan" transform="translate(0.000000, 74.000000)">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Максим</tspan>
-                    <tspan x="75.685446" y="42">Трескин</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-2" transform="translate(0.000000, 148.000000)">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Влад</tspan>
-                    <tspan x="75.685446" y="42">Кириллов</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-3" transform="translate(0.000000, 222.000000)">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Алексей</tspan>
-                    <tspan x="75.685446" y="42">Радецкий</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-4" transform="translate(0.000000, 296.000000)">
-                <rect id="Rect" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Андрей</tspan>
-                    <tspan x="75.685446" y="42">Мартемьянов</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-5" transform="translate(0.000000, 370.000000)">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Роман</tspan>
-                    <tspan x="75.685446" y="42">Гладков</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-6" transform="translate(0.000000, 444.000000)">
-                <rect id="Rectangle-83" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Андрей</tspan>
-                    <tspan x="75.685446" y="42">Задорожний</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-7" transform="translate(0.000000, 518.000000)">
-                <rect id="Rect" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Синан</tspan>
-                    <tspan x="75.685446" y="42">Устел</tspan>
-                </text>
-            </g>
-            <g id="Online-Sinan-8" transform="translate(0.000000, 592.000000)">
-                <rect id="Rect" stroke="#979797" fill="#DBEBED" sketch:type="MSShapeGroup" x="0" y="0" width="215" height="74"></rect>
-                <rect id="Rectangle-84" stroke="#E5BC7B" stroke-width="3" fill="#D8D8D8" sketch:type="MSShapeGroup" x="8" y="6.59994507" width="60.5633803" height="60"></rect>
-                <text id="Синан" sketch:type="MSTextLayer" font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18" fill="#3B5998">
-                    <tspan x="75.685446" y="24">Ахмет</tspan>
-                    <tspan x="75.685446" y="42">Тез</tspan>
-                </text>
-            </g>
+        <g id="Online-List" sketch:type="MSLayerGroup" y="0" clip-path="url(#myClip)" transform="2translate(1.000000, 107.000000)">
         </g>
         <g id="Player-Statistics" sketch:type="MSLayerGroup" transform="translate(209.000000, 87.000000)">
             <g id="Dialog-2" sketch:type="MSShapeGroup">

+ 80 - 25
apps/web/priv/static/doc/svg.js

@@ -234,15 +234,20 @@ loadFile('templates/Card.svg', function() {
         
         document.getElementById('Page-1').addEventListener("mousewheel", mouseWheelHandler, false);
         
-        var clipPath = svg('<clipPath id="myClip"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path" x="0" y="0" width="216" height="400"/></clipPath>');
-        document.getElementsByTagName('defs').item(0).appendChild(clipPath);
-        document.getElementById("Online-List").setAttribute("clip-path","url(#myClip)");
-        document.getElementById("Chat").setAttribute("clip-path","url(#myClip)");
-        document.getElementById("Clip-Path").setAttribute("transform", "translate(0,0)");
+        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>');
+        document.getElementsByTagName('defs').item(0).appendChild(clipPath1);
+        document.getElementsByTagName('defs').item(0).appendChild(clipPath2);
+        document.getElementById("Online-List").setAttribute("clip-path","url(#myClip1)");
+        document.getElementById("Chat").setAttribute("clip-path","url(#myClip2)");
+        document.getElementById("Clip-Path-Left").setAttribute("transform", "translate(0,0)");
+        document.getElementById("Clip-Path-Right").setAttribute("transform", "translate(0,0)");
         document.getElementById('Player-Statistics').style.display = 'none';
         document.getElementById("Right-Bar").setAttribute("fill","skyblue");
         document.getElementById("Right-Bar").onmouseover = barHover;
         document.getElementById("Right-Bar").onmouseout = barHoverOut;
+        document.getElementById("Left-Bar").onmouseover = onlineHover;
+        document.getElementById("Left-Bar").onmouseout = onlineHoverOut;
         document.getElementById('edit').setAttribute("contentEditable","true");
         document.getElementById('edit').onkeydown = chatEditor;
 
@@ -297,7 +302,8 @@ function drawSampleCards() {
     slotName = slotNameDef; }
 
 var scrollSensitivity = 0.2;
-var scroll = 0;
+var scroll_left = 5;
+var scroll_right = -10000;
 
 function chatMessage(id, me, string) {
     var i=0;
@@ -334,7 +340,7 @@ function chatMessage(id, me, string) {
     textElement.setAttribute("mouseout","barHoverOut(evt);");
     messageElement.setAttribute("onmouseover","barHover(evt);");
     messageElement.setAttribute("onmouseout","barHoverOut(evt);");
-    console.log(messageElement);
+//    console.log(messageElement);
 }
 
 function chatText(id, me, string) {
@@ -344,25 +350,34 @@ function chatText(id, me, string) {
         " xmlns='http://www.w3.org/2000/svg' "+
         " font-family='Exo 2' font-size='16' font-weight='normal' fill='"+colors[i]+"'>" +
             string + "</text>";
-    console.log(html);
+//    console.log(html);
     return svg(html);
 }
 
 function mouseWheelHandler(e) {
 
-    var target = document.getElementById("Right-Bar");
-    if (target.getAttribute("fill")!="skyblue") return;
+    var leftBar = document.getElementById("Left-Bar");
+    var rightBar = document.getElementById("Right-Bar");
+    var leftFill = leftBar.getAttribute("fill");
+    var rightFill = rightBar.getAttribute("fill");
+    var leftActive = leftFill == "skyblue";
+    var rightActive = rightFill == "skyblue";
+    if (!leftActive && !rightActive) return;
+    console.log(leftActive);
 
     var evt = e;
     var scroll_dy = evt.detail ? evt.detail * scrollSensitivity : evt.wheelDelta * scrollSensitivity;
-    var ori = scroll;
-    scroll = parseFloat(scroll_dy) + parseFloat(ori);
-    var limit = parseFloat(document.getElementById("Chat").getBBox().height) - 400;
+    var ori = leftActive ? scroll_left : scroll_right;
+    var scroll = parseFloat(scroll_dy) + parseFloat(ori);
+    var selectedBar = leftActive ? "Online-List" : "Chat";
+    var selectedClip = leftActive ? "Clip-Path-Left" : "Clip-Path-Right";
+    var selectedBarShift = leftActive ? 0 : 857;
+    var limit = parseFloat(document.getElementById(selectedBar).getBBox().height) - 400;
     if (scroll > 5) scroll = 5;
     if (scroll < -limit) scroll = -limit;
-    document.getElementById("Clip-Path").setAttribute("transform", "translate(0,"+parseFloat(-scroll)+")");
-    document.getElementById("Online-List").setAttribute("transform", "translate(0,"+(parseFloat(95+scroll))+")");
-    document.getElementById("Chat").setAttribute("transform", "translate(857,"+(parseFloat(95+scroll))+")");
+    document.getElementById(selectedClip).setAttribute("transform", "translate(0,"+parseFloat(-scroll)+")");
+    document.getElementById(selectedBar).setAttribute("transform", "translate("+selectedBarShift+","+(parseFloat(95+scroll))+")");
+    if (leftActive) scroll_left = scroll; else scroll_right = scroll;
     return true; 
 }
 
@@ -372,7 +387,7 @@ function create_multiline(target) {
     var text_element = target; // evt.target;
     var width = 190; //target.getAttribute("width");
     var words = text_element.firstChild.data.split('');
-    console.log(words);
+//    console.log(words);
 //    var words = [].concat.apply([],lines.map(function(line) { return line.split(' '); }));;
     var start_x = 15; //text_element.getAttribute('x');
     text_element.firstChild.data = '';
@@ -403,14 +418,19 @@ function create_multiline(target) {
     }
 }
 
-function barHover(evt) {
-    var target = document.getElementById("Right-Bar");
-    target.setAttribute("fill","skyblue");
+function barHover(evt) { document.getElementById("Right-Bar").setAttribute("fill","skyblue"); }
+function barHoverOut(evt) { document.getElementById("Right-Bar").setAttribute("fill","lightblue"); }
+function onlineHover(evt) { document.getElementById("Left-Bar").setAttribute("fill","skyblue"); }
+function onlineHoverOut(evt) { document.getElementById("Left-Bar").setAttribute("fill","lightblue"); }
+function onlineHoverColor(evt) {
+    var name = evt.target.getAttribute("xmlns:data");
+    if (null != name) document.getElementById(name).setAttribute("fill","#FFE0A5");
+    onlineHover(evt);
 }
-
-function barHoverOut(evt) {
-    var target = document.getElementById("Right-Bar");
-    target.setAttribute("fill","lightblue");
+function onlineHoverOutColor(evt) { 
+    var name = evt.target.getAttribute("xmlns:data");
+    if (null != name) document.getElementById(name).setAttribute("fill","#DBEBED");
+    onlineHoverOut(evt);
 }
 
 function chatEditor(evt) {
@@ -427,7 +447,42 @@ function chatEditor(evt) {
     mouseWheelHandler({'detail':scroll,'wheelDelta':scroll});
 }
 
+function addOnlineUser(name,full_name,insertMode) {
+    var listElement = document.getElementById("Online-List");
+    var y = listElement.getBBox().height;
+//    console.log(y);
+    var html = '<g xmlns="http://www.w3.org/2000/svg" height="60" transform="translate(0, '+y+')">' +
+            '<g fill="#DBEBED">' +
+            '    <rect id="'+name+'" x="10" y="0" width="196" height="48" onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);"></rect></g>' +
+            '<text xmlns:data="'+name+'" onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);" '+
+            'font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18"'+
+            ' fill="#3B5998">' + 
+                '<tspan xmlns:data="'+name+'" font-weight="bold" fill="green" x="19" y="22">'+full_name+'</tspan>' + 
+                '<tspan xmlns:data="'+name+'" x="19" y="40">Score: 1043 Pos: 13</tspan></text>'+
+            '<rect onmouseover="onlineHover(evt);" onmouseout="onlineHoverOut(evt);"'+
+            '  x="10" y="48" width="196" height="8"></rect></g>';
+    var element = svg(html);
+    element.setAttribute("mouseover","onlineHoverColor(evt);");
+    element.setAttribute("mouseout","onlineHoverOutColor(evt);");
+//    console.log(element);
+    listElement.appendChild(element);
+}
+
 chatMessage("1","Maxim2","Joe:\nHello There!".encodeHTML());
 chatMessage("2","Maxim2","Alice:\nYou got new Design. Eh?".encodeHTML());
 chatMessage("3","Maxim","Maxim So:\nThis was made with pure SVG".encodeHTML());
-mouseWheelHandler({'detail':-100000,'wheelDelta':-1000000});
+
+
+for (var i=0;i<5;i++) {
+addOnlineUser("Maxim1"+i,"Maxim Sokhatsky",'appendChild');
+addOnlineUser("Maxim2"+i,"Sinan Ustel",'appendChild');
+addOnlineUser("Maxim3"+i,"Ahmet Tez",'appendChild');
+addOnlineUser("Maxim4"+i,"Alice Cooper",'appendChild');
+}
+
+barHover();
+mouseWheelHandler({'detail':-100000,'wheelDelta':-100000});
+barHoverOut();
+onlineHover();
+mouseWheelHandler({'detail':5,'wheelDelta':5});
+onlineHoverOut();

+ 1 - 1
apps/web/priv/static/doc/svg_clean.htm

@@ -12,7 +12,7 @@
 
 <div class="controls" id="history" height=0 width=0>
 <button class="controls" id="pluslogin" type="button" data-gapiattached="true">Login</button>
-<label class="controls"  id="nothing"> Google</label></div>
+<label class="controls"  id="gosterge"> Google</label></div>
 <label class="controls"  id="player1"> Albert Einstein </label><select  class="controls" id="h1"></select>
 <label class="controls"  id="player2"> Marie Curie </label><select  class="controls" id="h2"></select>
 <label class="controls"  id="player3"> Ilya Prigogine </label><select  class="controls" id="h3"></select>