Misleading documentation for drop zone events

未关闭
#7,146 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
停滞
技术栈
javascript
领域
documentation

调研方向

从链接的 Phaser 输入文档中的放置区域部分开始,检查使用 gameObject.setInteractive 和 drop event 的示例。重命名示例变量,或以其他方式区分放置区域和被拖动的对象,并说明哪个对象接收放置区域事件;文档应消除 issue 中所描述的歧义。

由索引模型根据 Issue 内容生成。

描述

Version

  • Phaser Version: 3.88.2

Description

The documentation explains drop zone concept and provides examples like so:

gameObject.setInteractive({ dropZone: true });

So we instinctively think that gameObject is a drop zone. In next paragraphs the following code can be found:

gameObject.on(
  "drop",
  function (pointer, target) {
    /* ... */
  },
  scope
);

Which suggests that drop event is triggered on the zone itself. However after 1hr of experimentation I found out that it is not exactly right. The drop event is not triggered on the zone, but rather on the object that is being dragged. It would be great to rename the gameObject to something more meaningful in the documentation and provide an explicit comment on which game object the drop and other dropZone events are triggered. That way some time on debugging and experimenting can be saved for the developers. I'd propose a change in documentation via a PR but could not find the repo containing the docs.

Link: https://docs.phaser.io/phaser/concepts/input#drop-zone:~:text=gameObject.on(%0A%20%20%22drop%22%2C%0A%20%20function%20(pointer%2C%20target)%20%7B%0A%20%20%20%20/*%20...%20*/%0A%20%20%7D%2C%0A%20%20scope%0A)%3B

主要语言
JavaScript
星标
40.7k
派生
7.2k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

phaserjs/phaser 的其他 Issue

查看 phaserjs/phaser 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。