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


TypeScript sugar.Width類代碼示例

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


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

示例1:

    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

示例2:

    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

示例3: 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

示例4: looseEqual

    return Logger.t('Asset change in 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);

      const changedHeight = state.get().h + change.dh;
      const changedWidth = state.get().w + change.dw;

      Assertions.assertEq('height is ' + height + ' but expected ' + changedHeight, true, looseEqual(changedHeight, height, 4));
      Assertions.assertEq('width is ' + width + ' but expected ' + changedWidth, true, looseEqual(changedWidth, width, 4));
    }));
開發者ID:tinymce,項目名稱:tinymce,代碼行數:11,代碼來源:DragResizeTest.ts

示例5:

        AlloyEvents.run<ChangeSlideEvent>(changeSlideEvent, (comp, se) => {
          // If it was partially through a slide, clear that and measure afresh
          Css.remove(comp.element(), 'width');
          const currentWidth = Width.get(comp.element());

          InlineView.setContent(comp, se.event().contents());
          Class.add(comp.element(), resizingClass);
          const newWidth = Width.get(comp.element());
          Css.set(comp.element(), 'width', currentWidth + 'px');
          InlineView.getContent(comp).each((newContents) => {
            se.event().focus().bind((f) => {
              Focus.focus(f);
              return Focus.search(comp.element());
            }).orThunk(() => {
              Keying.focusIn(newContents);
              return Focus.active();
            });
          });
          Delay.setTimeout(() => {
            Css.set(comp.element(), 'width', newWidth + 'px');
          }, 0);
        }),
開發者ID:tinymce,項目名稱:tinymce,代碼行數:22,代碼來源:ContextUi.ts

示例6:

    memContainer.getOpt(anyInSystem).each((panel) => {
      const panelW = Width.get(panel.element());
      const panelH = Height.get(panel.element());
      const width = img.dom().naturalWidth;
      const height = img.dom().naturalHeight;
      const zoom = Math.min((panelW) / width, (panelH) / height);

      if (zoom >= 1) {
        zoomState.set(1);
      } else {
        zoomState.set(zoom);
      }
    });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:ImagePanel.ts

示例7: parseInt

 Css.getRaw(parent, 'left').each(function (left) {
   const currentLeft = parseInt(left, 10);
   const w = Width.get(screens[0]);
   Css.set(parent, 'left', (currentLeft - (direction * w)) + 'px');
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:5,代碼來源:SerialisedDialog.ts

示例8:

 onStartShrink: (slider: AlloyComponent) => {
   AlloyTriggers.emitWith(slider, fixSize, { width: Width.get(slider.element()) + 'px' });
 }
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:Sidebar.ts

示例9: function

const sketch = function (settings) {
  const dataset = convert(settings.formats, function () {
    return memMenu;
  });
  // Turn settings into a tiered menu data.

  const memMenu = Memento.record(TieredMenu.sketch({
    dom: {
      tag: 'div',
      classes: [ Styles.resolve('styles-menu') ]
    },
    components: [ ],

    // Focus causes issues when the things being focused are offscreen.
    fakeFocus: true,
    // For animations, need things to stay around in the DOM (at least until animation is done)
    stayInDom: true,

    onExecute (tmenu, item) {
      const v = Representing.getValue(item);
      settings.handle(item, v.value);
    },
    onEscape () {
    },
    onOpenMenu (container, menu) {
      const w = Width.get(container.element());
      Width.set(menu.element(), w);
      Transitioning.jumpTo(menu, 'current');
    },
    onOpenSubmenu (container, item, submenu) {
      const w = Width.get(container.element());
      const menu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const menuComp = container.getSystem().getByDom(menu).getOrDie();

      Width.set(submenu.element(), w);

      Transitioning.progressTo(menuComp, 'before');
      Transitioning.jumpTo(submenu, 'after');
      Transitioning.progressTo(submenu, 'current');
    },

    onCollapseMenu (container, item, menu) {
      const submenu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const submenuComp = container.getSystem().getByDom(submenu).getOrDie();
      Transitioning.progressTo(submenuComp, 'after');
      Transitioning.progressTo(menu, 'current');
    },

    navigateOnHover: false,

    openImmediately: true,
    data: dataset.tmenu,

    markers: {
      backgroundMenu: Styles.resolve('styles-background-menu'),
      menu: Styles.resolve('styles-menu'),
      selectedMenu: Styles.resolve('styles-selected-menu'),
      item: Styles.resolve('styles-item'),
      selectedItem: Styles.resolve('styles-selected-item')
    }
  }));

  return memMenu.asSpec();
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:64,代碼來源:StylesMenu.ts


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