Ver código fonte

spinner + resol checking

David 9 anos atrás
pai
commit
312a1b6035
1 arquivos alterados com 32 adições e 7 exclusões
  1. 32 7
      main.qml

+ 32 - 7
main.qml

@@ -12,7 +12,8 @@ ApplicationWindow {
     id: aw
     visible: true
     width: portrait ? 600 : 1280
-    height: portrait ? 960 : 720
+    //height: portrait ? 960 : 720
+    height: portrait ? 960 : Screen.height
     visibility: portrait ? "FullScreen" : "Windowed"
     color: "#fffffe"
 
@@ -26,7 +27,6 @@ ApplicationWindow {
         transformOrigin: Item.Center
         rotation: aw.portrait ? 90 : 0
         property alias mouseArea1: mouseArea1
-        property alias button3: button3
         property int curImage: 1
         property variant pregs: []
 
@@ -69,7 +69,8 @@ ApplicationWindow {
             Rectangle {
                 id: canvasCol
                 height: grid1.height
-                width: Screen.height > Screen.width ? grid1.width *3/4 : grid1.width/2
+                //width: Screen.height > Screen.width ? grid1.width *3/4 : grid1.width/2
+                width: Screen.height > Screen.width ? grid1.width *3/4 : Math.min(grid1.height * 4/3, grid1.width*3/4)
                 color: "#333"
                 smooth: false
                 //aw.color
@@ -140,9 +141,7 @@ ApplicationWindow {
                             lastpoint = pts[pts.length-1];
 
                         pts.push(p)
-                        //setTimeout(function() {
                         socket.send_point(normalizeTo800by600(p));
-                        //}, 100);
 
                         if (lastpoint) {
                             markDirty(Qt.rect(Math.min(p.x,lastpoint.x),Math.min(p.y,lastpoint.y), Math.abs(p.x-lastpoint.x)+4, Math.abs(p.y-lastpoint.y)+4));
@@ -173,7 +172,10 @@ ApplicationWindow {
                         if (ctx === null )
                             ctx = canvas.getContext("2d");
 
-                        if ( region === undefined || region.width > 150 || region.height > 150 ) {
+                        if ( region === undefined || region.width > 350 || region.height > 350 ) {
+                           // console.log("FULL REPAINT");
+                            if (region)
+                              //  console.log("W:", region.width, "H:", region.height);
                             if (canvas.isImageLoaded(curImageUrl))
                                 ctx.drawImage(curImageUrl, 0, 0, canvas.width, canvas.height)
                             var j = 0
@@ -183,6 +185,7 @@ ApplicationWindow {
                                 stroke(points_array[j].points,points_array[j].color);
                             }
                         } else {
+                            //console.log("PARTIAL REPAINT");
                             var lastLine = points_array[points_array.length-1];
                             if (lastLine === undefined)
                                 return;
@@ -211,8 +214,11 @@ ApplicationWindow {
                         if (!socket.isOpen)
                             return
                         var point = { x: mouse.x, y: mouse.y }
-                        if (distance(last_point, point) <= 200) //distance returns squared dsitance
+                        var dist = distance(last_point, point);
+                        if (dist <= 1000) //distance returns squared dsitance
                             return;
+                        console.log("NEW POINT, DISTANCE:", dist)
+                        console.log(Screen.height, Screen.width);
                         last_point = point
                         canvas.add_point(point)
                     }
@@ -226,11 +232,30 @@ ApplicationWindow {
                     }
                 }
             }
+            Item {
+                id: spinnerCol
+                width: parent.width - canvasCol.width - parent.spacing * 2
+                height: parent.height
+                visible: !socket.isOpen
+                BusyIndicator {
+                    id: busy
+                    anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+                    running: !socket.isOpen
+                }
+                Label {
+                    text: "Hubo un problema.. reconectando"
+                    anchors.horizontalCenter: parent.horizontalCenter
+                    anchors.top: busy.top + 20
+                    height: 80
+
+                }
+            }
             Column {
                 id: columnLayout1
                 spacing: 10
                 width: parent.width - canvasCol.width - parent.spacing * 2
                 height: parent.height
+                visible: socket.isOpen
                 Column {
                     width: parent.width
                     height: parent.height / 2 - 10