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


TypeScript UiContainer.getUiContainer函數代碼示例

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


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

示例1: function

  const bindScrollEvent = function (panel) {
    if (!scrollContainer) {
      const reposition = repositionHandler(true);
      const uiContainer = UiContainer.getUiContainer(panel);

      scrollContainer = editor.selection.getScrollContainer() || editor.getWin();
      DOM.bind(scrollContainer, 'scroll', reposition);
      DOM.bind(uiContainer, 'scroll', reposition);

      editor.on('remove', function () {
        DOM.unbind(scrollContainer, 'scroll', reposition);
        DOM.unbind(uiContainer, 'scroll', reposition);
      });
    }
  };
開發者ID:abstask,項目名稱:tinymce,代碼行數:15,代碼來源:ContextToolbars.ts

示例2: calculateRelativePosition

function calculateRelativePosition(ctrl, targetElm, rel) {
  let ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size;

  viewport = getWindowViewPort();

  // Get pos of target
  pos = DomUtils.getPos(targetElm, UiContainer.getUiContainer(ctrl));
  x = pos.x;
  y = pos.y;

  if (isFixed(ctrl) && isStatic(document.body)) {
    x -= viewport.x;
    y -= viewport.y;
  }

  // Get size of self
  ctrlElm = ctrl.getEl();
  size = DomUtils.getSize(ctrlElm);
  selfW = size.width;
  selfH = size.height;

  // Get size of target
  size = DomUtils.getSize(targetElm);
  targetW = size.width;
  targetH = size.height;

  // Parse align string
  rel = (rel || '').split('');

  // Target corners
  if (rel[0] === 'b') {
    y += targetH;
  }

  if (rel[1] === 'r') {
    x += targetW;
  }

  if (rel[0] === 'c') {
    y += Math.round(targetH / 2);
  }

  if (rel[1] === 'c') {
    x += Math.round(targetW / 2);
  }

  // Self corners
  if (rel[3] === 'b') {
    y -= selfH;
  }

  if (rel[4] === 'r') {
    x -= selfW;
  }

  if (rel[3] === 'c') {
    y -= Math.round(selfH / 2);
  }

  if (rel[4] === 'c') {
    x -= Math.round(selfW / 2);
  }

  return {
    x,
    y,
    w: selfW,
    h: selfH
  };
}
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:70,代碼來源:Movable.ts

示例3: getUiContainerViewPort

const getViewPortRect = (ctrl) => {
  const customUiContainer = UiContainer.getUiContainer(ctrl);
  return customUiContainer && !isFixed(ctrl) ? getUiContainerViewPort(customUiContainer) : getWindowViewPort();
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:4,代碼來源:Movable.ts

示例4: getViewPortRect

        value = max - size;
        return value < 0 ? 0 : value;
      }

      return value;
    }

    if (self.settings.constrainToViewport) {
      const viewPortRect = getViewPortRect(this);
      const layoutRect = self.layoutRect();

      x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
      y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
    }

    const uiContainer = UiContainer.getUiContainer(self);
    if (uiContainer && isStatic(uiContainer) && !isFixed(self)) {
      x -= uiContainer.scrollLeft;
      y -= uiContainer.scrollTop;
    }

    // We need to transpose by 1x1 on all browsers when using a ui container for some odd reason
    if (uiContainer) {
      x += 1;
      y += 1;
    }

    if (self.state.get('rendered')) {
      self.layoutRect({ x, y }).repaint();
    } else {
      self.settings.x = x;
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:31,代碼來源:Movable.ts

示例5: getContainerElm

    if (settings.hidden) {
      self.hide();
    }
  },

  // Will generate getter/setter methods for these properties
  Properties: 'parent,name',

  /**
   * Returns the root element to render controls into.
   *
   * @method getContainerElm
   * @return {Element} HTML DOM element to render into.
   */
  getContainerElm () {
    const uiContainer = UiContainer.getUiContainer(this);
    return uiContainer ? uiContainer : DomUtils.getContainer();
  },

  /**
   * Returns a control instance for the current DOM element.
   *
   * @method getParentCtrl
   * @param {Element} elm HTML dom element to get parent control from.
   * @return {tinymce.ui.Control} Control instance or undefined.
   */
  getParentCtrl (elm) {
    let ctrl;
    const lookup = this.getRoot().controlIdLookup;

    while (elm && lookup) {
開發者ID:abstask,項目名稱:tinymce,代碼行數:31,代碼來源:Control.ts


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