当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Mouse.cMouseMoveTo方法代码示例

本文整理汇总了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})`)
   );
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:25,代码来源:ResizeTest.ts

示例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)
   ]);
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:8,代码来源:DragResizeTest.ts

示例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)
   ]));
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:DragResizeTest.ts

示例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
   ]);
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:17,代码来源:ResizeTableTest.ts

示例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(
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:ImageOps.ts

示例6:

 Arr.range(numMoves, (count) => {
   const nx = sx + count * deltaX;
   const ny = sy + count * deltaY;
   return Mouse.cMouseMoveTo(nx, ny);
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:5,代码来源:ResizeTest.ts


注:本文中的@ephox/agar.Mouse.cMouseMoveTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。