[OPENMEETINGS-1641] basic work on video manipulations

Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/81fa4d9c
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/81fa4d9c
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/81fa4d9c

Branch: refs/heads/master
Commit: 81fa4d9cc50758e5baa101e02d0ceb849990793e
Parents: ed0a548
Author: Maxim Solodovnik <solomax...@gmail.com>
Authored: Fri Sep 8 19:24:14 2017 +0700
Committer: Maxim Solodovnik <solomax...@gmail.com>
Committed: Fri Sep 8 19:24:14 2017 +0700

----------------------------------------------------------------------
 .../org/apache/openmeetings/web/room/room.js    |   2 +-
 .../openmeetings/web/room/wb/WbPanel.java       |  10 +-
 .../apache/openmeetings/web/room/wb/fabric.js   |  18 +-
 .../openmeetings/web/room/wb/fabric.min.js      |  12 +-
 .../org/apache/openmeetings/web/room/wb/wb.js   | 398 ++++++++++---------
 5 files changed, 239 insertions(+), 201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/81fa4d9c/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
index 4a47f33..0b5b001 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
@@ -593,7 +593,7 @@ var Room = (function() {
                } else {
                        holder.removeClass('big').addClass('small');
                }
-               if (!!WbArea) {
+               if (typeof WbArea !== 'undefined') {
                        WbArea.resize(sb.width() + 5, w, h);
                }
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/81fa4d9c/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index 060fd88..a2e4a4d 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -390,7 +390,7 @@ public class WbPanel extends AbstractWbPanel {
                }
        }
 
-       private static JSONObject getAddWbJson(Whiteboard wb) {
+       private static JSONObject getAddWbJson(final Whiteboard wb) {
                return new JSONObject().put("wbId", wb.getId())
                                .put("name", wb.getName())
                                .put("width", wb.getWidth())
@@ -481,13 +481,17 @@ public class WbPanel extends AbstractWbPanel {
                                        File f = fi.getFile();
                                        if (f.exists() && f.isFile()) {
                                                try (BufferedReader br = 
Files.newBufferedReader(f.toPath())) {
+                                                       final boolean[] updated 
= {false};
                                                        JSONArray arr = 
getArray(new JSONObject(new JSONTokener(br)), (o) -> {
                                                                        
wb.put(o.getString("uid"), o);
-                                                                       
WhiteboardCache.update(roomId, wb);
+                                                                       
updated[0] = true;
                                                                        return 
addFileUrl(wbs.getUid(), o, _f -> {
                                                                                
updateWbSize(wb, _f);
                                                                        });
                                                                });
+                                                       if (updated[0]) {
+                                                               
WhiteboardCache.update(roomId, wb);
+                                                       }
                                                        
sendWbAll(WbAction.setSize, getAddWbJson(wb));
                                                        
sendWbAll(WbAction.load, getObjWbJson(wb.getId(), arr));
                                                } catch (Exception e) {
@@ -504,7 +508,7 @@ public class WbPanel extends AbstractWbPanel {
                                                        .put("fileId", 
fi.getId())
                                                        .put("fileType", 
fi.getType().name())
                                                        .put("count", 
fi.getCount())
-                                                       .put("type", "image")
+                                                       .put("type", 
FileItem.Type.Video == fi.getType() || FileItem.Type.Recording == fi.getType() 
? "video" : "image")
                                                        .put("left", 
UPLOAD_WB_LEFT)
                                                        .put("top", 
UPLOAD_WB_TOP)
                                                        .put("width", 
fi.getWidth() == null ? DEFAULT_WIDTH : fi.getWidth())

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/81fa4d9c/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js
index 5741100..b2744b5 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js
@@ -1,5 +1,4 @@
 /* Licensed MIT https://github.com/kangax/fabric.js/blob/master/LICENSE */
-
 /* build: `node build.js modules=ALL exclude=json,gestures minifier=uglifyjs` 
*/
  /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
 
@@ -247,6 +246,9 @@ fabric.Collection = {
    * (if `renderOnAddRemove` is not `false`).
    * in case of Group no changes to bounding box are made.
    * Objects should be instances of (or inherit from) fabric.Object
+   * Use of this function is highly discouraged for groups.
+   * you can add a bunch of objects with the add method but then you NEED
+   * to run a addWithUpdate call for the Group class or position/bbox will be 
wrong.
    * @param {...fabric.Object} object Zero or more fabric instances
    * @return {Self} thisArg
    * @chainable
@@ -265,6 +267,9 @@ fabric.Collection = {
   /**
    * Inserts an object into collection at specified index, then renders canvas 
(if `renderOnAddRemove` is not `false`)
    * An object should be an instance of (or inherit from) fabric.Object
+   * Use of this function is highly discouraged for groups.
+   * you can add a bunch of objects with the insertAt method but then you NEED
+   * to run a addWithUpdate call for the Group class or position/bbox will be 
wrong.
    * @param {Object} object Object to insert
    * @param {Number} index Index to insert object at
    * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of 
objects occurs
@@ -9729,7 +9734,7 @@ fabric.PatternBrush = 
fabric.util.createClass(fabric.PencilBrush, /** @lends fab
           pointer = this.getPointer(e, ignoreZoom),
           activeGroup = this.getActiveGroup(),
           activeObject = this.getActiveObject(),
-          activeTarget;
+          activeTarget, activeTargetSubs;
       // first check current group (if one exists)
       // active group does not check sub targets like normal groups.
       // if active group just exits.
@@ -9750,12 +9755,15 @@ fabric.PatternBrush = 
fabric.util.createClass(fabric.PencilBrush, /** @lends fab
         }
         else {
           activeTarget = activeObject;
+          activeTargetSubs = this.targets;
+          this.targets = [];
         }
       }
 
       var target = this._searchPossibleTargets(this._objects, pointer);
       if (e[this.altSelectionKey] && target && activeTarget && target !== 
activeTarget) {
         target = activeTarget;
+        this.targets = activeTargetSubs;
       }
       this._fireOverOutEvents(target, e);
       return target;
@@ -18796,6 +18804,11 @@ fabric.util.object.extend(fabric.Object.prototype, /** 
@lends fabric.Object.prot
      * @chainable
      */
     destroy: function() {
+      // when group is destroyed objects needs to get a repaint to be 
eventually
+      // displayed on canvas.
+      this._objects.forEach(function(object) {
+        object.set('dirty', true);
+      });
       return this._restoreObjectsState();
     },
 
@@ -27066,3 +27079,4 @@ fabric.util.object.extend(fabric.IText.prototype, /** 
@lends fabric.IText.protot
   }
 
 })();
+

Reply via email to