Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 10:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: SetPosition
PostPosted: March 7th, 2011, 2:42 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi,

myImage.SetPositionX(100,2.0)
myImage.SetPositionY(50,2.0)

I am using these script functions to set an object to a position on the page, but the object being moved can be different sizes. The issue is that SetPositionXY sets the position to the midpoint of the object moved. I can get the dimensions and then divide by two, but this can result in a pixel off on either side depending if the object to be moved is an odd or even number, as when divided by 2 it creates a fraction.

I can use Math.round() but this still doesn't set the exact point. Is there a method for setting the position of an object on the page by using the top left X,Y points only, not the midpoint.


Thanks.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: SetPosition
PostPosted: March 7th, 2011, 3:45 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
You can try GetObjectDimensions and SetObjectDimensions.

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


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: SetPosition
PostPosted: March 7th, 2011, 4:40 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Thanks Lar,

That will scale the object to match the shape of the GetObjectDimensions. Is there a way just to use the left and top points to set the position of another object to those points without having to work out the mid-point of an object? I don't want to scale the object, just set the top and left position.

Code:
var dimInfo = Text_Template.GetObjectDimensions();
var dimX = dimInfo.left;
var dimY = dimInfo.top;


As mentioned in previous post, getting the mid-point of an object that creates a decimal when divided creates an issue when using SetPositionY() as it can be one pixel out each time.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: SetPosition
PostPosted: March 7th, 2011, 6:27 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
I do not know. I have not played with these particular commands.

But I think you could do something like this. If you want to move Obj02 to the Left side (alignment) of Obj01, get the object dimensions of both. Then subtract: dimInfo1.left - dimInfo2.left

That should give the x-value distance to move. (if I interpreted your situation correctly) You can figure the y-value displacement in a similar way.

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


For this message Lar_123 has been thanked by : lmc, mackavi


Top
 Profile  
 
 Post subject: Re: SetPosition
PostPosted: March 22nd, 2011, 2:48 pm 
Offline

Joined: July 12th, 2009, 10:33 am
Posts: 124
Can you fix the dimensions to even numbers?

_________________
V9.6. Windows 10. Testing on PC, Mac, iPad.


For this message dan1 has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 20 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