Juergen 'eTM' Mangler 6 months 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
         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)
           end
         end
@@ -143,7 +143,7 @@ module CPEE
 
         #check if new frame overlaps others if it does, delete overlapped frames
         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)
           end
         end
@@ -195,7 +195,7 @@ module CPEE
         data_hash = JSON::parse(file)
 
         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)
           end
         end
@@ -204,14 +204,14 @@ module CPEE
       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
-          return false;
+        return false
       end
       if l1y > r2y || l2y > r1y
-          return false;
+        return false
       end
-      return true;
+      return true
     end
 
     class Delete < Riddl::Implementation

+ 2 - 3
ui/js/frame_data.js

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

+ 1 - 2
ui/js/ui.js

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