Blockly.utils. style
Methods
getBorderBox
getBorderBox(element) returns Object
Gets the computed border widths (on all sides) in pixels Copied from Closure's goog.style.getBorderBox
Parameter |
|
---|---|
element |
Element The element to get the border widths for. Value must not be null. |
- Returns
-
non-null Object
The computed border widths.
getCascadedStyle
getCascadedStyle(element, style) returns string
Gets the cascaded style value of a node, or null if the value cannot be computed (only Internet Explorer can do this).
Copied from Closure's goog.style.getCascadedStyle
Parameter |
|
---|---|
element |
Element Element to get style of. Value must not be null. |
style |
string Property to get (camel-case). |
- Returns
-
string
Style value.
getComputedStyle
getComputedStyle(element, property) returns string
Retrieves a computed style value of a node. It returns empty string if the value cannot be computed (which will be the case in Internet Explorer) or "none" if the property requested is an SVG one and it has not been explicitly set (firefox and webkit).
Copied from Closure's goog.style.getComputedStyle
Parameter |
|
---|---|
element |
Element Element to get style of. Value must not be null. |
property |
string Property to get (camel-case). |
- Returns
-
string
Style value.
getContainerOffsetToScrollInto
getContainerOffsetToScrollInto(element, container, opt_center) returns Blockly.utils.Coordinate
Calculate the scroll position of container
with the minimum amount so
that the content and the borders of the given element
become visible.
If the element is bigger than the container, its top left corner will be
aligned as close to the container's top left corner as possible.
Copied from Closure's goog.style.getContainerOffsetToScrollInto
Parameter |
|
---|---|
element |
Element The element to make visible. Value must not be null. |
container |
Element The container to scroll. If not set, then the document scroll element will be used. Value must not be null. |
opt_center |
Optional boolean Whether to center the element in the container. Defaults to false. |
- Returns
-
non-null Blockly.utils.Coordinate
The new scroll position of the container, in form of goog.math.Coordinate(scrollLeft, scrollTop).
getPageOffset
getPageOffset(el) returns Blockly.utils.Coordinate
Returns a Coordinate object relative to the top-left of the HTML document. Similar to Closure's goog.style.getPageOffset
Parameter |
|
---|---|
el |
Element Element to get the page offset for. Value must not be null. |
- Returns
-
non-null Blockly.utils.Coordinate
The page offset.
getSize
getSize(element) returns Blockly.utils.Size
Gets the height and width of an element. Similar to Closure's goog.style.getSize
Parameter |
|
---|---|
element |
Element Element to get size of. Value must not be null. |
- Returns
-
non-null Blockly.utils.Size
Object with width/height properties.
getViewportPageOffset
getViewportPageOffset() returns Blockly.utils.Coordinate
Calculates the viewport coordinates relative to the document. Similar to Closure's goog.style.getViewportPageOffset
- Returns
-
non-null Blockly.utils.Coordinate
The page offset of the viewport.
isRightToLeft
isRightToLeft(el) returns boolean
Returns true if the element is using right to left (RTL) direction. Copied from Closure's goog.style.isRightToLeft
Parameter |
|
---|---|
el |
Element The element to test. Value must not be null. |
- Returns
-
boolean
True for right to left, false for left to right.
scrollIntoContainerView
scrollIntoContainerView(element, container, opt_center)
Changes the scroll position of container
with the minimum amount so
that the content and the borders of the given element
become visible.
If the element is bigger than the container, its top left corner will be
aligned as close to the container's top left corner as possible.
Copied from Closure's goog.style.scrollIntoContainerView
Parameter |
|
---|---|
element |
Element The element to make visible. Value must not be null. |
container |
Element The container to scroll. If not set, then the document scroll element will be used. Value must not be null. |
opt_center |
Optional boolean Whether to center the element in the container. Defaults to false. |
setElementShown
setElementShown(el, isShown)
Shows or hides an element from the page. Hiding the element is done by setting the display property to "none", removing the element from the rendering hierarchy so it takes up no space. To show the element, the default inherited display property is restored (defined either in stylesheets or by the browser's default style rules). Copied from Closure's goog.style.getViewportPageOffset
Parameter |
|
---|---|
el |
Element Element to show or hide. Value must not be null. |
isShown |
any type True to render the element in its default style, false to disable rendering the element. |