w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Raphael JS ellipse not dragging
I found the problem. The attributes defining the center of the ellipse are (cx,cy), not (x,y). So the first call in the former function should have been this.attr({cx: this.ox+dx, cy: this.oy+dy}); while the first two calls in the latter should have been this.ox = this.attr('cx'); this.oy = this.attr('cy');

Categories : Javascript

jQuery UI draggable collections: dragging elements simultaneously
maybe that's what you want ? $(document).ready(function () { $(".TimelineContainer").draggable({ axis: "x", drag: function () { var offset = $(this).offset(); var xPos = offset.left; var yPos = offset.top; } }) }); instead of moving children.

Categories : Jquery

Dragging/dropping elements onto designated area then outputting coordinates
Have a look to this url, this is what you need. After, to get the position, its easy, using angular.element(droppedElement).position() which return the position from its parent element which is your dropzone.

Categories : Angularjs

How to rotate the Ellipse and border based on dragging border?
First, I would change these lines: if (angle >= 360) angle = 0; angle += 30; To this line: angle = angle >= 330 ? 0 : angle + 30; Although I doubt that it would cause too much problem as it is. In your code, if angle equalled 350 for instance, then it would end up as 380, but WPF should wrap that angle round to an effective angle of 20 anyway. Ahhhhhhh... I've just worked out your exact requirement... you want the user to move the mouse and you want the shape to rotate just as far as the user has moved the mouse so that it virtually looks like they are actually physically moving it. Right, here goes... I can explain what you have to do, but not do it for you. I hope that your trigonometry is good because I haven't used it for decades! Basically, if I remember corr

Categories : Wpf

HTML Elements whose parent elements are transparent won't go opaque
Children can't have a higher opacity than their parents as their opacities multiply. You use could png backgrounds or rgba colors: http://css-tricks.com/rgba-browser-support/ div { background-color: rgba(255,255,255,0.5); }

Categories : HTML

Set UI elements on equidistant points on circumference of an ellipse using XAML
http://www.charlespetzold.com/blog/2006/04/070132.html Here is an all XAML clock by the great Charles Petzold http://www.codeproject.com/Articles/29438/Analog-Clock-in-WPF And here is another solution in WPF which should be easily portable

Categories : C#

Dragging a Path
In my opinion there is a problem in these lines: int modX = (int) (e.getX() + (e.getX() - p.x)); int modY = (int) (e.getY() + (e.getY() - p.y)); Consider two points A(1,5) and B(4,5). If user clicks in C(3,6), then point A will be translated to A'(5, 7) and point B to B'(2, 7). As you can see, points A and B will change places. You might want to store start drag position and calculate distance and updated path position using this information.

Categories : Android

c# label not dragging:
OK, I've found out that the RichTextBox doesn't have the standard drag-n-drop implementation. I has a property called EnableAutoDragDrop, just set this to true, it will handle everything automatically. You don't need any event registering for it except this one: richTextBox1.EnableAutoDragDrop = true; //Just this even without AllowDrop = true //RichTextBox doesn't even have DragOver event exposed, we have to cast it to Control to expose the base DragOver event ((Control)richTextBox1).DragOver += (s, e) => { e.Effect = DragDropEffects.Copy; }; Without registering the DragOver event handler, you have to use (hold down/press) the Control key while doing drag-n-drop.

Categories : C#

Dragging a QWidget in QT 5
The Qt wiki contains a QtQuick example on how to emulate the iOS icon interface with less then 80 lines of code. You can find it here.

Categories : Qt

When dragging onto a table, how do you tell which row got dropped onto?
you could use .index() or rowIndex to find that out, something like this in your code should do it: $('#mappingChar td').droppable( { hoverClass: "ui-state-hover", drop: function( event, ui ) { alert($(this).parent().index()+" or "+$(this)[0].parentNode.rowIndex); console.log('drop successful'); } });

Categories : Javascript

Simple object dragging in iOS
What you need to use is the UIPanGestureRecognizer applying to the object itself. Here is good tutorial on this.

Categories : IOS

Jquery UI: stop dragging
I believe draggable already has the behavior you want. Use the containment option with the array syntax instead of interrupting the drag event.

Categories : Jquery

Hover like effect while dragging
You have a small mistake your condition should be: if ( event.pageX > $(this).position().left && event.pageX < ($(this).position().left + $(this).width()) && event.pageY > $(this).position().top && event.pageY < ($(this).position().top + $(this).height()) ) Have a look here: http://jsfiddle.net/straeger/fggKn/ Here is a more precisely version http://jsfiddle.net/straeger/TbwAT/1/

Categories : Javascript

Expand View On dragging
use this i've using it for imageview but you can change it for UIView and make sure that userInterAction is True for that view declare it in .h file CGFloat lastScale; in viewDidLoad: UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scale:)]; [pinchRecognizer setDelegate:self]; [imgRotate addGestureRecognizer:pinchRecognizer]; -(void)scale:(id)sender { if([(UIPinchGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) { lastScale = 1.0; return; } CGFloat scale = 1.0 - (lastScale - [(UIPinchGestureRecognizer*)sender scale]); CGAffineTransform currentTransform = [(UIPinchGestureRecognizer*)sender view].transform; CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, scale, scale

Categories : Iphone

Dragging an object in Swing
The reason the corner of the checker is "jumping" to your mouse is because of the way images are drawn. When you set the coordinates of the image you are setting the point P(0,0) of the image, which is the top-left corner when drawn on a screen. To fix this issue, in addition to keeping track of the row and column number, you need to keep track of the x and y offset (in pixels) you want to maintain though the mouse movement in each checker board "cell". This means when you click, you might click the checker in row 2, column 3, with an (x, y) offset of (12,14). I am assuming your squares are larger than 14x14 pixels. I turned your 42 into BOARD_X_OFFSET and 37 into BOARD_Y_OFFSET I have added two doubles cellX and cellY which hold the offset within the cell. This will make your set loca

Categories : Java

Rotate UIView while dragging
I must admit that I have very little experience working with UIPanGestureRecognizer, but I assume that it won't affect the answer. Nevertheless one solution could be to create a timer and make it run while the UIView is being dragged, the timer action would then make sure to update the rotation of the UIView properly and as often as possible. Another solution could be to subclass UIView and overwrite the drag-function (I do not know what it is called) and simply make it self adjust its rotation if any pivot point is given.

Categories : Iphone

Adding and Dragging images into a div
take a look to this link it´s a start for you. in this link you have an example and you can check the source code of the javascript. what you have to do is to change the code for your needs

Categories : PHP

