{"id":446,"date":"2013-02-27T00:37:50","date_gmt":"2013-02-26T23:37:50","guid":{"rendered":"https:\/\/mihosoft.eu\/?p=446"},"modified":"2015-04-20T10:20:09","modified_gmt":"2015-04-20T08:20:09","slug":"draggable-nodes-with-just-one-method-call","status":"publish","type":"post","link":"https:\/\/mihosoft.eu\/?p=446","title":{"rendered":"Draggable Nodes With Just One Method Call!"},"content":{"rendered":"<p>How do you make nodes draggable? If you search for draggable nodes you will find lots of code samples. But most of them don&#8217;t consider transformations. Transformations can be applied to nodes to scale them down etc. This is an important feature of JavaFX that unfortunately is not considered by many developers.<\/p>\n\n<p style=\"text-align: center;\"><strong>Don&#8217;t waste so much of JavaFX&#8217;s potential!<\/strong><\/p>\n\n<p>When I developed the window control I wanted to create draggable nodes that can also be dragged if the node or its parent was scaled. To simplify things, I added a class called <a href=\"https:\/\/github.com\/JFXtras\/jfxtras-labs\/blob\/master\/src\/main\/java\/jfxtras\/labs\/util\/event\/MouseControlUtil.java\">MouseControlUtil<\/a> to the <a href=\"http:\/\/jfxtras.org\/\">JFXtras<\/a>. It provides the method<\/p>\n\n<pre><code>MouseControlUtil.makeDraggable(final Node n);\n<\/code><\/pre>\n\n<p>This is all you need to do to make nodes draggable. Pretty cool, huh?<\/p>\n\n<p>In the video tutorial I show a sample project that demonstrates how to create lots of draggable rectangles inside of a window control that contains scalable content. We&#8217;ll discuss what happens with the mouse pointer if you don&#8217;t consider transformations.<\/p>\n\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"http:\/\/www.youtube.com\/embed\/u9XjA5eRUrE?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe>\n\n<p>Sample project: <a href=\"https:\/\/mihosoft.eu\/wp-content\/uploads\/2013\/02\/MakeNodesDraggable01.zip\">MakeNodesDraggable01<\/a>.<\/p>\n\n<h3>What features would you like to see in the future?<\/h3>\n\n<p>Do you need rotation support? What about 3D user interfaces? Tell me your ideas!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do you make nodes draggable? If you search for draggable nodes you will find lots of code samples. But most of them don&#8217;t consider transformations. Transformations can be applied to nodes to scale them down etc. This is an important feature of JavaFX that unfortunately is not considered by &#8230;<\/p>","protected":false},"author":1,"featured_media":469,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[13,21,1],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/mihosoft.eu\/wp-content\/uploads\/2013\/02\/Screenshot-from-2013-02-27-004722.png","jetpack_shortlink":"https:\/\/wp.me\/p2P2yR-7c","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/posts\/446"}],"collection":[{"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=446"}],"version-history":[{"count":21,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/posts\/446\/revisions"}],"predecessor-version":[{"id":470,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/posts\/446\/revisions\/470"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=\/wp\/v2\/media\/469"}],"wp:attachment":[{"href":"https:\/\/mihosoft.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mihosoft.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}