Jump to content
Search Community

Pilatus

Business
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Pilatus

  1. Hello, I am implementing a basic resizeable object which works perfectly (without using scaling). When I add some scaling to the resizing object then I feel drag resistance when resizing. The resistance happens when I resize, not when I drag the box, also the object top left moves leftward and does not fully enlarge or shrink following the mouse. Do you have any idea on how to correct for the scaling factor so that the resize handle nicely follows the mouse? I think this problem is similar to http://greensock.com/forums/topic/9279-draggable-with-css-scaling/ but I couldn't really figure out the fix. $(document).ready(function(){ var drag = $("#draggable"); var handle = $("<div class='resize-handle'></div>").appendTo(drag); TweenLite.set(drag, {scale: 2}); // <<--- this adds resistance <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TweenLite.set(handle, {top: drag.width(), left: drag.height()}); var dragInst; dragInst = Draggable.create(drag, { bounds: "body", edgeResistance: 0.85 }); var arrowdragInst; arrowdragInst = Draggable.create(handle, { type:"top,left", edgeResistance: 0.85, onPress: function(e) { e.stopPropagation(); // cancel drag /*console.log("$(this.target).position().left = " + $(this.target).offset().left); console.log("$('body').width() = " + $("body").width()); console.log($("body").width() - $(this.target).offset().left);*/ this.applyBounds({top:100, left:100, width: ($("body").width() - $(this.target).offset().left + (this.x - 60)), height: ($("body").height() - $(this.target).offset().top) + + (this.y - 60)}); }, onDrag: function(e) { TweenLite.set(this.target.parentNode, { width: this.x, height: this.y }); } }); $("body").on("mouseleave", function(e) { console.log("mouseleave body"); dragInst[0].endDrag(e); arrowdragInst[0].endDrag(e); }); });
  2. Depends on the frequency of the releases. Yes if I could have the fix right away it'd be nice.
  3. Hello, I created an example on codepen to demonstrate the problem. Basically the SVG does not obey the bounding rule. Any idea? it works on Chrome. Draggable.create("#svgId", { throwProps:true, bounds: window }); I don't want to enclose the svg inside a div and rather drag the div because I need specific svg click pass-through features which the divs do not allow. Dragging an enclosing div would be a workaround I could not use.
×
×
  • Create New...