blockly > utils > style

utils.style 命名空间

函数

功能 说明
getBorderBox(element) 获取计算出的边框宽度(四周),以像素为单位。从 Closure 的 goog.style.getBorderBox 复制
getComputedStyle(element, property)

检索节点计算出的样式值。如果请求的属性是 SVG 属性,并且尚未明确设置(Firefox 和 webkit),则返回空字符串。

从 Closure 的 goog.style.getComputedStyle 中复制

getContainerOffsetToScrollInto(element, container, opt_center) 使用最小距离计算 container 的滚动位置,使给定 element 的内容和边框可见。如果元素大于容器,则其左上角会尽可能靠近容器的左上角。从 Closure 的 goog.style.getContainerOffsetToScrollInto 中复制
getPageOffset(el) 返回相对于 HTML 文档左上角的坐标对象。类似于 Closure 的 goog.style.getPageOffset
getSize(element) 获取元素的高度和宽度。类似于 Closure 的 goog.style.getSize
getViewportPageOffset() 计算相对于文档的视口坐标。类似于 Closure 的 goog.style.getViewportPageOffset
scrollIntoContainerView(element, container, opt_center) container 的滚动位置更改为最小的距离,使给定 element 的内容和边框可见。如果元素大于容器,则其左上角会尽可能靠近容器的左上角。从 Closure 的 goog.style.scrollIntoContainerView 中复制

变量

变量 说明
TEST_ONLY