Changeset 0500480 in prototipo_portal_2018 for prototipo/static/js/docsDraggable.js


Ignore:
Timestamp:
Oct 25, 2017, 2:00:40 PM (7 years ago)
Author:
José Sulbarán <jsulbaran@…>
Branches:
master
Children:
445bdb4
Parents:
307a8cc
Message:

Se modificaron las bottones y las funcionalidades de draggable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prototipo/static/js/docsDraggable.js

    ra9c1355 r0500480  
    88  __CANVAS_CTX = __CANVAS.getContext('2d'),
    99  __id = "",
    10   __NUMBER = 0;
     10  __NUMBER = 0,
     11  __CLICK = 0;
    1112
    1213 $("#pdf-canvas2").hide();
     
    8788
    8889      $("#container1").attr("style", "background-image: url('"+__id+"');background-size: cover; background-repeat: no-repeat;  height:"+viewdimen.height+"px; width:"+viewdimen.width+"px");     
    89       $("#container1").attr("style", "background-image: url('"+__id+"');background-size: cover; background-repeat: no-repeat;  height:"+(viewdimen.height)+"px; width:"+(viewdimen.width)+"px");
    90      
     90
    9191
    9292    });
     
    118118    }
    119119
    120 
    121120  // Send the object url of the pdf
    122121  showPDF2(URL.createObjectURL($("#file-to-upload2").get(0).files[0]));
     122
     123  if (__CLICK == 0){
     124      $('#firmar-documento').attr("disabled","disabled").show();
     125      $('#texto').show();
     126      __CLICK += 1;
     127  }
    123128
    124129});
     
    141146
    142147
    143 var transferred = false;
    144 $('.text').draggable({
    145     connectToSortable: $('#container1'),
    146     helper: 'clone',
    147     start: function(event, ui)
    148     {
    149         $(this).hide();
    150     },
    151     stop: function(event, ui)
    152     {
    153 
    154         if(!transferred) {
    155             $(this).show();
    156         }
    157         else{
    158        
    159             $(this).remove();
    160             transferred = false;
    161         }
    162     }
    163 });
    164 
    165 
    166 function InicializarObjectoPositicion(){
    167   var container = document.getElementById('container1'),
    168     element = document.getElementsByClassName('text')[0];
    169  
    170   // options
    171   var options = {
    172     limit: container,
    173     setCursor: true
    174   };
    175 
    176   // initialize drag
    177   new Draggable(element, options);
    178 
    179 }
    180 
    181 
    182 function NuevoObjectoInicial(){
    183 
    184   var num = 0;
    185   $( ".text" ).draggable({
    186     containment: '#container1',
    187     scroll: false,
    188     stop: function(event, ui)
    189       {
    190        
    191         num+= 1;
    192         if (num == 1){
    193           $("#firma_visible #Formato_Visible .text").hide();
    194           $('#dataX').val(0);
    195           $('#dataY').val(0);
    196         }else{
    197           $('#dataX').val(ui.position['left']);
    198           $('#dataY').val(ui.position['top']);
    199         }
    200        
    201       },
    202    
    203   });
    204 }
    205 
    206 $('#container1').sortable({
    207     receive: function(event, ui)
    208     {
    209        
    210         transferred = true;
    211         InicializarObjectoPositicion()
    212         NuevoObjectoInicial();
    213 
    214        
    215     }
    216 });
Note: See TracChangeset for help on using the changeset viewer.