本文整理匯總了TypeScript中@ephox/agar.Mouse.cMouseMoveTo方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mouse.cMouseMoveTo方法的具體用法?TypeScript Mouse.cMouseMoveTo怎麽用?TypeScript Mouse.cMouseMoveTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Mouse
的用法示例。
在下文中一共展示了Mouse.cMouseMoveTo方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: from
const cResizeToPos = (sx: number, sy: number, dx: number, dy: number, delta: number = 10) => {
// Simulate moving the mouse, by making a number of movements
const numMoves = sy === dy ? Math.abs(dx - sx) / delta : Math.abs(dy - sy) / delta;
// Determine the deltas based on the number of moves to make
const deltaX = (dx - sx) / numMoves;
const deltaY = (dy - sy) / numMoves;
// Move and release the mouse
return Chain.control(
Chain.fromChains([
UiFinder.cFindIn('.tox-blocker'),
Mouse.cMouseMoveTo(sx, sy)
].concat(
Arr.range(numMoves, (count) => {
const nx = sx + count * deltaX;
const ny = sy + count * deltaY;
return Mouse.cMouseMoveTo(nx, ny);
})
).concat([
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUp
])
),
Guard.addLogging(`Resizing from (${sx}, ${sy}) to (${dx}, ${dy})`)
);
};
示例2: 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)
]);
};
示例3:
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)
]));
};
示例4: function
const cDragHandle = function (id, deltaH, deltaV) {
return NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cGetBody, 'editorBody'),
NamedChain.read('editorBody', Chain.control(
UiFinder.cFindIn('#mceResizeHandle' + id),
Guard.tryUntil('wait for resize handlers', 100, 40000)
)),
NamedChain.read('editorBody', Chain.fromChains([
UiFinder.cFindIn('#mceResizeHandle' + id),
Mouse.cMouseDown,
Mouse.cMouseMoveTo(deltaH, deltaV),
Mouse.cMouseUp
])),
NamedChain.outputInput
]);
};
示例5: 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(
//.........這裏部分代碼省略.........
示例6:
Arr.range(numMoves, (count) => {
const nx = sx + count * deltaX;
const ny = sy + count * deltaY;
return Mouse.cMouseMoveTo(nx, ny);
})