本文整理匯總了TypeScript中@ephox/agar.Mouse.cMouseUpTo方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mouse.cMouseUpTo方法的具體用法?TypeScript Mouse.cMouseUpTo怎麽用?TypeScript Mouse.cMouseUpTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Mouse
的用法示例。
在下文中一共展示了Mouse.cMouseUpTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const sDragDrop = function (container, selector, dx, dy) {
return Chain.asStep(container, [
UiFinder.cFindIn(selector),
Mouse.cMouseDown,
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUpTo(dx, dy)
]);
};
示例2:
const sDragDrop = (container, selector, dx, dy) => {
return Logger.t('Drag from a point and drop at specified point', Chain.asStep(container, [
UiFinder.cFindIn(selector),
Mouse.cMouseDown,
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUpTo(dx, dy)
]));
};
示例3: function
export default function (editor) {
const ui = TinyUi(editor);
const cHasState = function (predicate) {
return Chain.control(
Chain.binder(function (element) {
return predicate(element) ? Result.value(element) : Result.error('Predicate didn\'t match.');
}),
Guard.addLogging('Assert element has state')
);
};
const cWaitForState = function (predicate) {
return Chain.control(
cHasState(predicate),
Guard.tryUntil('Predicate has failed.', 10, 3000)
);
};
const cDragDrop = Chain.control(
Chain.fromChains([
UiFinder.cFindIn('.tox-slider__handle'),
Mouse.cMouseDown,
Mouse.cMouseMoveTo(5, 0),
Mouse.cMouseUpTo(5, 0)
]),
Guard.addLogging('Drag and drop')
);
const cExecCommandFromDialog = function (label) {
let cInteractWithUi;
switch (label) {
case 'Rotate counterclockwise':
case 'Rotate clockwise':
case 'Flip vertically':
case 'Flip horizontally':
// Orientation operations, like Flip or Rotate are grouped in a sub-panel
cInteractWithUi = cClickToolbarButton(label);
label = 'Orientation';
break;
case 'Brightness':
case 'Contrast':
case 'Color levels':
case 'Gamma':
cInteractWithUi = cDragDrop;
break;
default:
cInteractWithUi = Chain.wait(1);
}
return Chain.control(
Chain.fromChains([
cClickToolbarButton('Edit image'),
Chain.fromParent(ui.cWaitForPopup('wait for Edit Image dialog', '[role="dialog"]'), [
ui.cWaitForUi('wait for canvas', '.tox-image-tools__image > img'),
Chain.wait(200),
cClickToolbarButton(label),
cInteractWithUi,
Chain.wait(200),
cClickButton('Apply'),
cClickButton('Save'),
cWaitForDialogClose()
])
]),
Guard.addLogging(`Execute ${label} command from dialog`)
);
};
const cWaitForUi = function (label, selector) {
return Chain.control(
UiFinder.cWaitForState(label, selector, Fun.constant(true)),
Guard.addLogging('Wait for UI')
);
};
const cWaitForDialogClose = () => {
return Chain.control(
UiFinder.cNotExists('[role="dialog"]'),
Guard.tryUntil('Waiting for dialog to go away', 10, 3000)
);
};
const cClickButton = function (text) {
return Chain.control(
Chain.fromChains([
cWaitForUi('wait for ' + text + ' button', 'button:contains(' + text + ')'),
cWaitForState(function (el) {
return Attr.get(el, 'disabled') === undefined;
}),
Mouse.cClick
]),
Guard.addLogging('Wait for UI')
);
};
const cClickToolbarButton = function (label) {
return Chain.control(
//.........這裏部分代碼省略.........