[mirotalksfu] - add triangle obj to whiteboard

هذا الالتزام موجود في:
Miroslav Pejic
2023-04-02 17:12:01 +02:00
الأصل 40ba0e75ca
التزام 02011252c0
2 ملفات معدلة مع 19 إضافات و0 حذوفات

عرض الملف

@@ -167,6 +167,7 @@ function initClient() {
setTippy('whiteboardTextBtn', 'Add text', 'bottom'); setTippy('whiteboardTextBtn', 'Add text', 'bottom');
setTippy('whiteboardLineBtn', 'Add line', 'bottom'); setTippy('whiteboardLineBtn', 'Add line', 'bottom');
setTippy('whiteboardRectBtn', 'Add rectangle', 'bottom'); setTippy('whiteboardRectBtn', 'Add rectangle', 'bottom');
setTippy('whiteboardTriangleBtn', 'Add triangle', 'bottom');
setTippy('whiteboardCircleBtn', 'Add circle', 'bottom'); setTippy('whiteboardCircleBtn', 'Add circle', 'bottom');
setTippy('whiteboardSaveBtn', 'Save', 'bottom'); setTippy('whiteboardSaveBtn', 'Save', 'bottom');
setTippy('whiteboardEraserBtn', 'Eraser', 'bottom'); setTippy('whiteboardEraserBtn', 'Eraser', 'bottom');
@@ -1065,6 +1066,9 @@ function handleButtons() {
whiteboardRectBtn.onclick = () => { whiteboardRectBtn.onclick = () => {
whiteboardAddObj('rect'); whiteboardAddObj('rect');
}; };
whiteboardTriangleBtn.onclick = () => {
whiteboardAddObj('triangle');
};
whiteboardCircleBtn.onclick = () => { whiteboardCircleBtn.onclick = () => {
whiteboardAddObj('circle'); whiteboardAddObj('circle');
}; };
@@ -1865,6 +1869,20 @@ function whiteboardAddObj(type) {
}); });
addWbCanvasObj(rect); addWbCanvasObj(rect);
break; break;
case 'triangle':
const triangle = new fabric.Triangle({
top: 0,
left: 0,
width: 150,
height: 100,
fill: 'transparent',
stroke: wbCanvas.freeDrawingBrush.color,
strokeWidth: wbCanvas.freeDrawingBrush.width,
});
addWbCanvasObj(triangle);
break;
default:
break;
} }
} }

عرض الملف

@@ -408,6 +408,7 @@ access to use this app.
<button id="whiteboardTextBtn" class="fas fa-spell-check"></button> <button id="whiteboardTextBtn" class="fas fa-spell-check"></button>
<button id="whiteboardLineBtn" class="fas fa-slash"></button> <button id="whiteboardLineBtn" class="fas fa-slash"></button>
<button id="whiteboardRectBtn" class="far fa-square"></button> <button id="whiteboardRectBtn" class="far fa-square"></button>
<button id="whiteboardTriangleBtn" class="fas fa-triangle-exclamation"></button>
<button id="whiteboardCircleBtn" class="far fa-circle"></button> <button id="whiteboardCircleBtn" class="far fa-circle"></button>
<button id="whiteboardSaveBtn" class="fas fa-save"></button> <button id="whiteboardSaveBtn" class="fas fa-save"></button>
<button id="whiteboardEraserBtn" class="fas fa-eraser"></button> <button id="whiteboardEraserBtn" class="fas fa-eraser"></button>