Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[p5.js 2.0+ Bug Report]: Mismatched map() Reference Example

Đang mở Phù hợp với người mới
#9,329 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@j-xsen đang làm issue này rồi.

Từ ngày 26/10/2026.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
87/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
documentation

Hướng nghiên cứu

Ví dụ nằm trong src/math/calculation.js, khoảng dòng 772–789. Đọc ví dụ tham khảo về map() và so sánh lời gọi line() cuối cùng với hành vi được mô tả. Thay đổi lời gọi để đường thẳng phía dưới kéo dài theo chiều ngang, rồi xác minh trang tham khảo hiển thị hai đường thẳng nằm ngang khi chuột di chuyển.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Area:Math Documentation p5.js 2.0+
Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

2.3.4

Web browser and version

1.97.57 Chromium: 155.0.8059.80 (Official Build) (64-bit)

Operating system

Windows

Steps to reproduce this
Problem

There is an issue with the documentation for the map function.

Steps:
  1. Visit the map documentation (https://p5js.org/reference/p5/map/)
  2. Place mouse over the first canvas
  3. There is one vertical line and one horizontal line, rather than two horizontal lines.
Snippet:

src/math/calculation.js lines 772-789:

   * function setup() {
   *   createCanvas(100, 100);
   *
   *   describe('Two horizontal lines. The top line grows horizontally as the mouse moves to the right. The bottom line also grows horizontally but is scaled to stay on the left half of the canvas.');
   * }
   *
   * function draw() {
   *   background(200);
   *
   *   // Draw the top line.
   *   line(0, 25, mouseX, 25);
   *
   *   // Remap mouseX from [0, 100] to [0, 50].
   *   let x = map(mouseX, 0, 100, 0, 50);
   *
   *   // Draw the bottom line.
   *   line(0, 75, 0, x);
   * }

line(0, 75, 0, x); should be changed to line(0, 75, x, 75); to properly match the described behavior.

Ngôn ngữ chính
JavaScript
Star
24.3k
Fork
3.9k
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của processing/p5.js

Tất cả issue của processing/p5.js

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.