本文整理匯總了TypeScript中@ephox/sugar.Width.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Width.get方法的具體用法?TypeScript Width.get怎麽用?TypeScript Width.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Width
的用法示例。
在下文中一共展示了Width.get方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getDimensions
export const resize = (editor: Editor, deltas, resizeType: ResizeTypes) => {
const container = Element.fromDom(editor.getContainer());
const dimensions = getDimensions(editor, deltas, resizeType, Height.get(container), Width.get(container));
Obj.each(dimensions, (val, dim) => Css.set(container, dim, Utils.numToPx(val)));
Events.fireResizeEditor(editor);
};
示例2:
return Step.sync(function () {
const element = Hierarchy.follow(Element.fromDom(editor.getBody()), path).getOrDie('could not find element');
const height = Height.get(element);
const width = Width.get(element);
state.set({
h: height,
w: width
});
});
示例3:
return Logger.t('Set height and width', Step.sync(() => {
const element = Hierarchy.follow(Element.fromDom(editor.getBody()), path).getOrDie('could not find element');
const height = Height.get(element);
const width = Width.get(element);
state.set({
h: height,
w: width
});
}));
示例4: looseEqual
return Step.sync(function () {
const element = Hierarchy.follow(Element.fromDom(editor.getBody()), path).getOrDie('could not find element');
const height = Height.get(element);
const width = Width.get(element);
const changedHeight = state.get().h + change.dh;
const changedWidth = state.get().w + change.dw;
Assertions.assertEq('height has changed as expected', true, looseEqual(changedHeight, height, 2));
Assertions.assertEq('width has changed as expected', true, looseEqual(changedWidth, width, 2));
});
示例5: looseEqual
return Logger.t('Asset change in height and width', Step.sync(() => {
const element = Hierarchy.follow(Element.fromDom(editor.getBody()), path).getOrDie('could not find element');
const height = Height.get(element);
const width = Width.get(element);
const changedHeight = state.get().h + change.dh;
const changedWidth = state.get().w + change.dw;
Assertions.assertEq('height is ' + height + ' but expected ' + changedHeight, true, looseEqual(changedHeight, height, 4));
Assertions.assertEq('width is ' + width + ' but expected ' + changedWidth, true, looseEqual(changedWidth, width, 4));
}));
示例6:
AlloyEvents.run<ChangeSlideEvent>(changeSlideEvent, (comp, se) => {
// If it was partially through a slide, clear that and measure afresh
Css.remove(comp.element(), 'width');
const currentWidth = Width.get(comp.element());
InlineView.setContent(comp, se.event().contents());
Class.add(comp.element(), resizingClass);
const newWidth = Width.get(comp.element());
Css.set(comp.element(), 'width', currentWidth + 'px');
InlineView.getContent(comp).each((newContents) => {
se.event().focus().bind((f) => {
Focus.focus(f);
return Focus.search(comp.element());
}).orThunk(() => {
Keying.focusIn(newContents);
return Focus.active();
});
});
Delay.setTimeout(() => {
Css.set(comp.element(), 'width', newWidth + 'px');
}, 0);
}),
示例7:
memContainer.getOpt(anyInSystem).each((panel) => {
const panelW = Width.get(panel.element());
const panelH = Height.get(panel.element());
const width = img.dom().naturalWidth;
const height = img.dom().naturalHeight;
const zoom = Math.min((panelW) / width, (panelH) / height);
if (zoom >= 1) {
zoomState.set(1);
} else {
zoomState.set(zoom);
}
});
示例8: parseInt
Css.getRaw(parent, 'left').each(function (left) {
const currentLeft = parseInt(left, 10);
const w = Width.get(screens[0]);
Css.set(parent, 'left', (currentLeft - (direction * w)) + 'px');
});
示例9:
onStartShrink: (slider: AlloyComponent) => {
AlloyTriggers.emitWith(slider, fixSize, { width: Width.get(slider.element()) + 'px' });
}