source: firmaeventos/static/js/DraggableSortable.js @ adb2e3a

Last change on this file since adb2e3a was adb2e3a, checked in by lhernandez <lhernandez@…>, 6 years ago

Acomodado bug del QR

  • Property mode set to 100644
File size: 1.6 KB
Line 
1
2function InicializarObjectoPositicion(){
3  var container = document.getElementById('container1'),
4    element = document.getElementsByClassName('text')[0];
5 
6  // options
7  var options = {
8    limit: container,
9    setCursor: true
10  };
11
12  // initialize drag
13  $("#texto").hide();
14  new Draggable(element, options); 
15
16}
17
18
19function NuevoObjectoInicial(){
20  $("#texto").hide();
21  var num = 0;
22  $( ".text" ).draggable({ 
23    containment: '#container1',
24    scroll: false,
25    stop: function(event, ui)
26      {
27       
28        num+= 1;
29        if (num == 1){
30          $("#firma_visible #Formato_Visible .text").hide();
31          console.log(VALOR_X);
32          VALOR_X = 0;
33          VALOR_Y = 0;
34        }else{
35          VALOR_X = parseInt(ui.position['left']);
36          VALOR_Y = parseInt(ui.position['top']);
37          console.log(VALOR_X, VALOR_Y)
38        }
39        $('#id_pos_x').val(VALOR_X)
40        $('#id_pos_y').val(VALOR_Y)
41        $('#id_pag').val(__CURRENT_PAGE)
42      },
43   
44  });
45}
46
47
48var transferred = false;
49$('.text').draggable({
50    connectToSortable: "div#container1",
51    helper: 'clone',
52    start: function(event, ui)
53    {
54        $(this).hide();
55    },
56    stop: function(event, ui)
57    {
58
59        if(!transferred) {
60            $(this).show();
61        }
62        else{ 
63       
64            $(this).remove();
65            transferred = false;
66        }
67    }
68});
69
70
71$('div#container1').sortable({
72    connectWith: "div#container1",
73    receive: function(event, ui)
74    { 
75        transferred = true;
76        $("#firmar-documento").removeAttr('disabled');
77        InicializarObjectoPositicion()
78        NuevoObjectoInicial();     
79    }
80});
Note: See TracBrowser for help on using the repository browser.