Juergen 'eTM' Mangler 1 year ago
parent
commit
84e62295d4
3 changed files with 10 additions and 12 deletions
  1. 7 7
      lib/cpee-frames/implementation.rb
  2. 2 3
      ui/js/frame_data.js
  3. 1 2
      ui/js/ui.js

+ 7 - 7
lib/cpee-frames/implementation.rb

@@ -98,7 +98,7 @@ module CPEE
 
 
         #check if new frame overlaps others if it does, delete overlapped frames
         #check if new frame overlaps others if it does, delete overlapped frames
         data_hash["data"].each do | c |
         data_hash["data"].each do | c |
-          if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
+          if CPEE::Frames::doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
             data_hash["data"].delete(c)
             data_hash["data"].delete(c)
           end
           end
         end
         end
@@ -143,7 +143,7 @@ module CPEE
 
 
         #check if new frame overlaps others if it does, delete overlapped frames
         #check if new frame overlaps others if it does, delete overlapped frames
         data_hash["data"].each do | c |
         data_hash["data"].each do | c |
-          if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
+          if CPEE::Frames::doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
             data_hash["data"].delete(c)
             data_hash["data"].delete(c)
           end
           end
         end
         end
@@ -195,7 +195,7 @@ module CPEE
         data_hash = JSON::parse(file)
         data_hash = JSON::parse(file)
 
 
         data_hash["data"].each do | c |
         data_hash["data"].each do | c |
-          if doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[0].value.to_i, @p[1].value.to_i, (@p[0].value.to_i + 1), (@p[1].value.to_i + 1))
+          if CPEE::Frames::doOverlap(c['lx'], c['ly'], c['rx'], c['ry'], @p[0].value.to_i, @p[1].value.to_i, (@p[0].value.to_i + 1), (@p[1].value.to_i + 1))
             data_hash["data"].delete(c)
             data_hash["data"].delete(c)
           end
           end
         end
         end
@@ -204,14 +204,14 @@ module CPEE
       end
       end
     end
     end
 
 
-    def doOverlap(l1x, l1y, r1x, r1y, l2x, l2y, r2x, r2y)
+    def self::doOverlap(l1x, l1y, r1x, r1y, l2x, l2y, r2x, r2y)
       if l1x > r2x || l2x > r1x
       if l1x > r2x || l2x > r1x
-          return false;
+        return false
       end
       end
       if l1y > r2y || l2y > r1y
       if l1y > r2y || l2y > r1y
-          return false;
+        return false
       end
       end
-      return true;
+      return true
     end
     end
 
 
     class Delete < Riddl::Implementation
     class Delete < Riddl::Implementation

+ 2 - 3
ui/js/frame_data.js

@@ -7,7 +7,7 @@ function showDocument(fr = "") {
       type: "GET",
       type: "GET",
       url: 'https://centurio.work/out/frames/' + fr + '/dataelements.json',
       url: 'https://centurio.work/out/frames/' + fr + '/dataelements.json',
       success: function(ret) {
       success: function(ret) {
-       
+
         $("#alldata").text(JSON.stringify(ret["ausfuehrungen"]));
         $("#alldata").text(JSON.stringify(ret["ausfuehrungen"]));
       },
       },
       error: function() {
       error: function() {
@@ -20,7 +20,6 @@ function showDocument(fr = "") {
 
 
 
 
 function clearDocument() {
 function clearDocument() {
-  console.log('rrrr');
 }
 }
 
 
 
 
@@ -47,7 +46,7 @@ function init() {
         catch (e) {
         catch (e) {
         }
         }
       }
       }
-        
+
     }
     }
   };
   };
   es.onerror = function() {
   es.onerror = function() {

+ 1 - 2
ui/js/ui.js

@@ -282,9 +282,7 @@ function showDocument() {
   */
   */
 }
 }
 
 
-
 function clearDocument() {
 function clearDocument() {
-  console.log('rrrr');
   $('#languages').addClass('hidden');
   $('#languages').addClass('hidden');
   $('#nope').removeClass('hidden');
   $('#nope').removeClass('hidden');
   $('#control .added').remove();
   $('#control .added').remove();
@@ -330,6 +328,7 @@ function init() {
   es.onerror = function() {
   es.onerror = function() {
     reason = 'Server down.';
     reason = 'Server down.';
     clearDocument();
     clearDocument();
+    console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargh');
     setTimeout(init, 10000);
     setTimeout(init, 10000);
   };
   };
 }
 }