Repository: openmeetings Updated Branches: refs/heads/master 0bb1537d1 -> 476d9099b
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/476d9099/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html index f2cc969..c1c43f8 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html @@ -101,6 +101,7 @@ <div wicket:message="title:77" class="ui-widget-header clickable om-icon big rect"></div> <div wicket:message="title:78" class="ui-widget-header clickable om-icon big ellipse"></div> <div wicket:message="title:79" class="ui-widget-header clickable om-icon big arrow"></div> + <div wicket:message="title:wb.tool.math.formula" class="ui-widget-header clickable om-icon big math"></div> <div wicket:message="title:843" class="ui-widget-header clickable om-icon big settings"></div> </div> <div id="wb-tools-readonly" class="tools readonly ui-state-active vertical clear"> http://git-wip-us.apache.org/repos/asf/openmeetings/blob/476d9099/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-math.js ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-math.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-math.js new file mode 100644 index 0000000..11692b4 --- /dev/null +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-math.js @@ -0,0 +1,63 @@ +/* Licensed under the Apache License, Version 2.0 (the "License") http://www.apache.org/licenses/LICENSE-2.0 */ +var TMath = function(wb, s) { + const math = ShapeBase(); + math.obj = null; + + math.mouseDown = function(o) { + const canvas = this + , pointer = canvas.getPointer(o.e) + , ao = canvas.getActiveObject(); + if (!!ao && ao.omType === 'Math') { + math.obj = ao; + } else { + function tex2svg(tex, callback) { + const wrapper = $("<div>").html(tex); + MathJax.Hub.Queue(["Typeset", MathJax.Hub, wrapper[0]]); + MathJax.Hub.Queue(function() { + const mjOut = wrapper[0].getElementsByTagName("svg")[0]; + $(mjOut).attr("xmlns", "http://www.w3.org/2000/svg"); + callback(mjOut.outerHTML); + }); + } + tex2svg('\\[f(a) = \\frac{1}{2\\pi i} \\oint\\frac{f(z)}{z-a}dz; \\sqrt{x} \\]', function(svg) { + fabric.loadSVGFromString(svg, function(objects, options) { + math.obj = fabric.util.groupSVGElements(objects, options); + //this have to be checked .... + canvas.add(math.obj.set({ + scaleX: 10 + , scaleY: 10 + , left: pointer.x + , top: pointer.y + , omType: 'Math' + })).requestRenderAll(); + math.objectCreated(math.obj, canvas); + }); + }); + } + }; + math.activate = function() { + wb.eachCanvas(function(canvas) { + canvas.on('mouse:down', math.mouseDown); + canvas.selection = true; + canvas.forEachObject(function(o) { + if (o.omType === 'Math') { + o.selectable = true; + } + }); + }); + ToolUtil.disableAllProps(s); + }; + math.deactivate = function() { + wb.eachCanvas(function(canvas) { + canvas.off('mouse:down', math.mouseDown); + canvas.selection = false; + canvas.forEachObject(function(o) { + if (o.omType === 'Math') { + o.selectable = false; + } + }); + }); + }; + + return math; +}; http://git-wip-us.apache.org/repos/asf/openmeetings/blob/476d9099/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js index 72c3aad..793995e 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-board.js @@ -4,7 +4,7 @@ var Wb = function() { , area = $('.room.wb.area .wb-area .tabs.ui-tabs'), bar = area.find('.wb-tabbar') , extraProps = ['uid', 'fileId', 'fileType', 'count', 'slide', 'omType', '_src']; let a, t, z, s, mode, slide = 0, width = 0, height = 0 - , zoom = 1., zoomMode = 'fullFit', role = null; + , zoom = 1., zoomMode = 'pageWidth', role = null; function getBtn(m) { return !!t ? t.find(".om-icon." + (m || mode)) : null; @@ -122,6 +122,7 @@ var Wb = function() { initToolBtn('rect', _firstToolItem, Rect(wb, s)); initToolBtn('ellipse', _firstToolItem, Ellipse(wb, s)); initToolBtn('arrow', _firstToolItem, Arrow(wb, s)); + initToolBtn('math', _firstToolItem, TMath(wb, s)); initCliparts(); t.find(".om-icon.settings").click(function() { s.show(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/476d9099/openmeetings-web/src/main/webapp/css/images/math.png ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/webapp/css/images/math.png b/openmeetings-web/src/main/webapp/css/images/math.png new file mode 100644 index 0000000..09ee605 Binary files /dev/null and b/openmeetings-web/src/main/webapp/css/images/math.png differ http://git-wip-us.apache.org/repos/asf/openmeetings/blob/476d9099/openmeetings-web/src/main/webapp/css/wb.css ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/webapp/css/wb.css b/openmeetings-web/src/main/webapp/css/wb.css index 9ef758d..1c011d5 100644 --- a/openmeetings-web/src/main/webapp/css/wb.css +++ b/openmeetings-web/src/main/webapp/css/wb.css @@ -63,14 +63,14 @@ } .room.wb.area .tools.vertical { width: 31px; - height: 448px; + height: 479px; } .room.wb.area .tools.readonly.vertical { width: 31px; height: 42px; } .room.wb.area .tools.horisontal { - width: 448px; + width: 479px; height: 31px; } .room.wb.area .tools.readonly.horisontal { @@ -126,6 +126,9 @@ .room.wb.area .tools .om-icon.big.undo { background-image: url(images/arrow_undo.png); } +.room.wb.area .tools .om-icon.big.math { + background-image: url(images/math.png); +} .room.wb.area .om-icon.big.next { background-image: url(images/next.png); }
