From 780e554cc8243e3eecc28052843f9824fcec4c49 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 3 Feb 2021 16:35:25 +0100 Subject: [PATCH 1/2] Add textbox in whiteboard --- www/whiteboard/inner.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 79862ffef..3fbd097e8 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -56,12 +56,13 @@ define([ var $history = $('.cp-whiteboard-history'); var $undo = $('.cp-whiteboard-history .undo'); var $redo = $('.cp-whiteboard-history .redo'); + var $text = $('.cp-whiteboard-text button'); var $deleteButton = $('#cp-app-whiteboard-delete'); var metadataMgr = framework._.cpNfInner.metadataMgr; var brush = { - color: '#000000', + color: window.CryptPad_theme === "dark" ? '#FFFFFF' : '#000000', opacity: 1 }; @@ -140,6 +141,14 @@ define([ $deleteButton.prop('disabled', ''); }); + $text.click(function () { + $move.click(); + canvas.add(new fabric.Textbox('My Text', { + fill: brush.color, + top: 5, + left: 5 + })); + }); $undo.click(function () { if (typeof(APP.canvas.undo) !== "function") { return; } APP.canvas.undo(); @@ -199,6 +208,16 @@ define([ c = Colors.rgb2hex(c); brush.color = c; canvas.freeDrawingBrush.color = Colors.hex2rgba(brush.color, brush.opacity); + if (!APP.draw) { + var active = canvas.getActiveObject(); + if (active) { + var col = Colors.hex2rgba(brush.color, brush.opacity); + if (active.text) { active.set('fill', col); } + else { active.set('stroke', col); } + canvas.renderAll(); + APP.onLocal(); + } + } createCursor(); }; @@ -533,6 +552,9 @@ define([ h('button.btn.undo.fa.fa-undo', {title: Messages.undo}), h('button.btn.redo.fa.fa-repeat', {title: Messages.redo}), ]), + h('div.cp-whiteboard-text', [ + h('button.btn.fa.fa-font') + ]), h('button.btn.fa.fa-trash#cp-app-whiteboard-delete', { disabled: 'disabled', title: Messages.canvas_delete From 1c9d36d9ea420e69c47304ad4727875c88717e3b Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 3 Feb 2021 17:27:38 +0100 Subject: [PATCH 2/2] Fix drag&drop in kanban for mobile --- www/kanban/app-kanban.less | 46 +++++++++++++++++++++++++++++++++++--- www/kanban/jkanban_cp.js | 2 +- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/www/kanban/app-kanban.less b/www/kanban/app-kanban.less index 524d414b4..02eb529e8 100644 --- a/www/kanban/app-kanban.less +++ b/www/kanban/app-kanban.less @@ -143,6 +143,9 @@ border: 0; background: transparent; align-self: flex-start; + @media (hover: none) { + margin-right: 20px; + } } .cp-kanban-cursors { @@ -167,6 +170,21 @@ padding: 5px; flex-wrap: wrap; touch-action: none; + .tools_unselectable(); + touch-action: none; + cursor: move; + cursor: grab; + + margin-bottom: 10px; + &:last-child { + margin: 0; + } + &.is-moving.gu-mirror { + transform: rotate(3deg); + height: auto !important; + opacity: 0.8; + } + .cp-kanban-cursors { margin-top: 10px; } @@ -240,6 +258,26 @@ } .kanban-board { + position: relative; + transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1); + vertical-align: top; + display: flex; + flex-flow: column; + width: 300px; + margin: 10px 5px; + @media (hover: none) { + margin-bottom: 30px; + } + + &.is-moving.gu-mirror { + transform: rotate(3deg); + opacity: 0.8; + .kanban-drag { + overflow: hidden; + padding-right: 50px; + } + } + main { padding: 0 10px; margin: 10px 0; @@ -247,12 +285,17 @@ overflow-y: auto; justify-content: space-around; min-height: 38px; // Size of one card + @media (hover: none) { + padding-right: 30px; + } } header { display: flex; flex-wrap: wrap; align-items: center; padding: 5px 10px; + cursor: move; + cursor: grab; .kanban-title-board { flex: 1; margin-right: 10px; @@ -264,9 +307,6 @@ #kanban-edit { font-weight: bold; } - &:hover { - cursor: move; - } } footer { margin: 10px; diff --git a/www/kanban/jkanban_cp.js b/www/kanban/jkanban_cp.js index bddbfd704..56dcfaa60 100644 --- a/www/kanban/jkanban_cp.js +++ b/www/kanban/jkanban_cp.js @@ -26,7 +26,7 @@ define([ element: '', gutter: '15px', widthBoard: '250px', - responsive: '700', + responsive: 0, //'700', responsivePercentage: false, boards: { data: {},