Guest User

Untitled

a guest
Dec 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <div id="MainDiv">
  2. <div id="annotationText">
  3. <svg id="circle" width="50" height="50">
  4. <circle cx="25" cy="25" r="20" stroke="green" stroke-width="4" fill="yellow" fill-opacity="0.0"/>
  5. </svg>
  6. </div>
  7. </div>
  8.  
  9. makeDragableCircle('#annotationText',jQuery('#MainDiv'));
  10.  
  11.  
  12.  
  13.  
  14. function makeDragableCircle(selector,obj){
  15. var height=obj.height();
  16. var width=obj.width();
  17. var objdiv=jQuery( selector );
  18. jQuery( selector ).draggable({
  19. containment: obj,
  20. drag: function( event, ui ) {
  21. var cleft=ui.position.left*100/width;
  22. var top=ui.position.top*100/height;
  23. jQuery(event.target).attr('data-offsetx',cleft);
  24. jQuery(event.target).attr('data-offsety',top);
  25.  
  26. }
  27.  
  28. }).resizable({
  29. alsoResize: "#"+circle,
  30. aspectRatio: 1.0
  31. });
  32.  
  33. }
Add Comment
Please, Sign In to add comment