Telogis.GeoBase.MapLayers.BalloonSkin |
MapLayers.BalloonSkin inherits from Skin.
A simple class that combines all the information describing the appearance of a balloon. Several predefined instances are available as static properties of the MapLayers.BalloonSkin class, and can be used to theme balloons reasonably painlessly.
var myBalloonSkin = new Telogis.GeoBase.MapLayers.BalloonSkin({ bodyStyle: { // specify the style of the balloon and its text backgroundColor: "#ffffff", border: "1px solid black", color: "#000000", fontFamily: "sans-serif", fontSize: "20px", fontWeight: "normal", padding: "10px", textAlign: "center", verticalAlign: "middle", width: "150px" }, folder: "images/skins/balloon/directedwhite", // specify the default images folder tagAnchorPoint: new GeoBase.Point(0.0, 1.0), // specify the bottom-left image position tagOverlap: 1, // adjust the vertical position of the balloon tag (move bottom-left image and tag closer/further apart) bottomLeftTagSrc: 'tag-bottom-left.png', // image used for bottom-left balloon tag corner (relative to 'folder') bottomRightTagSrc: 'tag-bottom-right.png', // image used for bottom-right balloon tag corner topLeftTagSrc: 'tag-top-left.png', // image used for top-left balloon tag corner topRightTagSrc: 'tag-top-right.png' // image used for top-right balloon tag corner });
Name | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MapLayers.BalloonSkin(config) | Arguments
|
Name | Description |
---|---|
applyBodyStyle (Element elem) | Applies each of the skin's body styles (specified at construction with the MapLayers.BalloonSkin.config.bodyStyle property) to a given DOM element. These will override any existing style information. Arguments
|
getTagAnchorPixels (Number hAlign, Number vAlign, Boolean horizontal) | Calls MapLayers.BalloonSkin.getTagAnchorPixels and converts the result to a pixel offset from the tag image's top-left corner. Arguments
Point - The offset of the point in the tag image for the given alignment that should align to the balloon's target element. The coordinates of this point are pixel offsets relative to the image's top-left corner. |
getTagAnchorPoint (Number hAlign, Number vAlign, Boolean horizontal) | Transforms the tag anchor point -- specified at skin construction -- to be representative of the tag image at the given alignment (the original specification is for the top-right-aligned tag). Arguments
Point - The offset of the point in the tag image for the given alignment that should align to the balloon's target element. The coordinates of this point are proportions of the tag image's width and height, relative to its top-left corner. |
getTagOverlap () | Finds the number of pixels by which the tag should overlap the content area of the balloon, hiding its border (if applicable). JavaScript var myBalloonSkin = new Telogis.GeoBase.MapLayers.BalloonSkin({ tagOverlap: 1, // adjust the vertical position of the balloon tag (move bottom-left image and tag closer/further apart) }); // Get the tag overlap alert('Tag overlap is '+ myBalloonSkin.getTagOverlap()+' pixel(s)'); // 'Tag overlap is 1 pixel(s)' Number - The pixel overlap of the top of the tag image over the bottom of the content element. |
getTagSize (Boolean horizontal) | Finds the pixel dimensions of the tag image described by the skin. These are taken from the top-right tag image, and are assumed to be the same for all other alignments. JavaScript var myBalloonSkin = new Telogis.GeoBase.MapLayers.BalloonSkin({ bodyStyle: { // specify the style of the balloon and its text backgroundColor: "#ffffff", border: "1px solid black", color: "#000000", fontFamily: "sans-serif", fontSize: "20px", fontWeight: "normal", padding: "10px", textAlign: "center", verticalAlign: "middle", width: "150px" }, folder: "images/skins/balloon/directedwhite" // specify the default images folder }); alert('Tag size is '+ myBalloonSkin.getTagSize(true)+' pixels'); // 'Tag size is 8x8 pixels' // Note that this is using the default images included in the 'directedwhite' folder // of a standard SDK installation
Size - The width and height of the tag image. |
getTagSrc (Number hAlign, Number vAlign, Boolean horizontal) | Finds the appropriate tag image to use with a given balloon alignment. JavaScript var myBalloonSkin = new Telogis.GeoBase.MapLayers.BalloonSkin({ // Set the image folder location folder: "myImageFolder/skins/balloon", // specify the default images folder // Specify a tag corner image bottomLeftTagSrc: 'myBottomLeftImage.png', // image used for bottom-left balloon tag corner (relative to 'folder') }); var Balloon = Telogis.GeoBase.MapLayers.Balloon; // Call getTagSrc function for bottom-left tag image alert('Tag source of the bottom-left tag image (horizontal alignment) is '+ // Accepts 'ALIGN_LEFT', 'ALIGN_RIGHT', 'ALIGN_TOP', 'ALIGN_BOTTOM' myBalloonSkin.getTagSrc(Balloon.ALIGN_LEFT, Balloon.ALIGN_BOTTOM, true)); // 'Tag source of the bottom-left tag image (horizontal alignment) // is myImageFolder/skins/balloon/myBottomLeftImage.png'
String - The URL of the tag image file to be used with the specified balloon alignment. |