Dragging a div select whole text
Maybe use jQuery? : $("#yourID").focus(function() { var $this = $(this); $this.select(); // Work around Chrome's little problem $this.mouseup(function() { // Prevent further mouseup intervention $this.unbind("mouseup"); return false; }); });

Categories : Javascript

Dragging Multiple Images
There are two basic approaches: You can use the various touches methods (e.g. touchesBegan, touchesMoved, etc.) in your controller or the main view, or you can use a single gesture recognizer on the main view. In this situation, you'd use touchesBegan or, if using a gesture recognizer, a state of UIGestureRecognizerStateBegan, determine locationInView of the superview, and then test whether the touch is over one of your views by testing CGRectContainsPoint, using the frame of the various views as the first parameter, and by using the location as the second parameter. Having identified the view that the gesture began, then in touchesMoved or, if in a gesture recognizer, a state of UIGestureRecognizerStateChanged, and move the view based upon the translationInView. Alternatively (and easi

Categories : IOS

keep helper under mouse when dragging
http://jsfiddle.net/margaret_/XM6f8/1/ Is this what you are looking for? Are you okay with using knockout? I can't add comments 'cause I don't have 50 reputation. <a href="#" data-bind="text: name, click: function() { viewModel.selectTask($data); }, visible: $data !== viewModel.selectedTask()"></a> <input data-bind="value: name, visibleAndSelect: $data === viewModel.selectedTask(), event: { blur: function() { viewModel.selectTask(''); } }" /> Use parent and previous location to mimic the function. ko.bindingHandlers.sortableList = { init: function(element, valueAccessor, allBindingsAccessor, context) { $(element).data("sortList", valueAccessor()); //attach meta-data $(element).sortable({ start: function(event, ui) { //track the origina

Categories : Javascript

Dragging a div to resize an image.
Bad math. With every step you adjusted the width of normal and applied delta X. You needed use the base width just like you used the handle_left. Also don't forget var for variable declaration -- they'll be part of the global scope if you don't and that'll get you later. el.onmousedown = function(e){ e.preventDefault(); var dragging = true, handle = $(e.target), x = e.clientX, handle_left = handle.position().left, normalWidth = $('.normal').width(); // base width window.onmousemove = function(e){ if(dragging == true){ var distance_w = e.clientX - x; handle.css('left', (handle_left + distance_w)+'px'); // reused width at start and applied delta $('.normal').css('width', normalWidth + d

Categories : Jquery

Dragging pictures in a slideshow
I think THIS is what you are looking for :) A jQuery project that makes you able to swipe it either with your mouse or with a cellphone

Categories : Jquery

Pan resistance when dragging UIImageView?
How about subclassing UIImageView and doing something like below: (Not perfect , but something along this lines maybe?) -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ CGPoint currentPosition = [[touches anyObject] locationInView:self.superview]; CGFloat dx = currentPosition.x - initialCentre.x;//delta x with sign CGFloat dy = currentPosition.y - initialCentre.y;//delta y with sign CGFloat distance = sqrt(dx*dx + dy*dy);//distance CGFloat weightedX = initialCentre.x + dx * (1/log(distance)); //new x as inverse function of distance CGFloat weightedY = initialCentre.y + dy * (1/log(distance)); //new y as inverse function of distance self.center = CGPointMake(weightedX, weightedY);//set the center }

Categories : IOS

How to rotate a qml rectangle by dragging?
I would do it like this (i did a simpler code as I don't have Ubuntu Touch Components), but the rotation logic is here and the angle to second conversion too : import QtQuick 2.0 Rectangle{ id: root; width: 720; height: 480; color: "black"; Item { id: container; width: 250; height: width; anchors.centerIn: parent; property real centerX : (width / 2); property real centerY : (height / 2); Rectangle{ id: rect; color: "white"; transformOrigin: Item.Center; radius: (width / 2); antialiasing: true; anchors.fill: parent; Rectangle { id: handle; color: "red"; width: 50;

Categories : Qt

Styling the object while we are dragging it
It is partially possible In HTML5 you are not able to change the style of the ghost object but you are able to change the default ghost object with the setDragImage method from the DataTransfer object. Made an example here (the blu div will become a red div when dragged): <style> #div1{ background-color:blue; width:100px; height:100px; } #div2{ background-color:red; width:100px; height:100px; } </style> ... <div id="div1" draggable="true" ></div> <br/> <div id="div2" ></div> <script> document.getElementById('div1').addEventListener('dragstart', function(event) { event.dataTransfer.setDragImage(document.getElementById('div2'),50,50)

Categories : HTML

Element not attached to DOM after dragging and dropping
Clearly, you changed the DOM with this action. You need to assign draggable.getText() and droppable.getText() strings I'm not familiar with java so much, but I think this should work: if (draggable != null) { String draggableText = draggable.getText(); String droppableText = droppable.getText(); //continue your code from here using new variables PS Sorry for my bad English

Categories : Java

How to disable Handle Bar dragging in HighStock JS
Unforunately it is not available, only solution mentioned by you. You have ability to request your suggestion in our uservoice page http://highcharts.uservoice.com/

Categories : Highcharts

Android - Dragging marker without having to hold in map api v2
Check out the Hailo application. They have a neat workaround for this. It only works when you have one marker to drag. The trick is to pan the map, instead of moving the marker. They just keep the marker in a view on top of the MapFragment (it's not actually a Marker on the map). You can then use the map's cameraPosition.target as the location of your marker.

Categories : Android

Dragging a window by its components using Javascript
I've written the following generic function for dragging using JS: function setDragOfElementOnAnother ($draggableElement, $draggedElememnt, allowDragPredicate) { var stopDragFunction = function() { $draggedElememnt.data("drag", false); $draggedElememnt.removeData("startPoint"); $("html, body").unbind("mouseup.drag"); $("html, body").unbind("mousemove.drag"); }; var dragFunction = function(e) { if (!parseBoolean($draggedElememnt.data("drag"))) return; var begin = $draggedElememnt.data("startPoint"); $draggedElememnt.css({ left: e.clientX - begin.x, top: e.clientY - begin.y }); }; $draggableElement.mousedown(function(e) { if ((e.clientX - $(this).offset().left < 0 || $(this).offset()

Categories : Javascript

Rotation and Dragging of an image in html
You must have some problems with your html code or something that you are not showing us. Below is a working fiddle that does what you are expecting your code to do. Working Fiddle <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script type="text/javascript" src="http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js"></script> <script type="text/javascript"> $(document).ready(function () { var angle = 0; $('#btnRotCw').on('click', function () { angle += 2; $("#Image1").rotate(angle); }); $('#btnRotAcw').on('click', function () { angle

Categories : Javascript

Knockout Click Binding Except When Dragging
did you try event.preventDefault(); in on drag event handler? the idea is if you detect drag event then stop the event bubbling. if click happens before drag then i think you might have to wait to see if drag happens then complete the action.

Categories : Javascript

UIScrollView's scrolling by dragging within a frame
You can try to detect where the user is touching using touchesBegan: and if it is within one of the UIViews then you can disable scrolling (or even interaction) for all the child scrollViews. So in code: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //check if touch is in one of the UIViews //if so disable child UIScrollView interaction like so: childScrollView.scrollEnabled = NO; } Then in the touches ended method just reenable scrolling on the child scrollViews.

Categories : IOS

SmartGWT : ListGrid Dragging customizing
Whats displayed (by default) during a drag event in ListGrid is defined by ListGrid.dragTrackerMode and ListGrid.titleField. ListGrid will default to first field to obtain the description to be shown during a drag, based on titleField. If you already have another field in the grid from which you can obtain the text, use listGrid.setTitleField("other-field-name"); A custom title can be defined by overriding ListGrid.getDragTrackerTitle If multiple records are selected, and dragged, drag tracker/title/etc. will be based on first selected record. Check other ListGrid methods that allow drag tracker customizations as well.

Categories : Gwt

self.decelerating and self.dragging in UIScrollView's layoutSubviews
I've never had any issues with the UIScrollView protocol methods being unreliable. Is it possible for you to manage whatever your doing currently in layoutSubviews from another delegate class? Like a parent view, or something? Then you could listen for the delegate methods with (potentially) more reliability. #pragma mark UIScrollViewDelegate - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (self.scrollViewDecelerating) { // stuff... } } - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView { self.scrollViewDecelerating = YES; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { self.scrollViewDecelerating = NO; }

Categories : IOS

Kendo ui - disabling window dragging
You should set the draggable option to false. $("#div1").kendoWindow({ draggable: false }); And here is a live demo: http://jsbin.com/OseCeBu/1/edit

Categories : Kendo Ui

XNA : Is there a way to prevent other items(sprites) when dragging?
You could keep a "global" property with the current object being dragged. Then before accepting dragging each object will check if another is not yet dragged: public void Update(GameTime gameTime, MouseState ms) { if (currentObject != null && this != currentObject) return; if ((ButtonState.Pressed == Mouse.GetState().LeftButton)) { if (RectObject.Intersects(new Rectangle(ms.X, ms.Y, 0, 0))) { Dragged = true; currentObject = this; } } else ... }

Categories : C#

Dragging an undecorated Stage in JavaFX
Strategy You already have a reference to the stage in your start method. What you need is to be able to pass the stage to your controller, so that the controller can make the stage draggable by a given node. The "Passing Parameters Directly From the Caller to the Controller" method may be used to pass a stage reference to your controller: Passing Parameters JavaFX FXML. Use the makeDraggable method from this sample code to allow the stage to be dragged by a given node. Sample Implementation Some psuedo-code for the Application start method follows: stage.initStyle(StageStyle.UNDECORATED); stage.initStyle(StageStyle.TRANSPARENT); FXMLLoader loader = new FXMLLoader( getClass().getResource( "fxml_tableview.fxml" ) ); stage.setScene( new Scene( (Parent) loader.load()

Categories : Java

jQuery ui dialog dragging issues
OK, I found this is a bug of jQuery-ui 1.10.3, see here: That appears only with using UI 1.10.3 and when the scrollbar is not at the very top in Firefox, Opera, IE8. In Chrome works fine and also with 1.10.2 on other browsers. The UI dialog demo page has this bug too: drag the dialog down until appears the scrollbar scroll down again drag the dialog down. dialog goes down with the offset

Categories : Javascript

Dragging on html table cells
There are several problems with your table, but I will correct the one you asked for. To make your table scroll when your mouse get outside the container, add this code inside your mousedown event handler : $('body').on('mousemove', function(e){ div = $('#divScroll'); if(e.pageY > div.height() && (e.pageY - div.height()) > div.scrollTop()) { div.scrollTop(e.pageY - div.height()); } }); and this, inside your mouseup event handler : $('body').off('mousemove'); See the updated Fiddle But now, another issue appear. This is because of the rest of your code. The lines are not selected because the mouse leave the column.

Categories : Javascript

Dragging an image flickering with touchesMoved
Try next code instead: CGPoint touchPoint = [[touches anyObject] locationInView:_photoImageView.superview]; _photoImageView.center = touchPoint; Or search for implementations of dragging views, there are many examples.

Categories : IOS



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.