blockly > [utils] > [style] > [getContainerOffsetToScrollInto] を選択します

utils.style.getContainerOffsetToScrollInto() 関数

指定された element のコンテンツと境界が表示されるよう、最小量で container のスクロール位置を計算します。要素がコンテナより大きい場合、その左上隅はコンテナの左上隅にできるだけ近い位置に配置されます。Closure の goog.style.getContainerOffsetToScrollInto からコピー

署名:

export declare function getContainerOffsetToScrollInto(element: Element, container: Element, opt_center?: boolean): Coordinate;

パラメータ

パラメータ 種類 説明
要素 要素 表示する要素。
コンテナ 要素 スクロールするコンテナ。設定しない場合、ドキュメントのスクロール要素が使用されます。
opt_center boolean (省略可)要素をコンテナ内で中央に配置するかどうか。デフォルトは false です。

戻り値:

座標

コンテナの新しいスクロール位置。