mousedownevent = function(e){
      e.preventDefault();
      dragging = true;
      origin_x = e.pageX;
      origin_y = e.pageY;
      cx = parseInt(scale_div.style.width);
      cy = parseInt(scale_div.style.height);
    }
jspsych-resize
Steve Chao

plugin for controlling the real world size of the display

documentation: docs.jspsych.org