本文整理匯總了TypeScript中tinymce/core/dom/DOMUtils.DOM.getViewPort方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DOM.getViewPort方法的具體用法?TypeScript DOM.getViewPort怎麽用?TypeScript DOM.getViewPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tinymce/core/dom/DOMUtils.DOM
的用法示例。
在下文中一共展示了DOM.getViewPort方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const toAbsolute = function (rect) {
const vp = DOMUtils.DOM.getViewPort();
return {
x: rect.x + vp.x,
y: rect.y + vp.y,
w: rect.w,
h: rect.h
};
};
示例2: function
const getDialogMinHeight = function (editor) {
return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_height', 650));
};
示例3: function
const getDialogHeight = function (editor) {
return Math.min(DOMUtils.DOM.getViewPort().h, editor.getParam('template_popup_height', 500));
};
示例4: function
Tools.each(children, function (child) {
if (child.nodeType) {
elm.appendChild(child);
}
});
}
return elm;
},
createFragment (html) {
return DOMUtils.DOM.createFragment(html);
},
getWindowSize () {
return DOMUtils.DOM.getViewPort();
},
getSize (elm) {
let width, height;
if (elm.getBoundingClientRect) {
const rect = elm.getBoundingClientRect();
width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth);
height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight);
} else {
width = elm.offsetWidth;
height = elm.offsetHeight;
}
示例5: function
const getMinHeight = function (editor) {
return editor.getParam('code_dialog_height', Math.min(DOMUtils.DOM.getViewPort().h - 200, 500));
};
示例6: open
//.........這裏部分代碼省略.........
{ type: 'spacer', flex: 1 }
]).hide();
mainPanel = createPanel([
{ tooltip: 'Crop', icon: 'crop', onclick: switchPanel(cropPanel) },
{ tooltip: 'Resize', icon: 'resize2', onclick: switchPanel(resizePanel) },
{ tooltip: 'Orientation', icon: 'orientation', onclick: switchPanel(flipRotatePanel) },
{ tooltip: 'Brightness', icon: 'sun', onclick: switchPanel(brightnessPanel) },
{ tooltip: 'Sharpen', icon: 'sharpen', onclick: switchPanel(sharpenPanel) },
{ tooltip: 'Contrast', icon: 'contrast', onclick: switchPanel(contrastPanel) },
{ tooltip: 'Color levels', icon: 'drop', onclick: switchPanel(colorizePanel) },
{ tooltip: 'Gamma', icon: 'gamma', onclick: switchPanel(gammaPanel) },
{ tooltip: 'Invert', icon: 'invert', onclick: switchPanel(invertPanel) }
// {text: 'More', onclick: switchPanel(filtersPanel)}
]);
imagePanel = ImagePanel.create({
flex: 1,
imageSrc: currentState.url
});
sidePanel = Factory.create('Container', {
layout: 'flex',
direction: 'column',
border: '0 1 0 0',
padding: 5,
spacing: 5,
items: [
{ type: 'button', icon: 'undo', tooltip: 'Undo', name: 'undo', onclick: undo },
{ type: 'button', icon: 'redo', tooltip: 'Redo', name: 'redo', onclick: redo },
{ type: 'button', icon: 'zoomin', tooltip: 'Zoom in', onclick: zoomIn },
{ type: 'button', icon: 'zoomout', tooltip: 'Zoom out', onclick: zoomOut }
]
});
mainViewContainer = Factory.create('Container', {
type: 'container',
layout: 'flex',
direction: 'row',
align: 'stretch',
flex: 1,
items: [sidePanel, imagePanel]
});
panels = [
mainPanel,
cropPanel,
resizePanel,
flipRotatePanel,
filtersPanel,
invertPanel,
brightnessPanel,
huePanel,
saturatePanel,
contrastPanel,
grayscalePanel,
sepiaPanel,
colorizePanel,
sharpenPanel,
embossPanel,
gammaPanel,
exposurePanel
];
win = editor.windowManager.open({
layout: 'flex',
direction: 'column',
align: 'stretch',
minWidth: Math.min(DOMUtils.DOM.getViewPort().w, 800),
minHeight: Math.min(DOMUtils.DOM.getViewPort().h, 650),
title: 'Edit image',
items: panels.concat([mainViewContainer]),
buttons: [
{ text: 'Save', name: 'save', subtype: 'primary', onclick: save },
{ text: 'Cancel', onclick: 'close' }
]
});
win.on('close', function () {
reject();
destroyStates(undoStack.data);
undoStack = null;
tempState = null;
});
undoStack.add(currentState);
updateButtonUndoStates();
imagePanel.on('load', function () {
width = imagePanel.imageSize().w;
height = imagePanel.imageSize().h;
ratioW = height / width;
ratioH = width / height;
win.find('#w').value(width);
win.find('#h').value(height);
});
imagePanel.on('crop', crop);
}