Commit 78ce1d8c authored by jan.koester's avatar jan.koester
Browse files

test

parent b387d168
Loading
Loading
Loading
Loading
+4 −4
Changes for editor/html/js/survey-manager.js: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -109,12 +109,12 @@ var SurveyManager = (function() {
    var _ctx    = null;
    var _layout = [];   // [{q, x, y}]
    var _selectedQId = null;
    var _onSelect = null;
    var _canvasOnSelect = null;

    function initCanvas(canvasEl, onSelect) {
        _canvas          = canvasEl;
        _ctx             = canvasEl.getContext('2d');
        _onSelect = onSelect;
        _canvasOnSelect  = onSelect;
        _canvas.addEventListener('click', onCanvasClick);
        _canvas.addEventListener('touchstart', function(e) {
            var t = e.touches[0];
@@ -133,14 +133,14 @@ var SurveyManager = (function() {
            var n = _layout[i];
            if (cx >= n.x && cx <= n.x + NODE_W && cy >= n.y && cy <= n.y + NODE_H) {
                _selectedQId = n.q.id;
                if (_onSelect) _onSelect(n.q);
                if (_canvasOnSelect) _canvasOnSelect(n.q);
                renderCanvas(_layout.map(function(l) { return l.q; }));
                return;
            }
        }
        // Click on empty space — deselect
        _selectedQId = null;
        if (_onSelect) _onSelect(null);
        if (_canvasOnSelect) _canvasOnSelect(null);
        renderCanvas(_layout.map(function(l) { return l.q; }));
    }