當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript sugar.Height類代碼示例

本文整理匯總了TypeScript中@ephox/sugar.Height的典型用法代碼示例。如果您正苦於以下問題:TypeScript Height類的具體用法?TypeScript Height怎麽用?TypeScript Height使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Height類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

const getGreenzone = function (socket, dropup) {
  const outerWindow = Traverse.owner(socket).dom().defaultView;
  // Include the dropup for this calculation because it represents the total viewable height.
  const viewportHeight = Height.get(socket) + Height.get(dropup);
  const acc = accountableKeyboardHeight(outerWindow);
  return viewportHeight - acc;
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:7,代碼來源:DeviceZones.ts

示例2: function

const takeover = function (viewport, contentBody, toolbar, dropup) {
  const outerWindow = Traverse.owner(viewport).dom().defaultView;
  const toolbarSetup = takeoverToolbar(toolbar);
  const toolbarHeight = Height.get(toolbar);
  const dropupHeight = Height.get(dropup);
  const viewportHeight = deriveViewportHeight(viewport, toolbarHeight, dropupHeight);

  const viewportSetup = takeoverViewport(toolbarHeight, viewportHeight, viewport);

  const dropupSetup = takeoverDropup(dropup, toolbarHeight, viewportHeight);

  let isActive = true;

  const restore = function () {
    isActive = false;
    toolbarSetup.restore();
    viewportSetup.restore();
    dropupSetup.restore();
  };

  const isExpanding = function () {
    const currentWinHeight = outerWindow.innerHeight;
    const lastWinHeight = getLastWindowSize(viewport);
    return currentWinHeight > lastWinHeight;
  };

  const refresh = function () {
    if (isActive) {
      const newToolbarHeight = Height.get(toolbar);
      const dropupHeight = Height.get(dropup);
      const newHeight = deriveViewportHeight(viewport, newToolbarHeight, dropupHeight);
      Attr.set(viewport, yFixedData, newToolbarHeight + 'px');
      Css.set(viewport, 'height', newHeight + 'px');

      Css.set(dropup, 'bottom', -(newToolbarHeight + newHeight + dropupHeight) + 'px');
      DeviceZones.updatePadding(contentBody, viewport, dropup);
    }
  };

  const setViewportOffset = function (newYOffset) {
    const offsetPx = newYOffset + 'px';
    Attr.set(viewport, yFixedData, offsetPx);
    // The toolbar height has probably changed, so recalculate the viewport height.
    refresh();
  };

  DeviceZones.updatePadding(contentBody, viewport, dropup);

  return {
    setViewportOffset,
    isExpanding,
    isShrinking: Fun.not(isExpanding),
    refresh,
    restore
  };
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:56,代碼來源:IosViewport.ts

示例3: function

  const refresh = function () {
    if (isActive) {
      const newToolbarHeight = Height.get(toolbar);
      const dropupHeight = Height.get(dropup);
      const newHeight = deriveViewportHeight(viewport, newToolbarHeight, dropupHeight);
      Attr.set(viewport, yFixedData, newToolbarHeight + 'px');
      Css.set(viewport, 'height', newHeight + 'px');

      DeviceZones.updatePadding(contentBody, viewport, dropup);
    }
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:11,代碼來源:IosViewport.ts

示例4: 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);
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:Resize.ts

示例5:

 const calcPosition = (offset: number = 0) => {
   // Note: The float container/editor may not have been rendered yet, which will cause it to have a non integer based positions
   // so we need to round this to account for that.
   const location = Location.absolute(Element.fromDom(editor.getBody()));
   return {
     top: Math.round(location.top() - Height.get(floatContainer.element())) + offset + 'px',
     left: Math.round(location.left()) + 'px'
   };
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:Inline.ts

示例6: function

  const reposition = function () {
    const toolbarHeight = Height.get(toolstrip);
    iosApi.run(function (api) {
      api.setViewportOffset(toolbarHeight);
    });

    refreshIosSelection();
    refreshView();
  };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:9,代碼來源:IosEvents.ts

示例7:

    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
      });
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:10,代碼來源:DragResizeTest.ts

示例8:

    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
      });
    }));
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:DragResizeTest.ts

示例9: 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));
    });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:11,代碼來源:DragResizeTest.ts


注:本文中的@ephox/sugar.Height類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。