• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ekkiog-editing.getTileAt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ekkiog-editing.getTileAt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getTileAt函数的具体用法?TypeScript getTileAt怎么用?TypeScript getTileAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getTileAt函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: insertMovableItem

function* insertMovableItem(initialForest : Forest, tool : Tool, direction : Direction, x : number, y : number){
  const forest = tap(createForest(initialForest.buddyTree), tool, direction, x, y);
  const item = getTileAt(forest, x, y);

  const ok = yield* selection(item);
  if(ok){
    yield put(saveForest(`Inserted ${tool}`));
  }
};
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:9,代码来源:tapTile.ts


示例2: moveItemAt

export default function* moveItemAt({tx, ty} : MoveItemAtAction){
  const {context: {forest: initialForest}} : State = yield select();

  const item = getTileAt(initialForest, tx, ty);
  yield put(removeTileAt(tx, ty));

  const ok = yield* selection(item);
  if(ok) {
    yield put(saveForest(`Moved ${item.data.type}`));
  } else {
    yield put(setForest(initialForest));
  }
};
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:13,代码来源:moveItemAt.ts


示例3: zomOutOf

export default function* zomOutOf({} : ZoomOutOfAction){
  const { context: currentContext, selection: {selection: isSelection}} : State = yield select();

  if(isSelection){
    yield put(stopSelection());
    yield put(resetEditorMenu());
  }

  const outerContext = currentContext.previous;
  if(!outerContext) return;

  const innerContext : ContextState = yield* waitUntilSaved(currentContext);

  yield put(popContext());
  yield put(setUrl(outerContext.repo, outerContext.name));
  if(innerContext.isReadOnly || outerContext.isReadOnly) return;

  const pkg = packageComponent(innerContext.forest, innerContext.repo, innerContext.name, innerContext.hash, innerContext.hash);
  const {forest, didntFit} = replaceComponents(outerContext.forest, pkg);
  if(outerContext.forest !== forest){
    yield put(setForest(forest));
  }

  for(const position of didntFit) {
    yield put(removeTileAt(position.x, position.y));
    const {context: {forest: newForest}} : State = yield select();

    const forest = drawComponent(createForest(newForest.buddyTree), position.x, position.y, pkg);

    const item = getTileAt(forest, position.x, position.y);
    yield* selection(item);
  };

  const { context: newContext } : State = yield select();
  if(outerContext.forest !== newContext.forest){
    yield put(saveForest(`Updated ${pkg.name}`));
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:38,代码来源:zoomOutOf.ts


示例4: insertComponentPackage

export default function* insertComponentPackage({componentPackage} : InsertComponentPackageAction){
  const state : State = yield select();

  if(state.selection.selection){
    yield put(stopSelection());
    yield put(resetEditorMenu());
  }

  const tile = state.view.viewportToTile(state.view.pixelWidth/2, state.view.pixelHeight/2);
  const centerTile = {
    x: tile[0]|0,
    y: tile[1]|0
  };

  const forest = drawComponent(createForest(state.context.forest.buddyTree), centerTile.x, centerTile.y, componentPackage);

  const item = getTileAt(forest, centerTile.x, centerTile.y);

  const ok = yield* selection(item);
  if(ok){
    yield put(saveForest(`Inserted ${componentPackage.name}`));
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:23,代码来源:insertComponentPackage.ts


示例5: tapTile

export default function* tapTile({x, y, tool, direction} : TapTileAction) {
  const {context: {forest, isReadOnly}} : State = yield select();

  yield nextFrame();
  const area = getTileAt(forest, x, y);
  if(area && area.data && area.data.type === BUTTON){
    const net = area.data.net;
    yield put(toggleButton(net));
  }else{
    if(isReadOnly) return;
    yield put(draw(x, y, tool, direction));

    const {context: {forest: mutatedForest}} : State = yield select();
    if(forest === mutatedForest){
      if(tool == BUTTON
      || tool == GATE
      || tool == LIGHT){
        yield* insertMovableItem(mutatedForest, tool, direction, x, y);
      }
    }else{
      yield put(saveForest(`Inserted ${tool}`));
    }
  }
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:24,代码来源:tapTile.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript elasticsearch.Client类代码示例发布时间:2022-05-25
下一篇:
TypeScript ekkiog-editing.drawWire函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap