|
154 | 154 | { size } |
155 | 155 | ); |
156 | 156 |
|
157 | | - const cursors = [ |
| 157 | + const ALL_ALLOWED_CURSORS = [ |
| 158 | + // This list includes "none" while the dropdown's list does not |
| 159 | + "none", |
| 160 | + |
158 | 161 | "default", |
159 | 162 | "pointer", |
160 | 163 | "move", |
|
249 | 252 | menus: { |
250 | 253 | cursors: { |
251 | 254 | acceptReporters: true, |
252 | | - items: cursors, |
| 255 | + items: [ |
| 256 | + { |
| 257 | + text: Scratch.translate({ |
| 258 | + default: "default", |
| 259 | + description: |
| 260 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 261 | + }), |
| 262 | + value: "default", |
| 263 | + }, |
| 264 | + { |
| 265 | + text: Scratch.translate({ |
| 266 | + default: "pointer", |
| 267 | + description: |
| 268 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 269 | + }), |
| 270 | + value: "pointer", |
| 271 | + }, |
| 272 | + { |
| 273 | + text: Scratch.translate({ |
| 274 | + default: "move", |
| 275 | + description: |
| 276 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 277 | + }), |
| 278 | + value: "move", |
| 279 | + }, |
| 280 | + { |
| 281 | + text: Scratch.translate({ |
| 282 | + default: "grab", |
| 283 | + description: |
| 284 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 285 | + }), |
| 286 | + value: "grab", |
| 287 | + }, |
| 288 | + { |
| 289 | + text: Scratch.translate({ |
| 290 | + default: "grabbing", |
| 291 | + description: |
| 292 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 293 | + }), |
| 294 | + value: "grabbing", |
| 295 | + }, |
| 296 | + { |
| 297 | + text: Scratch.translate({ |
| 298 | + default: "text", |
| 299 | + description: |
| 300 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 301 | + }), |
| 302 | + value: "text", |
| 303 | + }, |
| 304 | + { |
| 305 | + text: Scratch.translate({ |
| 306 | + default: "vertical-text", |
| 307 | + description: |
| 308 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 309 | + }), |
| 310 | + value: "vertical-text", |
| 311 | + }, |
| 312 | + { |
| 313 | + text: Scratch.translate({ |
| 314 | + default: "wait", |
| 315 | + description: |
| 316 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 317 | + }), |
| 318 | + value: "wait", |
| 319 | + }, |
| 320 | + { |
| 321 | + text: Scratch.translate({ |
| 322 | + default: "progress", |
| 323 | + description: |
| 324 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 325 | + }), |
| 326 | + value: "progress", |
| 327 | + }, |
| 328 | + { |
| 329 | + text: Scratch.translate({ |
| 330 | + default: "help", |
| 331 | + description: |
| 332 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 333 | + }), |
| 334 | + value: "help", |
| 335 | + }, |
| 336 | + { |
| 337 | + text: Scratch.translate({ |
| 338 | + default: "context-menu", |
| 339 | + description: |
| 340 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 341 | + }), |
| 342 | + value: "context-menu", |
| 343 | + }, |
| 344 | + { |
| 345 | + text: Scratch.translate({ |
| 346 | + default: "zoom-in", |
| 347 | + description: |
| 348 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 349 | + }), |
| 350 | + value: "zoom-in", |
| 351 | + }, |
| 352 | + { |
| 353 | + text: Scratch.translate({ |
| 354 | + default: "zoom-out", |
| 355 | + description: |
| 356 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 357 | + }), |
| 358 | + value: "zoom-out", |
| 359 | + }, |
| 360 | + { |
| 361 | + text: Scratch.translate({ |
| 362 | + default: "crosshair", |
| 363 | + description: |
| 364 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 365 | + }), |
| 366 | + value: "crosshair", |
| 367 | + }, |
| 368 | + { |
| 369 | + text: Scratch.translate({ |
| 370 | + default: "cell", |
| 371 | + description: |
| 372 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 373 | + }), |
| 374 | + value: "cell", |
| 375 | + }, |
| 376 | + { |
| 377 | + text: Scratch.translate({ |
| 378 | + default: "not allowed", |
| 379 | + description: |
| 380 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 381 | + }), |
| 382 | + value: "not-allowed", |
| 383 | + }, |
| 384 | + { |
| 385 | + text: Scratch.translate({ |
| 386 | + default: "copy", |
| 387 | + description: |
| 388 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 389 | + }), |
| 390 | + value: "copy", |
| 391 | + }, |
| 392 | + { |
| 393 | + text: Scratch.translate({ |
| 394 | + default: "alias", |
| 395 | + description: |
| 396 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 397 | + }), |
| 398 | + value: "alias", |
| 399 | + }, |
| 400 | + { |
| 401 | + text: Scratch.translate({ |
| 402 | + default: "no drop", |
| 403 | + description: |
| 404 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 405 | + }), |
| 406 | + value: "no-drop", |
| 407 | + }, |
| 408 | + { |
| 409 | + text: Scratch.translate({ |
| 410 | + default: "all-scroll", |
| 411 | + description: |
| 412 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 413 | + }), |
| 414 | + value: "all-scroll", |
| 415 | + }, |
| 416 | + { |
| 417 | + text: Scratch.translate({ |
| 418 | + default: "col-resize", |
| 419 | + description: |
| 420 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 421 | + }), |
| 422 | + value: "col-resize", |
| 423 | + }, |
| 424 | + { |
| 425 | + text: Scratch.translate({ |
| 426 | + default: "row-resize", |
| 427 | + description: |
| 428 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 429 | + }), |
| 430 | + value: "row-resize", |
| 431 | + }, |
| 432 | + { |
| 433 | + text: Scratch.translate({ |
| 434 | + default: "n-resize", |
| 435 | + description: |
| 436 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 437 | + }), |
| 438 | + value: "n-resize", |
| 439 | + }, |
| 440 | + { |
| 441 | + text: Scratch.translate({ |
| 442 | + default: "e-resize", |
| 443 | + description: |
| 444 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 445 | + }), |
| 446 | + value: "e-resize", |
| 447 | + }, |
| 448 | + { |
| 449 | + text: Scratch.translate({ |
| 450 | + default: "s-resize", |
| 451 | + description: |
| 452 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 453 | + }), |
| 454 | + value: "s-resize", |
| 455 | + }, |
| 456 | + { |
| 457 | + text: Scratch.translate({ |
| 458 | + default: "w-resize", |
| 459 | + description: |
| 460 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 461 | + }), |
| 462 | + value: "w-resize", |
| 463 | + }, |
| 464 | + { |
| 465 | + text: Scratch.translate({ |
| 466 | + default: "ne-resize", |
| 467 | + description: |
| 468 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 469 | + }), |
| 470 | + value: "ne-resize", |
| 471 | + }, |
| 472 | + { |
| 473 | + text: Scratch.translate({ |
| 474 | + default: "nw-resize", |
| 475 | + description: |
| 476 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 477 | + }), |
| 478 | + value: "nw-resize", |
| 479 | + }, |
| 480 | + { |
| 481 | + text: Scratch.translate({ |
| 482 | + default: "se-resize", |
| 483 | + description: |
| 484 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 485 | + }), |
| 486 | + value: "se-resize", |
| 487 | + }, |
| 488 | + { |
| 489 | + text: Scratch.translate({ |
| 490 | + default: "sw-resize", |
| 491 | + description: |
| 492 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 493 | + }), |
| 494 | + value: "sw-resize", |
| 495 | + }, |
| 496 | + { |
| 497 | + text: Scratch.translate({ |
| 498 | + default: "ew-resize", |
| 499 | + description: |
| 500 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 501 | + }), |
| 502 | + value: "ew-resize", |
| 503 | + }, |
| 504 | + { |
| 505 | + text: Scratch.translate({ |
| 506 | + default: "ns-resize", |
| 507 | + description: |
| 508 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 509 | + }), |
| 510 | + value: "ns-resize", |
| 511 | + }, |
| 512 | + { |
| 513 | + text: Scratch.translate({ |
| 514 | + default: "nesw-resize", |
| 515 | + description: |
| 516 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 517 | + }), |
| 518 | + value: "nesw-resize", |
| 519 | + }, |
| 520 | + { |
| 521 | + text: Scratch.translate({ |
| 522 | + default: "nwse-resize", |
| 523 | + description: |
| 524 | + "Part of cursor dropdown. See https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/cursor#keyword", |
| 525 | + }), |
| 526 | + value: "nwse-resize", |
| 527 | + }, |
| 528 | + ], |
253 | 529 | }, |
254 | 530 | imagePositions: { |
255 | 531 | acceptReporters: true, |
|
285 | 561 | setCur(args) { |
286 | 562 | const newCursor = Scratch.Cast.toString(args.cur); |
287 | 563 | // Prevent setting cursor to "url(...), default" from causing fetch. |
288 | | - if (cursors.includes(newCursor) || newCursor === "none") { |
| 564 | + if (ALL_ALLOWED_CURSORS.includes(newCursor)) { |
289 | 565 | nativeCursor = newCursor; |
290 | 566 | customCursorImageName = null; |
291 | 567 | currentCanvasCursor = newCursor; |
|
0 commit comments