openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solo...@apache.org
Subject [openmeetings] branch 4.0.x updated: [OPENMEETINGS-1884] more work on styling
Date Tue, 14 Aug 2018 10:46:47 GMT
This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/4.0.x by this push:
     new 0b502c4  [OPENMEETINGS-1884] more work on styling
0b502c4 is described below

commit 0b502c45e4bdf3a7a0388430d75f2b460c29a564
Author: Maxim Solodovnik <solomax666@gmail.com>
AuthorDate: Tue Aug 14 17:46:16 2018 +0700

    [OPENMEETINGS-1884] more work on styling
---
 .../openmeetings/web/room/wb/raw-tool-text.js      |  2 ++
 .../openmeetings/web/room/wb/raw-wb-board.js       | 33 +++++++++++++---------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-text.js
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-text.js
index 79e3cf8..b784405 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-text.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-text.js
@@ -56,6 +56,7 @@ var Text = function(wb, s) {
 			canvas.forEachObject(function(o) {
 				if (text.fabricType === o.type) {
 					o.selectable = true;
+					o.editable = true;
 				}
 			});
 		});
@@ -83,6 +84,7 @@ var Text = function(wb, s) {
 			canvas.forEachObject(function(o) {
 				if (text.fabricType === o.type) {
 					o.selectable = false;
+					o.editable = false;
 				}
 			});
 		});
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-wb-board.js
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-wb-board.js
index 2d91761..6af112f 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-wb-board.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-wb-board.js
@@ -100,13 +100,30 @@ var Wb = function() {
 		_updateZoomPanel();
 	}
 	function _initSettings() {
+		function setStyle(canvas, styleName, value) {
+			const o = canvas.getActiveObject();
+			if (o.setSelectionStyles && o.isEditing) {
+				let style = {};
+				style[styleName] = value;
+				o.setSelectionStyles(style);
+			} else {
+				o[styleName] = value;
+			}
+			canvas.requestRenderAll();
+		}
 		s.find('.wb-prop-b, .wb-prop-i')
 			.button()
 			.click(function() {
 				$(this).toggleClass('ui-state-active selected');
 				const btn = _getBtn()
-					, isB = $(this).hasClass('wb-prop-b');
-				btn.data().obj.style[isB ? 'bold' : 'italic'] = $(this).hasClass('selected');
+					, isB = $(this).hasClass('wb-prop-b')
+					, style = isB ? 'bold' : 'italic'
+					, v = $(this).hasClass('selected')
+					, val = v ? style : '';
+				btn.data().obj.style[style] = v;
+				wb.eachCanvas(function(canvas) {
+					setStyle(canvas, isB ? 'fontWeight' : 'fontStyle', val)
+				});
 			});
 		s.find('.wb-prop-lock-color, .wb-prop-lock-fill')
 			.button({icon: 'ui-icon-locked', showLabel: false})
@@ -119,17 +136,6 @@ var Wb = function() {
 				c.prop('disabled', !enabled);
 				btn.data().obj[isColor ? 'stroke' : 'fill'].enabled = enabled;
 			});
-		function setStyle(canvas, styleName, value) {
-			const o = canvas.getActiveObject();
-			if (o.setSelectionStyles && o.isEditing) {
-				let style = {};
-				style[styleName] = value;
-				o.setSelectionStyles(style);
-			} else {
-				o[styleName] = value;
-			}
-			canvas.requestRenderAll();
-		}
 		s.find('.wb-prop-color').change(function() {
 			const btn = _getBtn();
 			if (btn.length === 1) {
@@ -422,6 +428,7 @@ var Wb = function() {
 				const canvas = canvases[_o.slide];
 				if (!!canvas) {
 					_o.selectable = canvas.selection;
+					_o.editable = ('text' === mode || 'textbox' === mode);
 					canvas.add(_o);
 				}
 			}


Mime
View raw message