<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / Draggable object in RexHMI]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=338&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=338"/>
	<updated>2017-03-17T15:29:44Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=338</id>
	<entry>
		<title type="html"><![CDATA[Re: Draggable object in RexHMI]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1557#p1557"/>
		<content type="html"><![CDATA[<p>Dear Stepan,</p><p>so far I was able to enable dragging using this tutorial <a href="http://stackoverflow.com/a/6166850" rel="nofollow">http://stackoverflow.com/a/6166850</a>.</p><p>I just add following code to your example</p><div class="codebox"><pre><code>$(obj.element) // enable dragging on the whole SVG group &lt;g&gt; element
      .draggable()
      .bind(&#039;mousedown&#039;, function(event, ui){
        // bring target to front
        $(event.target.parentElement).append( event.target );
      })
      .bind(&#039;drag&#039;, function(event, ui){
        // update coordinates manually, since top/left style props don&#039;t work on SVG
        //event.target.setAttribute(&#039;x&#039;, ui.position.left);
        //event.target.setAttribute(&#039;y&#039;, ui.position.top);
        event.target.setAttribute(&#039;transform&#039;,&#039;translate(&#039;+ui.position.left+&#039;,&#039;+ui.position.top+&#039;)&#039;);
      });</code></pre></div><p>But the button moved with small offset (need adjustment)</p><p>Then I tried the library but currently with no success. </p><p>Just minor note, if you want to use custom library, you have to add it in the JS directory in you case the <em>rex_moving_button\svghmisrc\MySvgLib\js\jquery.udraggable.js</em>.</p>]]></content>
		<author>
			<name><![CDATA[osevera]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=5</uri>
		</author>
		<updated>2017-03-17T15:29:44Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1557#p1557</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Draggable object in RexHMI]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1510#p1510"/>
		<content type="html"><![CDATA[<p>Hi, <br />I got stuck with this issue.</p><p>I managed to create custom button according tutorial mentioned in other topic on this forum, with several adjustments regarding 2.50.1 upgrade.</p><p>I cannot make the button moving according mouse position. I tried to apply both non-jquery and jquery approaches, but still no success.<br />It either does not move or not work at all.</p><p>Preferrably I&#039;d like to bundle UDRAGGABLE plugin mentioned here, because Draggable functionality seems to be very easy to be applied in HTML code:&#160; </p><p><a href="https://plugins.jquery.com/udraggable/" rel="nofollow">https://plugins.jquery.com/udraggable/</a></p><p>I added&#160; &#160; jquery.udraggable.js&#160; &#160;and other needed js to&#160; MySvgLib\js\&#160; and compile svg source, but visualization is not working. </p><p>Other link I have tried:<br /><a href="http://stackoverflow.com/questions/8569095/draggable-div-without-jquery-ui" rel="nofollow">http://stackoverflow.com/questions/8569 … -jquery-ui</a></p><br /><p>Here is the entire project:</p><p><a href="https://www.rexcontrols.cz/forum/img/members/110/rex_moving_button.zip" rel="nofollow">https://www.rexcontrols.cz/forum/img/me … button.zip</a></p><p>Thak you for possible feedback.</p><p>Stepan</p>]]></content>
		<author>
			<name><![CDATA[stepan.ozana]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=110</uri>
		</author>
		<updated>2017-03-01T06:47:32Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1510#p1510</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Draggable object in RexHMI]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1501#p1501"/>
		<content type="html"><![CDATA[<p>Thank you very much for a great example!</p>]]></content>
		<author>
			<name><![CDATA[stepan.ozana]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=110</uri>
		</author>
		<updated>2017-02-24T09:25:25Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1501#p1501</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: Draggable object in RexHMI]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1500#p1500"/>
		<content type="html"><![CDATA[<p>Hello Stepan,<br />current version of the HMI does not allow to create writable components using our extensions. But luckily you can always create custom components.</p><p>The HMI component consist from two parts a SVG group (specially tagged using XML attributes) and javascript function which controls it. I prepare simple example for you. You can find rectangle with text field. When the mouse is move in the rectangle the current coordinates are displayed on the screen and written to the REX. </p><p>Feel free to ask if not understandable.</p><p><a href="https://www.rexcontrols.cz/forum/img/members/5/Custom_HMI_component.zip" rel="nofollow">Custom_HMI_component</a></p><p>Ondrej</p>]]></content>
		<author>
			<name><![CDATA[osevera]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=5</uri>
		</author>
		<updated>2017-02-23T17:29:17Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1500#p1500</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Draggable object in RexHMI]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=1493#p1493"/>
		<content type="html"><![CDATA[<p>Hi,<br />how can I let some object set a value of rex variable by moving the object? In other words, I am trying to construct an object with similar behavior like a slider, but with customized graphic layout. For example, let&#039;s suppose visualization of inverted pendulum with 2 rectangles, representing a cart and a rod.<br />I&#039;d like to be able to drag either a cart or a rod by a mouse or by hand using a touchscreen, and&#160; thus simulate a disturbance signal in a control circuit during regulation in upright position. Or, I&#039;d like to drag a rod from lower position into upright position and let it swing down with no control.<br />I think these objects must have VALUE property, and connection type must be WRITE. But so far I have no success with this.<br />I am only able to create objects, apply CTRL+G,CTRL+J, and check TranslateX property, having no idea what to do next.<br />Thank you for feedback, Stepan.</p>]]></content>
		<author>
			<name><![CDATA[stepan.ozana]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=110</uri>
		</author>
		<updated>2017-02-19T08:43:50Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=1493#p1493</id>
	</entry>
</feed>
