Skip to content

cursor.js -- translate cursor menu #2076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions extensions/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,40 +155,40 @@
);

const cursors = [
"default",
"pointer",
"move",
"grab",
"grabbing",
"text",
"vertical-text",
"wait",
"progress",
"help",
"context-menu",
"zoom-in",
"zoom-out",
"crosshair",
"cell",
"not-allowed",
"copy",
"alias",
"no-drop",
"all-scroll",
"col-resize",
"row-resize",
"n-resize",
"e-resize",
"s-resize",
"w-resize",
"ne-resize",
"nw-resize",
"se-resize",
"sw-resize",
"ew-resize",
"ns-resize",
"nesw-resize",
"nwse-resize",
{ text: Scratch.translate("(1) default"), value: "default" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think numbers will work here so we shouldn't suggest people to put numbers in

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so just revert to the last commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preferably find a way to make the numbers work, as the issue stated in #2076 (review) still applies. probably would need to create a new block and hide the old version, since swapping from string values to indexes would change the extension's core functionality

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preferably find a way to make the numbers work, as the issue stated in #2076 (review) still applies. probably would need to create a new block and hide the old version, since swapping from string values to indexes would change the extension's core functionality

talk to garbo about it. Im not going back and forth with this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preferably find a way to make the numbers work, as the issue stated in #2076 (review) still applies. probably would need to create a new block and hide the old version, since swapping from string values to indexes would change the extension's core functionality

or just support both

{ text: Scratch.translate("(2) pointer"), value: "pointer" },
{ text: Scratch.translate("(3) move"), value: "move" },
{ text: Scratch.translate("(4) grab"), value: "grab" },
{ text: Scratch.translate("(5) grabbing"), value: "grabbing" },
{ text: Scratch.translate("(6) text"), value: "text" },
{ text: Scratch.translate("(7) vertical-text"), value: "vertical-text" },
{ text: Scratch.translate("(8) wait"), value: "wait" },
{ text: Scratch.translate("(9) progress"), value: "progress" },
{ text: Scratch.translate("(10) help"), value: "help" },
{ text: Scratch.translate("(11) context-menu"), value: "context-menu" },
{ text: Scratch.translate("(12) zoom-in"), value: "zoom-in" },
{ text: Scratch.translate("(13) zoom-out"), value: "zoom-ou" },
{ text: Scratch.translate("(14) crosshair"), value: "crosshair" },
{ text: Scratch.translate("(15) cell"), value: "cell" },
{ text: Scratch.translate("(16) not-allowed"), value: "not-allowed" },
{ text: Scratch.translate("(17) copy"), value: "copy" },
{ text: Scratch.translate("(18) alias"), value: "alias" },
{ text: Scratch.translate("(19) no-drop"), value: "no-drop" },
{ text: Scratch.translate("(20) all-scroll"), value: "all-scroll" },
{ text: Scratch.translate("(21) column-resize"), value: "col-resize" },
{ text: Scratch.translate("(22) row-resize"), value: "row-resize" },
{ text: Scratch.translate("(23) n-resize"), value: "n-resize" },
{ text: Scratch.translate("(24) e-resize"), value: "e-resize" },
{ text: Scratch.translate("(25) s-resize"), value: "s-resize" },
{ text: Scratch.translate("(26) w-resize"), value: "w-resize" },
{ text: Scratch.translate("(27) ne-resize"), value: "ne-resize" },
{ text: Scratch.translate("(28) nw-resize"), value: "nw-resize" },
{ text: Scratch.translate("(29) se-resize"), value: "se-resize" },
{ text: Scratch.translate("(30) sw-resize"), value: "sw-resize" },
{ text: Scratch.translate("(31) ew-resize"), value: "ew-resize" },
{ text: Scratch.translate("(32) ns-resize"), value: "ns-resize" },
{ text: Scratch.translate("(33) nesw-resize"), value: "nesw-resize" },
{ text: Scratch.translate("(34) nwse-resize"), value: "nwse-resize" },
];

class MouseCursor {
Expand Down Expand Up @@ -285,7 +285,7 @@
setCur(args) {
const newCursor = Scratch.Cast.toString(args.cur);
// Prevent setting cursor to "url(...), default" from causing fetch.
if (cursors.includes(newCursor) || newCursor === "none") {
if (cursors.some((e) => e.value === newCursor) || newCursor === "none") {
nativeCursor = newCursor;
customCursorImageName = null;
currentCanvasCursor = newCursor;
Expand Down