Bản khảo sát nghiên cứu: Cho chúng tôi biết trải nghiệm của bạn khi sử dụng Blockly
Bắt đầu khảo sát
chặn > Thanh cuộn > setOrigin
Ghi lại điểm gốc của không gian làm việc chứa thanh cuộn, tính bằng pixel so với gốc div chèn. Mã này dành cho những trường hợp thanh cuộn được dùng trong một đối tượng có nguồn gốc không giống với không gian làm việc chính (ví dụ: trong một mục bay).
Chữ ký:
setOrigin(x: number, y: number): void;
Thông số
Thông số |
Loại |
Mô tả |
x |
số |
Toạ độ x của điểm gốc của thanh cuộn, tính bằng pixel CSS. |
y |
số |
Toạ độ y của điểm gốc thanh cuộn, tính bằng pixel CSS. |
Trả về:
void
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-09-11 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-09-11 UTC."],[[["The `Scrollbar.setOrigin()` method is used to set the origin of a scrollbar relative to its containing workspace, particularly useful when the scrollbar is within elements like flyouts that have different origins."],["It takes two parameters, `x` and `y`, representing the horizontal and vertical coordinates of the scrollbar's origin in CSS pixels, respectively."],["This method records the workspace origin for the scrollbar, ensuring proper positioning and functionality even when used in elements outside the main workspace area."]]],["The `setOrigin` method of the `Scrollbar` class records the workspace's origin relative to the injection div. It's used when the scrollbar is within an object whose origin differs from the main workspace. This method takes two parameters: `x` and `y`, representing the x and y coordinates of the scrollbar's origin in CSS pixels. It does not return any value. The purpose is to allow a scrollbar to work properly, even if the origin of the workspace differs.\n"]]