<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Custom Graph Background Image Drag Reset in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/296788#M55791</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Given a custom graph box with background image and handle script, is there a way to prevent the user from accidentally dragging the background image when they miss the handle?&amp;nbsp; The problem I have is that frequently when trying to drag the handle I or another user will miss click and wind up dragging the background image instead.&amp;nbsp; There's no easy way to undo this, Ctrl+Z just rescales the image to its original size (not to the size of the graph box).&amp;nbsp; My question is this: Is there a way to force a background image in a graph box to be un-draggable?&amp;nbsp; Or, failing that, is there a way to capture Ctrl+Z to undo this mis-click?&amp;nbsp; Worst case scenario I can add a button, but its UI clutter I don't want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
scale_factor = 0.5;
curimg_scaled = img;
curimg_scaled &amp;lt;&amp;lt; Scale( scale_factor );
{scaled_width, scaled_height} = curimg_scaled &amp;lt;&amp;lt; Size;
XX=scaled_width/2;
YY=scaled_height/2;
gb = Graph Box(
	&amp;lt;&amp;lt;Add Image(
		Image( New Image( curimg_scaled ) ),
		Bounds( Left( 0 ), Right( scaled_width ), Top( 0 ), Bottom( scaled_height ) )
	),
	XName( "X_scaled" ),
	XAxis( Min( 0 ), Max( scaled_width ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
	YName( "Y_scaled" ),
	YAxis( Min( scaled_height ), Max( 0 ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
	Marker Size( 6 ),
	Handle(
		XX,
		YY, 
	//dragscript -- update position
		XX = If(x&amp;gt;scaled_width,scaled_width,x&amp;lt;1,1,x);
		YY = If(y&amp;gt;scaled_height,scaled_height,y&amp;lt;1,1,y);, 
	//mouseupscript -- update profile plots
		XX = Round( XX );
		YY = Round( YY );
		// DO STUFF
		txt = Eval Insert( "(X,Y)=(^XX^,^YY^)" );
		Print(txt);
		tb_xy &amp;lt;&amp;lt; Set Text( txt );
	);
	H Line( YY );
	V Line( XX );
);
New Window("Test",V List Box(gb,tb_xy=Text Box("")));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:05:28 GMT</pubDate>
    <dc:creator>gob0b</dc:creator>
    <dc:date>2023-06-11T11:05:28Z</dc:date>
    <item>
      <title>Custom Graph Background Image Drag Reset</title>
      <link>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/296788#M55791</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Given a custom graph box with background image and handle script, is there a way to prevent the user from accidentally dragging the background image when they miss the handle?&amp;nbsp; The problem I have is that frequently when trying to drag the handle I or another user will miss click and wind up dragging the background image instead.&amp;nbsp; There's no easy way to undo this, Ctrl+Z just rescales the image to its original size (not to the size of the graph box).&amp;nbsp; My question is this: Is there a way to force a background image in a graph box to be un-draggable?&amp;nbsp; Or, failing that, is there a way to capture Ctrl+Z to undo this mis-click?&amp;nbsp; Worst case scenario I can add a button, but its UI clutter I don't want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
scale_factor = 0.5;
curimg_scaled = img;
curimg_scaled &amp;lt;&amp;lt; Scale( scale_factor );
{scaled_width, scaled_height} = curimg_scaled &amp;lt;&amp;lt; Size;
XX=scaled_width/2;
YY=scaled_height/2;
gb = Graph Box(
	&amp;lt;&amp;lt;Add Image(
		Image( New Image( curimg_scaled ) ),
		Bounds( Left( 0 ), Right( scaled_width ), Top( 0 ), Bottom( scaled_height ) )
	),
	XName( "X_scaled" ),
	XAxis( Min( 0 ), Max( scaled_width ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
	YName( "Y_scaled" ),
	YAxis( Min( scaled_height ), Max( 0 ), Increment( 100 ), Show Minor Grid( 0 ), Show Major Grid( 0 ) ),
	Marker Size( 6 ),
	Handle(
		XX,
		YY, 
	//dragscript -- update position
		XX = If(x&amp;gt;scaled_width,scaled_width,x&amp;lt;1,1,x);
		YY = If(y&amp;gt;scaled_height,scaled_height,y&amp;lt;1,1,y);, 
	//mouseupscript -- update profile plots
		XX = Round( XX );
		YY = Round( YY );
		// DO STUFF
		txt = Eval Insert( "(X,Y)=(^XX^,^YY^)" );
		Print(txt);
		tb_xy &amp;lt;&amp;lt; Set Text( txt );
	);
	H Line( YY );
	V Line( XX );
);
New Window("Test",V List Box(gb,tb_xy=Text Box("")));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:05:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/296788#M55791</guid>
      <dc:creator>gob0b</dc:creator>
      <dc:date>2023-06-11T11:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Graph Background Image Drag Reset</title>
      <link>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297441#M55798</link>
      <description>&lt;P&gt;You can &lt;A href="https://www.jmp.com/support/help/en/15.1/index.shtml#page/jmp/drag-and-drop-an-image-into-a-graph.shtml#ww866034" target="_self"&gt;lock&lt;/A&gt; the image.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;img = New Image( "$SAMPLE_IMAGES/tile.jpg" );
scale_factor = 0.5;
curimg_scaled = img;
curimg_scaled &amp;lt;&amp;lt; Scale( scale_factor );
{scaled_width, scaled_height} = curimg_scaled &amp;lt;&amp;lt; Size;
XX = scaled_width / 2;
YY = scaled_height / 2;
gb = Graph Box(
	&amp;lt;&amp;lt;Add Image(
		Image( New Image( curimg_scaled ) ),
		Bounds( Left( 0 ), Right( scaled_width ), Top( 0 ), Bottom( scaled_height ) ), 
		//
		//
		Lock( 1 ) // lock the image so it can't be moved or rescaled
		//
		//
	),
	XName( "X_scaled" ),
	XAxis(
		Min( 0 ),
		Max( scaled_width ),
		Increment( 100 ),
		Show Minor Grid( 0 ),
		Show Major Grid( 0 )
	),
	YName( "Y_scaled" ),
	YAxis(
		Min( scaled_height ),
		Max( 0 ),
		Increment( 100 ),
		Show Minor Grid( 0 ),
		Show Major Grid( 0 )
	),
	Marker Size( 6 ),
	Handle(
		XX,
		YY, 
	//dragscript -- update position
		XX = If(
			x &amp;gt; scaled_width, scaled_width,
			x &amp;lt; 1, 1,
			x
		);
		YY = If(
			y &amp;gt; scaled_height, scaled_height,
			y &amp;lt; 1, 1,
			y
		);, 
	//mouseupscript -- update profile plots
		XX = Round( XX );
		YY = Round( YY );
		// DO STUFF
		txt = Eval Insert( "(X,Y)=(^XX^,^YY^)" );
		Print( txt );
		tb_xy &amp;lt;&amp;lt; Set Text( txt );
	);
	H Line( YY );
	V Line( XX );
);
New Window( "Test", V List Box( gb, tb_xy = Text Box( "" ) ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Sep 2020 00:59:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297441#M55798</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-09-02T00:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Graph Background Image Drag Reset</title>
      <link>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297452#M55800</link>
      <description>Thanks a bunch Jeff! Is that option to the image message documented? I must’ve missed it.</description>
      <pubDate>Wed, 02 Sep 2020 02:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297452#M55800</guid>
      <dc:creator>gob0b</dc:creator>
      <dc:date>2020-09-02T02:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Graph Background Image Drag Reset</title>
      <link>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297633#M55809</link>
      <description>&lt;P&gt;I started by right clicking on the image to see if there was a Lock option there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-09-02_09-20-59.539.png" style="width: 565px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/26567i9F33237E0DDF5E94/image-dimensions/565x197?v=v2" width="565" height="197" role="button" title="2020-09-02_09-20-59.539.png" alt="2020-09-02_09-20-59.539.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then I searched the Scripting Index (Help-&amp;gt;Scripting Index) for Lock, and I found it on the PictSeg object.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-09-02_09-17-05.895.png" style="width: 605px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/26568i5AE7E6A2C6C5A578/image-dimensions/605x295?v=v2" width="605" height="295" role="button" title="2020-09-02_09-17-05.895.png" alt="2020-09-02_09-17-05.895.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I then experimented to see if I could use it on the Add Image() message directly as I showed you above.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 13:25:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Custom-Graph-Background-Image-Drag-Reset/m-p/297633#M55809</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-09-02T13:25:28Z</dc:date>
    </item>
  </channel>
</rss>

