This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new ef0616c [OPENMEETINGS-2000] moving JS code to npm (incomplete, broken)
ef0616c is described below
commit ef0616ce62f99e610aa4d823c13ee5056e820685
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Fri Dec 25 10:44:46 2020 +0700
[OPENMEETINGS-2000] moving JS code to npm (incomplete, broken)
---
openmeetings-web/pom.xml | 6 ++
.../src/main/front/wb/src/interview-area.js | 7 +-
.../src/main/front/wb/src/raw-tool-util.js | 64 ------------------
.../src/main/front/wb/src/wb-area-base.js | 6 +-
openmeetings-web/src/main/front/wb/src/wb-area.js | 13 ++--
.../{raw-tool-apointer.js => wb-tool-apointer.js} | 79 ++++++++++++----------
.../wb/src/{raw-tool-base.js => wb-tool-base.js} | 10 ++-
.../src/main/front/wb/src/wb-tool-util.js | 62 +++++++++++++++++
openmeetings-web/src/main/front/wb/src/wb-tools.js | 18 +++--
openmeetings-web/src/main/front/wb/src/wb-zoom.js | 17 ++---
openmeetings-web/src/main/front/wb/src/wb.js | 49 +++++++-------
pom.xml | 2 +-
12 files changed, 181 insertions(+), 152 deletions(-)
diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index d399dd9..174ee0c 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -537,6 +537,12 @@
<groupId>org.webjars</groupId>
<artifactId>jasny-bootstrap</artifactId>
<version>${jasny-bootstrap.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.webjars</groupId>
+ <artifactId>bootstrap</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
diff --git a/openmeetings-web/src/main/front/wb/src/interview-area.js
b/openmeetings-web/src/main/front/wb/src/interview-area.js
index b9eba47..2440e63 100644
--- a/openmeetings-web/src/main/front/wb/src/interview-area.js
+++ b/openmeetings-web/src/main/front/wb/src/interview-area.js
@@ -21,7 +21,8 @@ module.exports = class InterviewWbArea extends WbAreaBase {
pArea.attr('class', cls);
}
this.init = () => {
- super.init();
+ // it seems `super` can't be called from lambda
+ this.wsinit();
container = $(".room-block .wb-block");
area = container.find(".wb-area");
pArea = area.find(".pod-area");
@@ -67,6 +68,10 @@ module.exports = class InterviewWbArea extends WbAreaBase {
_updateAreaClass();
_inited = true;
};
+ this.destroy = () => {
+ // it seems `super` can't be called from lambda
+ this.wsdestroy();
+ };
this.setRecEnabled = (en) => {
if (!_inited) {
return;
diff --git a/openmeetings-web/src/main/front/wb/src/raw-tool-util.js
b/openmeetings-web/src/main/front/wb/src/raw-tool-util.js
deleted file mode 100644
index 6e9d783..0000000
--- a/openmeetings-web/src/main/front/wb/src/raw-tool-util.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
-var ToolUtil = (function() {
- return {
- enableLineProps: function(s, base) {
- const c = s.find('.wb-prop-color'), w =
s.find('.wb-prop-width'), o = this.enableOpacity(s, base);
- s.find('.wb-prop-fill').prop('disabled', true);
- s.find('.wb-prop-b, .wb-prop-i, .wb-prop-lock-color,
.wb-prop-lock-fill').button("disable");
- c.val(base.stroke.color).prop('disabled', false);
- w.val(base.stroke.width).prop('disabled', false);
- return {c: c, w: w, o: o};
- }
- , enableAllProps: function(s, base) {
- const c = s.find('.wb-prop-color'), w =
s.find('.wb-prop-width')
- , f = s.find('.wb-prop-fill')
- , lc = s.find('.wb-prop-lock-color'), lf =
s.find('.wb-prop-lock-fill');
- this.enableOpacity(s, base);
- s.find('.wb-prop-b, .wb-prop-i').button("disable");
- lc.button("enable").button('option', 'icon',
base.stroke.enabled ? 'ui-icon-unlocked' : 'ui-icon-locked');
- lf.button("enable").button('option', 'icon',
base.fill.enabled ? 'ui-icon-unlocked' : 'ui-icon-locked');
- c.val(base.stroke.color).prop('disabled',
!base.stroke.enabled);
- w.val(base.stroke.width).prop('disabled', false);
- f.val(base.fill.color).prop('disabled',
!base.fill.enabled);
- }
- , enableOpacity: function(s, base) {
- const o = s.find('.wb-prop-opacity')
- o.val(100 * base.opacity).prop('disabled', false);
- return o;
- }
- , disableAllProps: function(s) {
- s.find('[class^="wb-prop"]').prop('disabled', true);
- if (!!s.find('.wb-prop-b').button("instance")) {
- s.find('.wb-prop-b, .wb-prop-i,
.wb-prop-lock-color, .wb-prop-lock-fill').button("disable");
- }
- }
- , addDeletedItem: function(canvas, o) {
- if ("Presentation" === o.fileType) {
- fabric.Image.fromURL(o._src, function(img) {
- const sz = img.getOriginalSize();
- img.width = sz.width;
- img.height = sz.height;
- img.scaleX = img.scaleY = canvas.width
/ (canvas.getZoom() * sz.width);
- canvas.setBackgroundImage(img,
canvas.renderAll.bind(canvas));
- });
- } else {
- fabric.Image.fromURL(o._src || o.src,
function(img) {
- const sz = img.getOriginalSize();
- img.width = sz.width;
- img.height = sz.height;
- img.scaleX = img.scaleY = (o.scaleX ||
1.) * o.width / sz.width;
- img.type = 'image';
- img.videoStatus = function() {};
- canvas.add(img);
- canvas.requestRenderAll();
- }, o);
- }
- }
- , filter: function(_o, props) {
- return props.reduce(function(result, key) {
- result[key] = _o[key];
- return result;
- }, {});
- }
- };
-})();
diff --git a/openmeetings-web/src/main/front/wb/src/wb-area-base.js
b/openmeetings-web/src/main/front/wb/src/wb-area-base.js
index 179a051..0b2ab34 100644
--- a/openmeetings-web/src/main/front/wb/src/wb-area-base.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-area-base.js
@@ -15,10 +15,12 @@ module.exports = class WbAreaBase {
}
}
- this.init = () => {
+ this.wsinit = () => {
+ // it seems `super` can't be called from lambda
Wicket.Event.subscribe("/websocket/message",
_wbWsHandler);
};
- this.destroy = () => {
+ this.wsdestroy = () => {
+ // it seems `super` can't be called from lambda
Wicket.Event.unsubscribe("/websocket/message",
_wbWsHandler);
};
this.setRole = () => {};
diff --git a/openmeetings-web/src/main/front/wb/src/wb-area.js
b/openmeetings-web/src/main/front/wb/src/wb-area.js
index d29f088..d2d200c 100644
--- a/openmeetings-web/src/main/front/wb/src/wb-area.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-area.js
@@ -2,7 +2,7 @@
const WbAreaBase = require('./wb-area-base');
const Role = require('./wb-role');
const Wb = require('./wb');
-const fabric = require('fabric');
+require('fabric'); // will produce `fabric` namespace
const arrowImg = new Image(), delImg = new Image();
@@ -117,6 +117,7 @@ function _actionActivateWb(_wbId) {
module.exports = class DrawWbArea extends WbAreaBase {
constructor() {
super();
+ const self = this;
let scroll, role = Role.NONE, _inited = false;
function _performDelete() {
@@ -216,7 +217,7 @@ module.exports = class DrawWbArea extends WbAreaBase {
axis: 'x'
});
_inited = true;
- this.setRole(role);
+ self.setRole(role);
if (typeof(callback) === 'function') {
callback();
}
@@ -227,7 +228,8 @@ module.exports = class DrawWbArea extends WbAreaBase {
}
this.init = (callback) => {
- super.init();
+ // it seems `super` can't be called from lambda
+ this.wsinit();
_doInit(callback);
};
//FIXME TODO self.getWb = _getWb;
@@ -270,7 +272,8 @@ module.exports = class DrawWbArea extends WbAreaBase {
});
};
this.destroy = () => {
- super.destroy();
+ // it seems `super` can't be called from lambda
+ this.wsdestroy();
this.removeDeleteHandler();
};
this.create = (obj) => {
@@ -428,7 +431,7 @@ module.exports = class DrawWbArea extends WbAreaBase {
}).fail(function(err) {
OmUtil.error(err);
});
- }
+ };
this.videoStatus = _videoStatus;
this.loadVideos = () => {
if (!_inited) {
diff --git a/openmeetings-web/src/main/front/wb/src/raw-tool-apointer.js
b/openmeetings-web/src/main/front/wb/src/wb-tool-apointer.js
similarity index 59%
rename from openmeetings-web/src/main/front/wb/src/raw-tool-apointer.js
rename to openmeetings-web/src/main/front/wb/src/wb-tool-apointer.js
index 33e850b..c94a442 100644
--- a/openmeetings-web/src/main/front/wb/src/raw-tool-apointer.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-tool-apointer.js
@@ -1,10 +1,50 @@
/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
-var APointer = function(wb, s, sBtn) {
- const pointer = Base();
- pointer.user = '';
- pointer.create = function(canvas, o) {
+const WbToolBase = require('./wb-tool-base');
+const ToolUtil = require('./wb-tool-util');
+require('fabric');
+
+module.exports = class APointer extends WbToolBase {
+ constructor(wb, settings, sBtn) {
+ super();
+ this.user = '';
+ this.wb = wb;
+
+ const self = this;
+ function _mouseUp(o) {
+ const canvas = this
+ , ptr = canvas.getPointer(o.e);
+ if (self.user === '') {
+ self.user = $('.room-block .sidebar .user-list
.current .name').text();
+ }
+ const obj = {
+ omType: 'pointer'
+ , x: ptr.x
+ , y: ptr.y
+ , user: self.user
+ };
+ obj.uid = self.objectCreated(obj, canvas);
+ self.create(canvas, obj);
+ }
+
+ this.activate = () => {
+ this.wb.eachCanvas(function(canvas) {
+ canvas.selection = false;
+ canvas.on('mouse:up', _mouseUp);
+ });
+ ToolUtil.disableAllProps(settings);
+ sBtn.addClass('disabled');
+ }
+
+ this.deactivate = () => {
+ this.wb.eachCanvas(function(canvas) {
+ canvas.off('mouse:up', _mouseUp);
+ });
+ };
+ }
+
+ create(canvas, o) {
fabric.Image.fromURL('./css/images/pointer.png', function(img) {
- const scale = 1. / wb.getZoom();
+ const scale = 1. / this.wb.getZoom();
img.set({
left:15
, originX: 'right'
@@ -68,33 +108,4 @@ var APointer = function(wb, s, sBtn) {
go(count);
});
}
- pointer.mouseUp = function(o) {
- const canvas = this
- , ptr = canvas.getPointer(o.e);
- if (pointer.user === '') {
- pointer.user = $('.room-block .sidebar .user-list
.current .name').text();
- }
- const obj = {
- omType: 'pointer'
- , x: ptr.x
- , y: ptr.y
- , user: pointer.user
- };
- obj.uid = pointer.objectCreated(obj, canvas);
- pointer.create(canvas, obj);
- }
- pointer.activate = function() {
- wb.eachCanvas(function(canvas) {
- canvas.selection = false;
- canvas.on('mouse:up', pointer.mouseUp);
- });
- ToolUtil.disableAllProps(s);
- sBtn.addClass('disabled');
- }
- pointer.deactivate = function() {
- wb.eachCanvas(function(canvas) {
- canvas.off('mouse:up', pointer.mouseUp);
- });
- };
- return pointer;
};
diff --git a/openmeetings-web/src/main/front/wb/src/raw-tool-base.js
b/openmeetings-web/src/main/front/wb/src/wb-tool-base.js
similarity index 54%
rename from openmeetings-web/src/main/front/wb/src/raw-tool-base.js
rename to openmeetings-web/src/main/front/wb/src/wb-tool-base.js
index 16c0c0e..5c4eb33 100644
--- a/openmeetings-web/src/main/front/wb/src/raw-tool-base.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-tool-base.js
@@ -1,11 +1,9 @@
/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
-var Base = function() {
- const base = {};
- base.objectCreated = function(o, canvas) {
- o.uid = uuidv4();
- o.slide = canvas.slide;
+module.exports = class WbToolBase {
+ objectCreated(o, canvas) {
+ this.uid = uuidv4();
+ this.slide = canvas.slide;
canvas.trigger("wb:object:created", o);
return o.uid;
}
- return base;
};
diff --git a/openmeetings-web/src/main/front/wb/src/wb-tool-util.js
b/openmeetings-web/src/main/front/wb/src/wb-tool-util.js
new file mode 100644
index 0000000..59099b3
--- /dev/null
+++ b/openmeetings-web/src/main/front/wb/src/wb-tool-util.js
@@ -0,0 +1,62 @@
+/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
+module.exports = {
+ enableLineProps: function(s, base) {
+ const c = s.find('.wb-prop-color'), w =
s.find('.wb-prop-width'), o = this.enableOpacity(s, base);
+ s.find('.wb-prop-fill').prop('disabled', true);
+ s.find('.wb-prop-b, .wb-prop-i, .wb-prop-lock-color,
.wb-prop-lock-fill').button("disable");
+ c.val(base.stroke.color).prop('disabled', false);
+ w.val(base.stroke.width).prop('disabled', false);
+ return {c: c, w: w, o: o};
+ }
+ , enableAllProps: function(s, base) {
+ const c = s.find('.wb-prop-color'), w = s.find('.wb-prop-width')
+ , f = s.find('.wb-prop-fill')
+ , lc = s.find('.wb-prop-lock-color'), lf =
s.find('.wb-prop-lock-fill');
+ this.enableOpacity(s, base);
+ s.find('.wb-prop-b, .wb-prop-i').button("disable");
+ lc.button("enable").button('option', 'icon',
base.stroke.enabled ? 'ui-icon-unlocked' : 'ui-icon-locked');
+ lf.button("enable").button('option', 'icon', base.fill.enabled
? 'ui-icon-unlocked' : 'ui-icon-locked');
+ c.val(base.stroke.color).prop('disabled', !base.stroke.enabled);
+ w.val(base.stroke.width).prop('disabled', false);
+ f.val(base.fill.color).prop('disabled', !base.fill.enabled);
+ }
+ , enableOpacity: function(s, base) {
+ const o = s.find('.wb-prop-opacity')
+ o.val(100 * base.opacity).prop('disabled', false);
+ return o;
+ }
+ , disableAllProps: function(s) {
+ s.find('[class^="wb-prop"]').prop('disabled', true);
+ if (!!s.find('.wb-prop-b').button("instance")) {
+ s.find('.wb-prop-b, .wb-prop-i, .wb-prop-lock-color,
.wb-prop-lock-fill').button("disable");
+ }
+ }
+ , addDeletedItem: function(canvas, o) {
+ if ("Presentation" === o.fileType) {
+ fabric.Image.fromURL(o._src, function(img) {
+ const sz = img.getOriginalSize();
+ img.width = sz.width;
+ img.height = sz.height;
+ img.scaleX = img.scaleY = canvas.width /
(canvas.getZoom() * sz.width);
+ canvas.setBackgroundImage(img,
canvas.renderAll.bind(canvas));
+ });
+ } else {
+ fabric.Image.fromURL(o._src || o.src, function(img) {
+ const sz = img.getOriginalSize();
+ img.width = sz.width;
+ img.height = sz.height;
+ img.scaleX = img.scaleY = (o.scaleX || 1.) *
o.width / sz.width;
+ img.type = 'image';
+ img.videoStatus = function() {};
+ canvas.add(img);
+ canvas.requestRenderAll();
+ }, o);
+ }
+ }
+ , filter: function(_o, props) {
+ return props.reduce(function(result, key) {
+ result[key] = _o[key];
+ return result;
+ }, {});
+ }
+};
diff --git a/openmeetings-web/src/main/front/wb/src/wb-tools.js
b/openmeetings-web/src/main/front/wb/src/wb-tools.js
index c03d225..e9438a7 100644
--- a/openmeetings-web/src/main/front/wb/src/wb-tools.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-tools.js
@@ -1,6 +1,7 @@
/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
const Role = require('./wb-role');
const WbUtils = require('./wb-utils');
+const APointer = require('./wb-tool-apointer');
const ACTIVE = 'active';
@@ -33,8 +34,8 @@ function __destroySettings() {
}
module.exports = class WbTools {
- constructor(wbEl) {
- let tools, settings, math;
+ constructor(wbEl, wb) {
+ let mode, tools, settings, math;
function _initGroupHandle(c) {
c.find('a').off().click(function(e) {
@@ -307,7 +308,7 @@ module.exports = class WbTools {
case Role.PRESENTER:
clearAll.confirmation({
confirmationEvent:
'om-clear-all'
- , onConfirm: () =>
OmUtil.wbAction({action: 'clearAll', data: {wbId: wb.id}})
+ , onConfirm: () =>
OmUtil.wbAction({action: 'clearAll', data: {wbId: wb.getId()}})
}).removeClass('disabled');
case Role.WHITEBOARD:
if (role === Role.WHITEBOARD) {
@@ -329,19 +330,19 @@ module.exports = class WbTools {
.confirmation({
confirmationEvent:
'om-clear-slide'
, onConfirm: function()
{
-
OmUtil.wbAction({action: 'clearSlide', data: {wbId: wb.id, slide: slide}});
+
OmUtil.wbAction({action: 'clearSlide', data: {wbId: wb.getId(), slide: slide}});
}
});
tools.find('.om-icon.save').click(function() {
- OmUtil.wbAction({action:
'save', data: {wbId: wb.id}});
+ OmUtil.wbAction({action:
'save', data: {wbId: wb.getId()}});
});
tools.find('.om-icon.undo').click(function() {
- OmUtil.wbAction({action:
'undo', data: {wbId: wb.id}});
+ OmUtil.wbAction({action:
'undo', data: {wbId: wb.getId()}});
});
_initSettings();
_initMath();
case Role.NONE:
- _initToolBtn('apointer',
_firstToolItem, APointer(wb, settings, sBtn));
+ _initToolBtn('apointer',
_firstToolItem, new APointer(wb, settings, sBtn));
default:
//no-op
}
@@ -355,6 +356,9 @@ module.exports = class WbTools {
this.destroy = () => {
__destroySettings();
};
+ this.getMode = () => {
+ return mode;
+ };
this.getMath = () => {
return math;
};
diff --git a/openmeetings-web/src/main/front/wb/src/wb-zoom.js
b/openmeetings-web/src/main/front/wb/src/wb-zoom.js
index 7a9ca16..86188f0 100644
--- a/openmeetings-web/src/main/front/wb/src/wb-zoom.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-zoom.js
@@ -1,4 +1,6 @@
/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
+const Role = require('./wb-role');
+
const area = $('.room-block .wb-block .wb-area .tabs')
, bar = area.find('.wb-tabbar')
@@ -11,11 +13,11 @@ module.exports = class WbZoom {
function _sendSetSize() {
wbObj.doSetSize();
OmUtil.wbAction({action: 'setSize', data: {
- wbId: wbObj.id
+ wbId: wbObj.getId()
, zoom: this.zoom
, zoomMode: this.zoomMode
- , width: wbObj.width
- , height: wbObj.height
+ , width: wbObj.getWidth()
+ , height: wbObj.getHeight()
}});
}
@@ -85,7 +87,6 @@ module.exports = class WbZoom {
case Role.WHITEBOARD:
// fallthrough
case Role.NONE:
- zoomBar.update(role, canvases.length);
zoomBar.find('.zoom-out').click(function() {
this.zoom -= .2;
if (this.zoom < .1) {
@@ -126,11 +127,11 @@ module.exports = class WbZoom {
this.setSize = () => {
switch (this.zoomMode) {
case 'FULL_FIT':
- this.zoom = Math.min((area.width() -
30) / wbObj.width, (area.height() - bar.height() - 30) / wbObj.height);
+ this.zoom = Math.min((area.width() -
30) / wbObj.getWidth(), (area.height() - bar.height() - 30) /
wbObj.getHeight());
zoomBar.find('.zoom').val(this.zoomMode);
break;
case 'PAGE_WIDTH':
- this.zoom = (area.width() - 30 - 40) /
wbObj.width; // bumper + toolbar
+ this.zoom = (area.width() - 30 - 40) /
wbObj.getWidth(); // bumper + toolbar
zoomBar.find('.zoom').val(this.zoomMode);
break;
default:
@@ -152,11 +153,11 @@ module.exports = class WbZoom {
};
}
- get zoom() {
+ getZoom() {
return this.zoom;
}
- get mode() {
+ getMode() {
return this.zoomMode;
}
};
diff --git a/openmeetings-web/src/main/front/wb/src/wb.js
b/openmeetings-web/src/main/front/wb/src/wb.js
index d0357b6..4f06ea4 100644
--- a/openmeetings-web/src/main/front/wb/src/wb.js
+++ b/openmeetings-web/src/main/front/wb/src/wb.js
@@ -1,8 +1,8 @@
/* Licensed under the Apache License, Version 2.0 (the "License")
http://www.apache.org/licenses/LICENSE-2.0 */
const Role = require('./wb-role');
-const Tools = require('./wb-tools');
+const WbTools = require('./wb-tools');
const WbZoom = require('./wb-zoom');
-const fabric = require('fabric');
+require('fabric'); // will produce `fabric` namespace
const BUMPER = 100
, extraProps = ['uid', 'fileId', 'fileType', 'count', 'slide',
'omType', '_src', 'formula'];
@@ -14,8 +14,8 @@ module.exports = class Wb {
this.title = wbo.name;
this.width = wbo.width;
this.height = wbo.height;
- const canvases = [];
- let wbEl, tools, zoomBar, mode, slide = 0
+ const canvases = [], self = this;
+ let wbEl, tools, zoomBar, slide = 0
, role = null, scrollTimeout = null;
function _setSlide(_sld) {
@@ -25,7 +25,7 @@ module.exports = class Wb {
}
slide = _sld;
OmUtil.wbAction({action: 'setSlide', data: {
- wbId: this.id
+ wbId: self.id
, slide: _sld
}});
zoomBar.update(role, canvases.length);
@@ -76,7 +76,7 @@ module.exports = class Wb {
if (_o.deleted) {
ToolUtil.addDeletedItem(canvas, _o);
} else {
- let scale = this.width
/ _o.width;
+ let scale = self.width
/ _o.width;
scale = scale < 1 ? 1 :
scale;
canvas.setBackgroundImage(_o._src + '&slide=' + i, canvas.renderAll.bind(canvas)
,
{scaleX: scale, scaleY: scale});
@@ -98,7 +98,7 @@ module.exports = class Wb {
const canvas = canvases[_o.slide];
if (!!canvas) {
_o.selectable =
canvas.selection;
- _o.editable = ('text' === mode
|| 'textbox' === mode);
+ _o.editable = ('text' ===
tools.getMode() || 'textbox' === tools.getMode());
canvas.add(_o);
}
}
@@ -107,7 +107,7 @@ module.exports = class Wb {
}
function _createObject(arr, handler) {
fabric.util.enlivenObjects(arr, function(objects) {
- this.eachCanvas(function(canvas) {
+ self.eachCanvas(function(canvas) {
canvas.renderOnAddRemove = false;
});
@@ -117,7 +117,7 @@ module.exports = class Wb {
handler(_o);
}
- this.eachCanvas(function(canvas) {
+ self.eachCanvas(function(canvas) {
canvas.renderOnAddRemove = true;
canvas.requestRenderAll();
});
@@ -154,7 +154,7 @@ module.exports = class Wb {
break;
}
OmUtil.wbAction({action: 'createObj', data: {
- wbId: this.id
+ wbId: self.id
, obj: json
}});
}
@@ -194,7 +194,7 @@ module.exports = class Wb {
items.push(toOmJson(o));
}
OmUtil.wbAction({action: 'modifyObj', data: {
- wbId: this.id
+ wbId: self.id
, obj: items
}});
}
@@ -208,7 +208,7 @@ module.exports = class Wb {
}
if ('textbox' === o.omType || 'i-text' === o.omType) {
OmUtil.wbAction({action: 'deleteObj', data: {
- wbId: this.id
+ wbId: self.id
, obj: [{
uid: o.uid
, slide: o.slide
@@ -299,13 +299,13 @@ module.exports = class Wb {
}
function addCanvas() {
const sl = canvases.length
- , cid = 'can-' + this.id + '-slide-' + sl
+ , cid = 'can-' + self.id + '-slide-' + sl
, c = $('<canvas></canvas>').attr('id', cid);
wbEl.find('.canvases').append(c);
const canvas = new fabric.Canvas(c.attr('id'), {
preserveObjectStacking: true
});
- canvas.wbId = this.id;
+ canvas.wbId = self.id;
canvas.slide = sl;
canvases.push(canvas);
const cc = $('#' + cid).closest('.canvas-container');
@@ -320,13 +320,13 @@ module.exports = class Wb {
setHandlers(canvas);
}
function __setSize(_cnv) {
- _cnv.setWidth(zoomBar.zoom * this.width)
- .setHeight(zoomBar.zoom * this.height)
- .setZoom(zoomBar.zoom);
+ _cnv.setWidth(zoomBar.getZoom() * self.width)
+ .setHeight(zoomBar.getZoom() * self.height)
+ .setZoom(zoomBar.getZoom());
}
function _setSize() {
zoomBar.setSize();
- this.eachCanvas(function(canvas) {
+ self.eachCanvas(function(canvas) {
__setSize(canvas);
});
_setSlide(slide);
@@ -358,6 +358,7 @@ module.exports = class Wb {
});
tools.setRole(role);
zoomBar.setRole(role);
+ zoomBar.update(role, canvases.length);
_setSize();
}
};
@@ -369,7 +370,7 @@ module.exports = class Wb {
};
this.doSetSize = _setSize;
this.resize = () => {
- if (zoomBar.mode !== 'ZOOM') {
+ if (zoomBar.getMode() !== 'ZOOM') {
_setSize();
}
};
@@ -491,29 +492,29 @@ module.exports = class Wb {
return tools.getMath();
};
this.getZoom = () => {
- return zoomBar.zoom;
+ return zoomBar.getZoom();
};
this.destroy = () => {
tools.destroy();
};
wbEl = $('#' + tcid);
- tools = new Tools(wbEl);
+ tools = new WbTools(wbEl, this);
zoomBar = new WbZoom(wbEl, this);
zoomBar.init(wbo);
addCanvas();
this.setRole(_role);
}
- get id() {
+ getId() {
return this.id;
}
- get width() {
+ getWidth() {
return this.width;
}
- get height() {
+ getHeight() {
return this.height;
}
};
diff --git a/pom.xml b/pom.xml
index fb04901..da6cf79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -115,7 +115,7 @@
<logback.version>1.2.3</logback.version>
<jetty.version>9.4.34.v20201102</jetty.version>
<license.excludedScopes>test</license.excludedScopes>
- <bcprov-jdk15on.version>1.67</bcprov-jdk15on.version>
+ <bcprov-jdk15on.version>1.68</bcprov-jdk15on.version>
<mockito.version>3.6.28</mockito.version>
<quartz.version>2.3.2</quartz.version>
<kurento.version>6.15.0</kurento.version>