Skip to content
Snippets Groups Projects
Commit b825be4d authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Frameless minimap

parent 8e052db2
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,10 @@
// The minor cardinal direction labels are hidden if their height is more
// than this proportion of the map.
const F32 MAP_MINOR_DIR_THRESHOLD = 0.07f;
const S32 MAP_PADDING_LEFT = 0;
const S32 MAP_PADDING_TOP = 2;
const S32 MAP_PADDING_RIGHT = 2;
const S32 MAP_PADDING_BOTTOM = 0;
//
// Member functions
......@@ -59,15 +63,15 @@ const F32 MAP_MINOR_DIR_THRESHOLD = 0.07f;
LLFloaterMap::LLFloaterMap(const LLSD& key)
: LLFloater(key),
mTextBoxEast(NULL),
mTextBoxNorth(NULL),
mTextBoxWest(NULL),
mTextBoxSouth(NULL),
mTextBoxSouthEast(NULL),
mTextBoxNorthEast(NULL),
mTextBoxNorthWest(NULL),
mTextBoxSouthWest(NULL),
mMap(NULL)
mTextBoxEast(nullptr),
mTextBoxNorth(nullptr),
mTextBoxWest(nullptr),
mTextBoxSouth(nullptr),
mTextBoxSouthEast(nullptr),
mTextBoxNorthEast(nullptr),
mTextBoxNorthWest(nullptr),
mTextBoxSouthWest(nullptr),
mMap(nullptr)
{
}
......@@ -97,6 +101,9 @@ BOOL LLFloaterMap::postBuild()
mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
updateMinorDirections();
// Get the drag handle all the way in back
......@@ -211,10 +218,26 @@ void LLFloaterMap::draw()
LLFloater::draw();
}
void LLFloaterMap::stretchMiniMap(S32 width,S32 height)
{
//fix for ext-7112
//by default ctrl can't overlap caption area
if(mMap)
{
LLRect map_rect;
map_rect.setLeftTopAndSize( MAP_PADDING_LEFT, getRect().getHeight() - MAP_PADDING_TOP, width, height);
mMap->reshape( width, height, 1);
mMap->setRect(map_rect);
}
}
void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
{
LLFloater::reshape(width, height, called_from_parent);
stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
,height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
updateMinorDirections();
}
......@@ -244,6 +267,13 @@ void LLFloaterMap::handleZoom(const LLSD& userdata)
}
}
void LLFloaterMap::setMinimized(BOOL b)
{
LLFloater::setMinimized(b);
setTitle(b ? getString("mini_map_caption") : "");
}
LLFloaterMap* LLFloaterMap::getInstance()
{
return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");
......
......@@ -35,23 +35,26 @@ class LLTextBox;
//
// Classes
//
class LLFloaterMap : public LLFloater
class LLFloaterMap final : public LLFloater
{
public:
LLFloaterMap(const LLSD& key);
static LLFloaterMap* getInstance();
virtual ~LLFloaterMap();
/*virtual*/ BOOL postBuild();
/*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
/*virtual*/ void draw();
/*virtual*/ BOOL postBuild() override;
/*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ) override;
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override;
/*virtual*/ void draw() override;
/*virtual*/ void setMinimized(BOOL b) override;
private:
void handleZoom(const LLSD& userdata);
void setDirectionPos( LLTextBox* text_box, F32 rotation );
void updateMinorDirections();
void stretchMiniMap(S32 width,S32 height);
LLTextBox* mTextBoxEast;
LLTextBox* mTextBoxNorth;
LLTextBox* mTextBoxWest;
......
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
positioning="cascading"
bg_alpha_image_overlay="DkGray_33"
can_minimize="true"
can_resize="true"
header_height="0"
chrome="true"
height="200"
layout="topleft"
min_height="128"
min_width="128"
name="Map"
title="MINI-MAP"
title=""
help_topic="map"
save_rect="true"
save_visibility="true"
......@@ -27,6 +29,7 @@
Mini-map
</floater.string>
<net_map
bg_color="NetMapBackgroundColor"
follows="top|left|bottom|right"
layout="topleft"
left="0"
......@@ -45,6 +48,7 @@
name="floater_map_north"
right="10"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
N
</text>
......@@ -58,6 +62,7 @@
name="floater_map_east"
right="10"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
E
</text>
......@@ -71,6 +76,7 @@
name="floater_map_west"
right="11"
text_color="1 1 1 0.7"
font_shadow="hard"
top="175">
W
</text>
......@@ -84,6 +90,7 @@
name="floater_map_south"
right="10"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
S
</text>
......@@ -97,6 +104,7 @@
name="floater_map_southeast"
right="20"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
SE
</text>
......@@ -110,6 +118,7 @@
name="floater_map_northeast"
right="20"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
NE
</text>
......@@ -123,6 +132,7 @@
name="floater_map_southwest"
right="20"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
SW
</text>
......@@ -136,6 +146,7 @@
name="floater_map_northwest"
right="20"
text_color="1 1 1 0.7"
font_shadow="hard"
top="189">
NW
</text>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment