GithubHelp home page GithubHelp logo

sumitsumo / brainstormme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from teambrainstormme/brainstormme

0.0 0.0 0.0 1.07 MB

Online whiteboard for collaborative brainstorming with implemented Twilio conference call

JavaScript 73.21% HTML 16.96% CSS 9.83%

brainstormme's Introduction

BrainstormMe

Overview:

Online whiteboard for collaborative brainstorming. Users can:

  • draw a line
  • draw a polygon
  • change color
  • change width of the line
  • join a conference call (Twilio API)
  • undo drawing

Watch demo:

Screenshots:


Team Members & Roles:

Technologies used:

  • Socket.io
  • D3
  • Node
  • PostgreSQL
  • Javascript
  • Twilio API
  • Express
  • HTML
  • CSS
  • Amazon EC2

Code snippets:

io.on('connection', function (socket) {

    getElementHistory().then( (el_history) => {
        for (let objD of el_history) {
            if (objD !== '') {
                if (objD.type === 'polygon') {
                    socket.emit('draw_poly', objD)
                } else {
                    socket.emit('draw_line', objD);
                }
    
            }
        }
    })

    socket.on('start_line', (objD) => {
        insertDB(objD);
        socket.broadcast.emit('start_line', objD);
    })

    socket.on('real_time_line', (objD) => {
        updateElDB(objD);
        socket.broadcast.emit('real_time_line', objD);
        
    });

    socket.on('undo', (projectId) => {
        deleteLastElDB(projectId);
        io.emit('undo', (projectId));
    })

    socket.on('draw_poly', (objD) => {
        insertDB(objD);
        socket.broadcast.emit('draw_poly', objD);
        
    })
});

################### front end

let drawBtn = document.querySelector('#drawTool');
drawBtn.addEventListener('click', () => {
    svg.call(d3.drag()
        .container(function () { return this; })
        .subject(function () { var p = [d3.event.x, d3.event.y]; return [p, p]; })
        .on('start', drawStarted));
});

//Freehand drawing tool function
function drawStarted() {
    var d = d3.event.subject;
    objD = {projectid: 1, el_count: countElements() + 1, d: d, color: penColor, size: strokeWidth, type: 'line' };
    let x0 = d3.event.x,
        y0 = d3.event.y;

    drawLine(objD);
    socket.emit('start_line', objD);

    d3.event.on("drag", function () {
        var x1 = d3.event.x,
            y1 = d3.event.y,
            dx = x1 - x0,
            dy = y1 - y0;

        if (dx * dx + dy * dy > 50) {
            objD.d.push([x0 = x1, y0 = y1]);
        }
        else objD.d[d.length - 1] = [x1, y1];

        updateLineRealTime(objD);
        socket.emit('real_time_line', objD);
    });
}

brainstormme's People

Contributors

illiachaban avatar jaeheekim051510 avatar sagepadawan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.