-- rootMap.lua
-- 

addSearchResourcesPath( moduleDirectory .. "/configuration/" )
local WorldMap = sasl.gl.loadImage("world1200_2.png",0,0,1198,509)
local ToggleMap = sasl.gl.loadImage("ToggleMap.png",0,0,80,60)
local green = {0, 1, 0, 1}
local red = {1, 0, 0, 1}
size = {1198, 509}

function draw()
	xx = 596 + 598*get(curLon)/180
	yy = 208 + 301*get(curLat)/90
	if mapIsOn == 1 then
		sasl.gl.drawTexture(WorldMap, 0, 0, 1198, 509)
		sasl.gl.drawWidePolyLine( points1, 2, green )
		sasl.gl.drawWidePolyLine( points2, 2, green )
		sasl.gl.drawRectangle( xx , yy , 10, 10, red )
	end
	sasl.gl.drawTexture(ToggleMap, 0, 0, 80, 60)
end

function onMouseDown(component , x , y , button , parentX , parentY)
	if button == MB_LEFT then
		if x < 80 and y < 60 then
			mapIsOn = 1 - mapIsOn
		end
	end
end