Quantcast
World map overlay frame and SetMovable - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-13-20, 12:18 AM   #1
maqjav
A Cyclonian
Join Date: Feb 2012
Posts: 49
World map overlay frame and SetMovable

Hello.

I'm adding a new overlay frame to my world map that contains one frame.
I'm trying to allow the user to move this frame on drag and drop.

The problem I'm finding is that if the frame is not movable, whenever I minimize/maximize the world map my frame adapts to the world map container correcly remaining in the correct position, but as soon as I make it movable, the frame detaches from the world map and it doesn't adapt anymore, so if in the maximized version it appears in the top right corner of the map, in the minimize version it appears on top of my minimap.

Is it posible to keep my frame inside the world map and maintain the last position while maximized/minimized?

This is my code:

Code:
WorldMapFrame:AddOverlayFrame("MyTemplate", "FRAME", "CENTER", WorldMapFrame:GetCanvasContainer(), "TOP", 0, 0);

MyTemplateMixin = { };

function MyTemplateMixin:OnLoad() 
  self.MyFrame:SetMovable(true)
  self.MyFrame:RegisterForDrag("LeftButton")
  self.MyFrame:SetScript("OnDragStart", function(self)
    self:StartMoving()
  end)
  
  self.MyFrame:SetScript("OnDragStop", function(self)
    self:StopMovingOrSizing()
  end)
end

function MyTemplateMixin:Refresh()

end

MyFrameMixin = { }

function MyFrameMixin:OnMouseEnter()

end

function MyFrameMixin:OnMouseLeave()

end
And my template:
Code:
<?xml version="1.0"?>
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">

  <Script file="MyTemplateMixin.lua"/>

  <Frame name="MyTemplate" frameStrata="HIGH" mixin="MyTemplateMixin" virtual="true">
    <Size x="175" y="32" />
	<Frames>
    	   <Frame parentKey="MyFrame" mixin="MyFrameMixin">
		<Size>
		   <AbsDimension x="175" y="32"></AbsDimension>
		</Size>
		<Anchors>
		   <Anchor point="CENTER"/>
		</Anchors>
		<Layers>
		   <Layer level="BACKGROUND">
			<Texture file="Interface\ChatFrame\UI-ChatInputBorder-Left">
				<Size>
					<AbsDimension x="75" y="32"></AbsDimension>
				</Size>
				<Anchors>
					<Anchor point="LEFT">
						<Offset>
							<AbsDimension x="-15" y="0"></AbsDimension>
						</Offset>
					</Anchor>
				</Anchors>
			</Texture>
		</Layer>
	</Layers>
	<Scripts>
	  	<OnEnter method="OnMouseEnter"/>
	  	<OnLeave method="OnMouseLeave"/>
	</Scripts>
      </Frame>
    </Frames>
    <Scripts>
      <OnLoad method="OnLoad" />
    </Scripts>
  </Frame>

</Ui>
Thanks.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » World map overlay frame and SetMovable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off