App Lab 鼠标坐标 [英] App Lab Mouse Coordinates

查看:77
本文介绍了App Lab 鼠标坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在 Code.org 上使用 App Lab(在这里找到),它使用了一个奇怪的JS库.找到鼠标坐标的功能是什么?我都看了一遍,没人提过.

I recently started using App Lab on Code.org (found here), which uses a strange JS library. What is the function to find mouse coordinates? I've looked all over and no one has mentioned it.

(如果你不知道 app lab 是什么,它是一个 code.org 编译器,可以让你编写 JS 然后将它发送到你的手机,制作迷你应用程序)

(If you don't know what app lab is, it is a code.org compiler that lets you program JS and then send that to your phone, making mini apps)

推荐答案

以下信息来源

这是一个使用点击事件并将鼠标坐标记录到控制台的示例:

Here's an example that uses a click event and logs the mouse coordinates to the console:

// button1 is the id of a button I added in Design mode.
onEvent("button1", "click", function(event) {
  console.log(event.x + " " + event.y);
});

要查看 App Lab 的 onEvent 文档,请确保您处于代码模式(不是设计模式)并确保块显示(不是文本),然后将鼠标悬停在工具箱中的块上(不是工作区).

To see the onEvent documentation for App Lab, make sure you're in Code mode (not Design mode) and make sure to blocks showing (not text), then hover over the block in the toolbox (not the blocks in the workspace).

这篇关于App Lab 鼠标坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