scribble.js
// Fires once the dragged image is dropped on the draw canvas.
Fires once the dragged image is dropped on the draw canvas.
Fires once the dragged image is dropped on the draw canvas .
function addImgDropHandler(event, ui) {
      if (droppedOnCanvas(event.pageX, event.pageY)) {
        var x = event.pageX - $draw_canvas.offset().left - drag_img_offset_x;
        var y = event.pageY - $draw_canvas.offset().top - drag_img_offset_y;
        var data = {
          img_url: $add_img.attr('src'),
          img_width: add_img_width,
          img_height: add_img_height,
          dst_x: x,
          dst_y: y,
          scribble_id: Drupal.settings.scribble_info.scribbleId
        };
        if (current_file == '') {
          data.canvas_width = canvas_width;
          data.canvas_height = canvas_height;
        }
        $.post(Drupal.settings.scribble.addURL, data, function(response) {
          current_file = response.file_name;
          $('.scribble-canvas-wrapper').css('background-image', 'url("' + dir_path + '/' + current_file + '")');
          $draw_canvas.data("jqScribble").clear();
        });
      }
    }
function addImgDropHandler ( event , ui ) { if ( droppedOnCanvas ( event . pageX , event . pageY ) ) { var x = event . pageX - $draw_canvas . offset ( ) . left - drag_img_offset_x ; var y = event . pageY - $draw_canvas . offset ( ) . top - drag_img_offset_y ; var data = { img_url : $add_img . attr ( 'src' ) , img_width : add_img_width , img_height : add_img_height , dst_x : x , dst_y : y , scribble_id : Drupal . settings . scribble_info . scribbleId } ; if ( current_file == '' ) { data . canvas_width = canvas_width ; data . canvas_height = canvas_height ; } $ . post ( Drupal . settings . scribble . addURL , data , function ( response ) { current_file = response . file_name ; $ ( '.scribble-canvas-wrapper' ) . css ( 'background-image' , 'url("' + dir_path + '/' + current_file + '")' ) ; $draw_canvas . data ( "jqScribble" ) . clear ( ) ; } ) ; } }
Fires once the dragged image is dropped on the draw canvas.
Fires once the dragged image is dropped on the draw canvas .
// Gather data for image merge. // Do AJAX post that merges the images and saves a new image. // Store the latest filename. // Update the background of the canvas with the new image.