Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 3rd, 2024, 2:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Resetting an object to its original position
PostPosted: March 4th, 2011, 5:57 pm 
Offline

Joined: December 21st, 2009, 5:26 pm
Posts: 27
Opus: Professional 7.03
OS: XP SP3
Hi,

I am attempting to reset an object to its original position after it has been moved using a 'Move object to cursor' action. I have tried to use 'Move Horizontal/Vertical', but this doesn't work properly. Any help would be much appreciated.


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 4th, 2011, 11:38 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
JJ,

What is your Pub Type ?

Using standard actions:
Use the Move Vert/Horiz action. Click on the Move-to option. Set your X, Y coordinates (of the original position) into the settings field in the upper right of the action set-up panel.

Another way:
- Create a Path object. Basically a straight line will do. Start it somewhere in the middle of the Page, and end the Path at the center of your other object.
- For whatever trigger event you use (to return the object to 'home'), add an Action for 'Follow Path'.

That's it.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 8th, 2011, 10:22 am 
Offline

Joined: December 21st, 2009, 5:26 pm
Posts: 27
Opus: Professional 7.03
OS: XP SP3
I believe my publication type is 'Opus Professional' (the first option in the list).

I don't think I explained my problem in enough detail, it's a strange one to explain but I'll give it a go.

I have an object which is an image. What I'm designing is a click and drop screen, so the user clicks on the object which then becomes 'attached' to the cursor (using a 'Loop: move object to cursor' action). The user then clicks again to 'drop' the object. If the object is dropped in the wrong place, I need the object to move back to its original position. Using a 'Move Horizontal/Vertical' action, I have managed to achieve this. But then when the object is clicked on again, it instantly warps to a new position. This new position is always relative the position the object was dropped in, so if the object for example was dropped 50 pixels below its original position, when it is clicked on again it will instantly move 50 pixels above the cursor. It still mirrors the cursor's movements, but would always remain 50 pixels above the cursor in this example.

I was wondering if there was another way to move the object so that this doesn't happen. Lar, if I used an animation path would I be able to move the object from the position it was dropped to the exact position it started from?


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 8th, 2011, 6:53 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Quote:
The user then clicks again to 'drop' the object. If the object is dropped in the wrong place, I need the object to move back to its original position.
Looking at just this statement, and not reading the whole problem, one solution I would point to is to create a Drop Zone.

For example, create a Frame object to cover the right place where image should be dropped. Set the Drag & Drop properties for the Frame (mainly which objects to allow to be dropped on it). Now set the Properties for your image objects -- for Drag & Drop, use the option to "return to original position" if not dropped of a valid drop zone.

Quote:
if I used an animation path would I be able to move the object from the position it was dropped to the exact position it started from?
"...from the position it was dropped". Short answer is 'no'. If you had specific and predictable places where the 'wrong drop' would happen, then maybe would work.

I suggest you look at Mackavi's website and find the Scribbles area, or more specifically find his collection of Opus 'functions' that he posted some time ago. He did some things with drag and drop and jump to cursor... etc. some time ago. Most of that used opusscript, but you still might find something interesting.

You can also check DW's main site -- Paul posted some time ago that they were going to put some of their tutorials there.

BTW, you wrote...
Quote:
the user clicks on the object which then becomes 'attached' to the cursor (using a 'Loop: move object to cursor' action).
If you used Drag & Drop features, you do not need this special construct.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 9th, 2011, 10:26 am 
Offline

Joined: December 21st, 2009, 5:26 pm
Posts: 27
Opus: Professional 7.03
OS: XP SP3
Unless I'm missing something, drag and drop will not do what I need it to in this case. I need a single mouse click to attach the object to the cursor, and another single mouse click to drop the object. As far as I can tell, drag and drop only works if you click and hold, then release to drop the object, which is not what I want to do unfortunately.

I don't have any objections to using OpusScript, I just need this problem fixed. I will check out the places you have suggested, thanks.


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 9th, 2011, 11:10 am 
Offline

Joined: December 21st, 2009, 5:26 pm
Posts: 27
Opus: Professional 7.03
OS: XP SP3
Ok, after looking at OpusScript help I've managed to fix the problem, thought I'd post it up here in case anyone else encounters the same issue.

After using Move Horizontal/Vertical to move the object back to its original position, I used CloneObject to create a new version of the object in exactly the same position, then used a hide action to hide the original object.


Top
 Profile  
 
 Post subject: Re: Resetting an object to its original position
PostPosted: March 9th, 2011, 11:30 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
A non cloned idea:

Code:
function dropAndReset(d)
{
if (d.dropped == true)
   {
   d.dropped = false
   d.SetPosition(d.pos.x,d.pos.y)
   } else if (d.dragging == true)
      {
      d.dragging = false
      d.dropped = true
      }  else
         {
         d.dragging = true
         d.pos = d.GetPosition()
         while (!IsMousePressed("left"))
            {
            p = GetMousePosition()
            d.SetPosition(p.x,p.y)
            wait()
            }
         }
}


Just call the function on an object using a left mouse click and the line

Code:
dropAndReset(this)


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group