layer position

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

layer position

Post by davoodice2 »

hi friends. how to get later position? and how to set layer position?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 10007
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: layer position

Post by synthsin75 »

moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: layer position

Post by davoodice2 »

synthsin75 wrote: Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
thanks wes.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: layer position

Post by davoodice2 »

synthsin75 wrote: Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 10007
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: layer position

Post by synthsin75 »

davoodice2 wrote: Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The upper right corner is: moho.view:Width(), 0
The lower right corner is: moho.view:Width(), moho.view:Height()

2D layer mouse position is: mouseEvent.vec
User avatar
hayasidist
Posts: 3557
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: layer position

Post by hayasidist »

synthsin75 wrote: Mon Sep 13, 2021 5:54 pm
davoodice2 wrote: Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The upper right corner is: moho.view:Width(), 0
The lower right corner is: moho.view:Width(), moho.view:Height()

2D layer mouse position is: mouseEvent.vec
just for clarity:

view:Height() etc is pixels in the Screen coordinate system (LM_Point)
mouseEvent.pt is also in the Screen coordinate system

mouseEvent.vec is the World coordinate system (LM_Vector2)

Conversion between the systems depends on the transforms such as layer translation, camera zoom etc etc but can be effected using
LM_Graphics:ScreenToWorld and LM_Graphics:WorldToScreen
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: layer position

Post by davoodice2 »

Thank you very much .I continue to learn with your helps
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
Post Reply