Same calculation in drag and drop gives different results

I use jqueryUI drag / move to drag an object (ventil_roerHANDLE) on the X axis, then I have another object (ventil_roer) which is repositioned according to the first Positron objects x and I do a calculation to determine to what extent on the Y axis, that the second object must move.

When I calculate in drag calculation is a bit, but when I do the same calculation in service drop, that's correct - indices of Ant as on why?

I now reposition the second object again the service drop to get it to where it should be, causing it to 'jump' a bit when dropped

Link to the project: Vasskrafta - interaktivt kraftverk

Click on one of the two small grey houses, and then drag it onto the black valve with the green arrows

Here is the code for

SYM. .draggable (//MAGASINKRAFTVERK $('ventil_roerHANDLE')

{

containment: container,.

axis: 'x ',.

Snap: "draggableArea."

SNAPMODE: "internal."

snapTolerance: 10,.

Drag: function (event, ui)

{

If (sym. MyGlobalVar_startPosition_mag == 0)

{

SYM. MyGlobalVar_startPosition_mag = 1;

SYM. MyGlobalVar_yStartPosition = Math.round (sym.$('ventil_roerHANDLE').position () .top);

SYM. MyGlobalVar_xStartPosition = Math.round (() .left sym.$('ventil_roerHANDLE').position);

SYM. MyGlobalVar_yPrevPosition = Math.round (sym.$('ventil_roerHANDLE').position () .top);

SYM. MyGlobalVar_xPrevPosition = Math.round (() .left sym.$('ventil_roerHANDLE').position);

}

utregninger for a posisjonere den visible hit

var which = Math.round (sym.$('ventil_roerHANDLE').position () .left);

var xPositionCopy = Math.round (() .left sym.$('ventil_roer').position);

var yPositionCopy = Math.round (sym.$('ventil_roer').position () .top);

var xPosChange = xPositionCopy - which;

var yPosChange = xPosChange * 0.48;

var newXPos = Math.round (() .left sym.$('ventil_roerHANDLE').position);

var newYPos = Math.round ((sym.$('ventil_roer').position () .top) - yPosChange);

SYM. MyGlobalVar_newYPos = newYPos;

SYM. MyGlobalVar_newXPos = newXPos;

() .css sym. $('ventil_roer')

{

'left': newXPos,

'top': newYPos

});

}

SYM. .droppable (//MAGASINKRAFTVERK $('draggableArea')

{

tolerance: "touch."

Drop: function()

{

utregninger for a posisjonere den usynlige hit

var which = Math.round (sym.$('ventil_roerHANDLE').position () .left);

var xPositionCopy is sym. MyGlobalVar_xPrevPosition;

var xPosChange = xPositionCopy - which;

var yPosChange = xPosChange * 0.48;

var newXPos = Math.round (() .left sym.$('ventil_roerHANDLE').position);

var newYPos = Math.round ((sym.$('ventil_roerHANDLE').position () .top) - yPosChange);

Bytt topp posisjon pa den usynlige hit (HANDLE)

() .css sym. $('ventil_roerHANDLE')

{

'top': newYPos

});

reset the prev X og Y posisjoner

SYM. MyGlobalVar_xPrevPosition = Math.round (() .left sym.$('ventil_roerHANDLE').position);

SYM. MyGlobalVar_yPrevPosition = Math.round (sym.$('ventil_roerHANDLE').position () .top);

Flytt til posisjon handles hit

() .css sym. $('ventil_roer')

{

'left': sym. MyGlobalVar_xPrevPosition,

'top': sym. MyGlobalVar_yPrevPosition

});

}

and sometimes, all you need is a good night's sleep

a couple of the Math.round () were the culprits... the removed from the places where I am retreving positions and his animation very smoothly

Tags: Edge Animate

Similar Questions

  • How can I change the size (HUGE 72 x 72) of my drag-and-drop icons?

    Is there a windows hotfix, the registry setting, utility tweak or SOMETHING that will give me an icon of normal size (small) when I drag-and - drop in Windows Explorer?  I am happy with the size of all other icons, but would be willing to change whatever it is to change the size of the drag-and-drop icon.  Windows Explorer is too difficult to use in the Details view when the icon drag-and - drop is that great.

    Hi redhawk463,

    When you use drag it and drop method the icon font size would be in the same size of the real size of this file.

    Let us know if the real size of the file is the same when you drag and drop the file in Windows Explorer.

    Work with files and folders
    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-files-and-folders

    I hope this helps!

    Halima S - Microsoft technical support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • ASCIISTR function that gives different results

    Hi Experts,

    I use the function ASCIISTR and it gives different results in SQLPLUS and TOAD

    SQLPLUS
    SQL> SELECT ASCIISTR('é') UC FROM DUAL
      2  ;
    
    UC
    -----
    \201A
    
    SQL> SELECT ASCIISTR('ú') UC FROM DUAL;
    
    UC
    -----
    \00A3
    TOAD
    SELECT ASCIISTR('ú') UC FROM DUAL
    
    \00FA
    
    SELECT ASCIISTR('é') UC FROM DUAL
    
    \00E9
    I know experts here will be reluctant to respond to questions about the TOAD, but I wanted to understand if I'm missing something. I checked the NLS_SESSION_PARAMETERS in SQLPLUS and TOAD, and they are the same. :-(does not understand this behavior

    Version of database Oracle Database * 10g Enterprise Edition Release 10.2.0.3.0 - 64 bit Production *.

    Thanks in advance!

    The default code for the command line page is 437, identical to TOAD, you want to get the code page 1252

    SQL> host chcp
    Active code page: 437
    
    SQL> SELECT ASCIISTR('é') UC FROM DUAL;
    
    UC
    _____
    \201A
    
    SQL> host chcp 1252
    Active code page: 1252
    
    SQL> SELECT ASCIISTR('é') UC FROM DUAL;
    
    UC
    _____
    \00E9
    
    SQL>
    
  • Drag and drop, 1 share of different sur-succes drag Source, 4 Drop target, for each. Is this possible?

    Hello.

    I created an infographic of type board game and wants that the participant to be able to enter the game room, then drop it into different spaces on the Board, each holding to another slide. I need interaction drag - déposer so that they can pick up and drop the piece. Now, what I need is for each target to have a different action, but even if I add each one to a different group, if I change an action for one, that it applies the change to all drop targets.

    Is there a way to get around this?

    In addition, once / if possible, I would like to add a "back button" on each of these slides and would need when the participant returns to the boardgame slide, they can move the piece to a different drop target to read the following description. I think that the best way to do this would be to make all the "wrong" answers, while the game piece is not stuck once they have fell on a drop target "correct." Please correct me if I'm wrong.

    If I understand you correctly, I think that I thought about it.

    1. Create your Drag and Drop, as you would normally
    2. In the Panel of Drag and Drop, select the Options tab
    3. Click on the button set the correct answers
    4. The value of each drop target to have the source of displacement of the source (you must choose the sequence in the Type drop-down list)
    5. Create the slides that you want to display for each drop target
    6. Select one of the drop targets
    7. Go to the Format of the Panel Drag and Drop tab
    8. The Actions of the object... a button click
    9. In the action column, select go to slide, and then select the appropriate slide
    10. Repeat steps 6 through 9 for each target deposit
    11. Overview of the project

    I did a quick test and it seemed to work according to the settings you said earlier.

  • How to drag and drop multiple movieclips at the same time

    Hello world

    I'm a new actonscript 3 and adobe flash CC user and I am building an application but I have been stuck for several days. I have looked everywhere and tried everything I could think of, but I can't yet find a solution to my problem that I thought were pretty basic.

    Basically, let's say I have a rectangle and a circle on the stage. Once I did of the movieclips and assigned an instance name to each of them, I want to be able to perform a drag and drop the Rectangle so that both the rectangle and the circle become movable at the same time.

    For now, I have a mouse down events listener associated with the instance of rectangle, a method startDrag assigned to the rectangle instance and another assigned to the circle. But in this configuration, when I click on and drag the rectangle, only the circle is mobile (only the last line in the code is taken into account).

    I don't know if what I'm trying to achieve is feasible, but any help will be greatly appreciated, thank you!

    The startDrag() method can only work for one object at a time, so in your case the Treaty the last of them, designated the task.  This approach is to temporarily to plant the two objects in a container and then drag the container.

    rectangle.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);  When I click on the rectangle

    var dragMC:MovieClip = new MovieClip();
    addChild (dragMC);

    function fl_ClickToDrag(event:MouseEvent):void

    {
    dragMC.addChild (rectangle);        move objects in the container
    dragMC.addChild (circle);
    dragMC.startDrag ();
    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop); When I release the mouse button

    function fl_ReleaseToDrop(event:MouseEvent):void

    {
    dragMC.stopDrag ();
    Rectangle.x += dragMC.x;         Adjust the positions of the objects to their new location
    Rectangle.y += dragMC.y;
    Circle.x += dragMC.x;
    Circle.y += dragMC.y
    addChild (rectangle);                 move back to the scene objects
    addChild (circle);
    dragMC.x = dragMC.y = 0;       reset the benchmark for the dragMC
    }

    All this stuff of repositioning in the Drop function is necessary because when you drag the container, the positions of the content are still on their original coordinates inside the container.  So when you drop them they will resume their x / y positions in their new parent, meaning they go back where they were.  Reposition them where they have been trained to take into account the change in the position of the dragMC.

  • Drag and drop on the same disk, same partition hours. Why and how to fix it?

    Hello

    My computer crashed and I put the files saved on the disk. Slide it / move files adobe is 500 GB and taken a few hours to complete. Drag and Drop that into a subfolder in this directory, the system tells me that it will take even more time to copy. Why? What it means.

    Two things you need to know:

    (1) the system hangs usually about all six months requiring a clean install.

    (2) this time I portioned disk, put the operating system on the partition of 500 GB and put the data files on the other half of the partition to see what happens the next time it crashes - and it will eventually crash. (I want to know if everything is damaged remains on the side with the operating system or if it affects the entire drive.)

    All other files seem to drag / move very well, it is precisely those specific files of photographs. Any suggestions? This allusion to a problem not diagnosed with the disc? Is it because I partitioned the HD?

    Thank you

    Mac (27 inches, at the end of 2013)

    3.5 GHz Intel Core i7

    32 GB 1600 MHz DDR3

    10.11.3 (15 D 21)

    My computer crashed...

    (1) the system hangs usually about all six months requiring a clean install.

    What exactly happens when it crashes? Describe what you saw when it happened. For example, the Mac does not fail to start? Are icons or messages displayed?

  • Tree manual Drag and drop

    I'm trying to implement a tree with drag and drop functionality that:
    1. does not allow a file/branch to drag in a different folder/line
    2. does not allow a branch not to drag onto a branch and in the root

    Basically, I'm trying to preserve a State that looks like this:

    Folder
    -Node
    -Node
    -Node
    Folder
    -Node
    -Node
    ...

    I want the user to be able to reorganize files by drag and drop, nodes of exchange between files and rearrange nodes in the files, but nothing else.

    For this I implement a manual drag and drop in who I am calculating the index from falling as follows:

    var int index = this.calculateDropIndex (event);

    The problem is that falling is the same for both situations which would drop different results:
    1. when the clogging indicator immediately prior to a folder
    2. when the clogging indicator is just above (to the right in the Center) of an open empty folder

    In the first case, I would like to manually add the point * somewhere above * the file (index) in the tree and in the second case, I want to place the element slipped * inside * the file.

    Is it possible that I can tell the difference between these two cases. Any help would be GREATLY appreciated. Thank you!

    Well, I found something that works and it has not even force me to abandon the automatic brake and drop the control functionality (even if I don't know that it belongs to the category "shameless hack").

    The method calculateDropIndex() in the class Tree gets its data from the _dropData of the class member. _dropData.parent contains the item - in my case XML - index that points to the dropIndicator. If it is null, I know that the dropIndicator lies at the root and in my case, it is enough information. I access it from my long MXML tree as follows:

    This.mx_internal::_dropData

    Hopefully this quick fix can be useful to someone.

  • Windows XP SP3: Unable to start, System Restore cannot drag and drop ALL the files/folders on the desktop and applications, many unable to start, services cannot search, cannot copy or transfer the any files folders...

    After a recent power outage, my system has restarted with a weird and very common Windows problems range. The system boots fine, all my personal files/folders/apps are intact, have suddenly stopped almost all functions of applications, but many crucial functions of the Windows kernel. Everything seems to point to several Windows Services are unable to start (administrative tools on the start menu). I am running Win XP SP3 and that he was going to upgrade to Windows 7, but I wanted to backup everything in advance. As I have 29 000 hours on my C: drive and a lot of time invested in my system, files, and applications, I am extremely reluctant to risk losing my files and applications by performing any type of reinstalling Windows. Strangely, begin to almost all my apps and all my files are accessible for the most part, but I've lost the ability to drag and drop files, folders or items in a list within the applications COMPLETELY. I can't copy or paste anything, can't move the desktop icons (although I can create new files and folders). So at the moment I can't save anything or even a single file transfer to a hard drive on another storage medium. Immediate reaction: try safe mode and try the system restore safe mode has the same problems (likely due to the large number of system services that inexplicably refuses to start) and the system restore says an error window saying "system restore is not able to protect your computer at this time. try restoring the system running and restart again", which of course NEVER changes. It's the equivalent of getting a tire on your car in the middle of nowhere to find the spare tire flat and the missing Jack. I have used to be fanatical about the definition of the regular restore points, but now can not access them. I have backups of most of my personal files, but over years have lost most of the original installation CD for many of my applications (there are over 100 applications on my system) and I don't want to lose the file associations and architecture of directory tree that it took my so long to implement. I started with Win XP media center edition of first (circa 2004 or almost) and have migrated twice more of 3 hard disks and 2 computers. All this time (5 years of daily use), I have NEVER known so many malfunctions for as many Windows basic and vital functions at the same time. I tried a lot of 3rd party "windows fix - it / registry repair" apps, all have no effect. Everything I can speculate is there was some serious damage to the registry and have no idea how/why so many Services refuse to start. In MMC, more than half of the services actually start and run, the rest all give the error message "the service or dependencies is not start (error 1068).» In addition, very oddly, no. APPS or windows appear in the toolbar AT ALL, but the Quick Launch toolbar works very well, just like the tray button and start tasks (?! )!). If I reduce a window, it "disappears" (Nothing on the task bar), but I can restore it using the alt - tab keyboard shortcut to switch apps, so all applications/windows appear on the list of the Task Manager. A few apps is paralyzed bad, as the player windows media, itunes, etc. (I guess because the service windows audio can not not start), some won't start at all, but 90% of them work fine, except to try to copy or back up all files. I can create new files, however. I'm desperate to find a solution to repair XP3 Win WITHOUT losing my installed applications and files, before I try and switch to WIndows 7. Any help/suggestions/links/advice would be much appreciated. I'm an experienced user, but I've never met so many malfunctions based on the OS at a time. I, however, very painfully learned (years before that my system so complex) it's been almost a re-installation of Windows guarantees to lose my installed apps and files, the directory tree architecture associations.

    Help, please!

    I'll be honest with you - your message is so difficult to read that I don't bother to go through all that. Next time consider using white space, ball or points numbered, etc. to make your message more readable. I stopped reading after your first sentence and only scanned the rest quickly. I do not mean to hurt your feelings; just trying to help you get targeted answers you need for the future.

    The blackout has corrupted your Windows installation. Back up your data now. Since you have problems so much, it would be probably best is to remove the hard drive, put it in a USB drive enclosure and attach it to another computer to copy the data OR start the target with Linux Livecd such as Knoppix system and copy the data to an external hard drive. IOW, do not use the damaged windows to try to get your data.

    You can try a repair that will leave your programs and facility data intact, but with this widespread bribery, it is unlikely to work. However, it takes only a few minutes and is so worth a try. If the repair facility does not work there is nothing to do, but a clean install. And Yes, it will mean that over again.

    Consider buying a UPS to help prevent future damage by power outages. For a single computer, you should look for one in the area of $60 to 80. A more expensive UPS is not necessary. Another good disaster recovery strategy is to buy an external hard drive and Acronis True Image. You can image your system (and can make an incremental backup image so that your image is still current). You can apply your image and be back running that you were in relatively few minutes after a hard drive or Windows to fail.

    http://www.michaelstevenstech.com/XPrepairinstall.htm - repair install how-to
    http://michaelstevenstech.com/cleanxpinstall.html - Clean install - how-to
    http://www.elephantboycomputers.com/page2.html#Reinstalling_Windows - you will need at hand MS - MVP - Elephant Boy computers - Don ' t Panic!

  • Drag and drop the email from windows to the folder my documents

    I am trying to drag and drop an email from Windows mail to a folder in my documents each time I do I have an option to copy and replace or do not copy. I just want to copy it here is another option or I can change to get it to copy the settings. I'm sure that once there was before me a third option so that it can be copied, can someone help me please.

    Drop into a different folder itthere and renmae before moving on to the final
    folder.
     
    --
    ..
    --
    "SS0001" wrote in message news: f9a3b155-6263-4000-89c 0-596bcea9a814...
    > I get emails from the same source, on a weekly basis and the program
    > think I want to update the existing emails with new emails, but I just
    > to add new emails to the existing e-mail file, make
    > you know how I can fix this?
     
     
  • Creates shortcuts to folders via SHIFT-CTRL/Drag-And-Drop is no longer supported in Windows 7 (64 bit)?

    In Windows Vista, there are two possibilities to create a shortcut to a folder by drag - move different combinations of keys by drag-and - drop:

    'ALT'-key: create a normal shortcut (a double-click on this shortcut navigates to the linked folder)
    "SHIFT-CTRL"-key: creates a shortcut file (junction; "." the folder appears as a subfolder of the folder of its container)

    In Windows 7, it is only possible to create normal shortcuts. 'SHIFT-CTRL' / drag-and-drop doesn't seem to work in Windows 7. Only, it behaves in the same way as 'ALT' / drag-and-drop.

    My observation is correct?
    Is it possible to activate Vista-like behavior in Windows 7 (for example, by editing the registry)?

    A few notes:

    Shortcuts to files that have been created previously with Windows Vista are always managed properly in Windows 7 (i.e., they appear as subfolders).

    The expected behavior of drag-and-drop works correctly when deleting in the folder "...\AppData\Roaming\Microsoft\Windows\Network shortcuts" (However, creating normal shortcuts via "ALT" - key is not possible in the shortcut 'network' - folder).

    Creating a shortcut to folder in "Network shortcut" and then moving in an arbitrary folder shortcut works as expected. Currently, it is the only workaround I know.

    Thank you very much for your answer!
    -Rick-

    Hi Rick,

    Welcome to the Microsoft Answers site!

    Unfortunately this feature is gone in Windows 7. This is the design.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Developer SQL 4.1.2.20 Build HAND-20, 64: cannot drag-and - drop in editor files include "#" in the name or the path

    Developer SQL 4.1.2.20 Build HAND-20, 64: I am not able to drag-and - drop a file from Windows Explorer into the SQL Developer Editor window if the name of the file or the path includes sharp «#» Unfortunately, my main directory structure contains a ' # ' in one parent folder names and I use drag-and - drop all the time... it is, I used to. :-)

    I am running Windows 7 Enterprise 64-bit with Service Pack 1

    It wasn't a problem in the previous version of SQL Developer 4.1.1.19 build HAND - 19.59.

    Thanks to study deeply and providing a repeatable test. It is a very strange edge cases.  Particularly interesting is...

    This same issue exists for JDeveloper Studio Edition Version 12.2.1.0.0

    After my tests in SQL Developer 4.1.2 the question seems to be, that say you, trying to open any file (I tried sql, xml, and pkb types) by drag-and - drop from Explorer Windows to a publisher of target opened on a XML file with a symbol of hash somewhere in the specification of the file it is.

    First of all, as a solution, I thought that I could recommend that you drag-and - drop since our view > files browser rather than Windows Explorer.  Which avoids the question and even you will descend on the Start Page tab, any worksheet or another editor must be opened before hand. However, there is a completely different problem with that: try to close the last tab of the XML Editor open blocking the entirety of the product.

    As you do not declare it against a release of the Early Adopter, where our team connect the bug, the standard procedure is so that you can open a service request with the support of the Oracle. My research did not turn any latest bug as this connected against SQL Developer or JDeveloper.

    Edit: In fact, just double click instead of using drag-and - drop from view > files avoids questions, name incorrect both hang at the end.

  • Cannot add an audio Transition VIA Drag and Drop... Next in the classroom in a book.

    I work through Premier Pro classroom in a book, and I can add audio transitions in all the different ways they ask for.

    Default shortcut as well as through the sequence menu.

    I can't add a drag and drop any kind crossfade. Not between audio or at the beginning or end of the sequence.

    Y at - it a setting that I turned on to turn it off? It seems that since I'm following the examples of book and there was no mention of any weird behaviour that should not be the case.

    We tried a few things and looked in the forums, but nobody seems to have the same problem.

    Note:

    Running a Mac with El Capitan.

    Video transitions are drag and able to receive.

    Thank you

    OK I found it.

    Looks like I got accidentally audio transition default to 0.01 seconds time in the preferences panel.

    It is in fact a framework - but not a no-brainer.

  • Drag and Drop Hide Source of success

    Hi, I created a multiple source target Drag and Drop Interaction.

    It works great except for advanced behavior, I want to take place.

    I want to give the impression that my source objects 'disappear' (hide) after I drag them successfully to the right target; How can I go about it?

    Several possibilities. Select the target object, and you will see the options for snapping behavior in the D & D Panel. You can reduce the drag source objects by changing the size, you can make their get Alpha to 0% to make them transparent, or you can let them disappear behind, by choosing back instead of the Front. Look at this screenshot, I indicated the three places, but it is not defined on 0% transparency or very small.

    You don't say what should happen with the non-correct do drag sources? You should have them abruptly back and forth, by editing the sources accepted in the Actions of the object that you can open from the same place for each target dialog.

  • Tip action to show only a previous button on a slide so the learner clicked on the button Submit on Drag and Drop

    I am a user of long date Captivate and have dabbled with advanced Actions and Variables, so know just enough to get me in trouble. Hoping someone can help me with what I hope is a simple tip action:

    I am currently using CP8 and created a training where learners click on a map of building to go to different "rooms" to complete an interaction drag-and - déposer a certain topic related HR. The problem is that some of my learners test forget what 'rooms' they have already read and will click on those they have already visited. I added a back button, so that they can return to the map if they made a mistake, but now they are able to leave the slide without completing the interaction drag and drop.

    Basically, I need to hide the back button unless the learner has already completed (for example, the user clicks on the button submit to) the Drag and Drop interaction, but I'm not sure how to set up. Can anyone help?

    Thank you!

    Hide the button back to begin with. A tip action can be triggered by an event the success and failure of the & slipped. I guess that you will need at least two commands:

    • View the "back" button
    • Go to the next slide.

    It seems the simplest solution. You can also ignore the slide D & D when they enter a second time, but then you will need a Boolean variable to be turned on/off by these same events and a conditional action on which checks this variable and immediately jumps to the next slide when it is set to 1.

  • How can I get intelligent forms to appear as feedback on my drag and drops?

    Hello

    In general, the comments that the user sees when he "fails" a drag and drop comes in the form of a "form of failure."  Which is the case when the "accept" and "reject" check boxes are clicked to drop targets - you get "success shapes" and "forms of failure", respectively.  This gives you immediate access to several styles of form in the "First name" drop-down box

    In one of my projects, feedback for drag and drops come in the form of 'success stories' and 'Legends of failure. "  It's frustrating because it gives me access to a new set has styles - styles of legends, and I can't use the typical failure and success smart shape of styles that I want to use.

    My work around was to copy the slide in a new project, create the drag and drop and goes back the slide in the project of the moose.

    Does anyone have an idea on how to fix this?  It seems to be only a problem in a project.  The theme used is not the issue because I use the same theme in many projects where I don't have this problem.

    Thanks for any help!

    & Glide will use forms instead of legends, if this option is checked in the preferences, default values

    Maybe it was the case in this project? Use the approach of the stem to convert subtitles in forms.

Maybe you are looking for