1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import BoundingRect from 'zrender/lib/core/BoundingRect.js';
- import { onIrrelevantElement } from './cursorHelper.js';
- import * as graphicUtil from '../../util/graphic.js';
- export function makeRectPanelClipPath(rect) {
- rect = normalizeRect(rect);
- return function (localPoints) {
- return graphicUtil.clipPointsByRect(localPoints, rect);
- };
- }
- export function makeLinearBrushOtherExtent(rect, specifiedXYIndex) {
- rect = normalizeRect(rect);
- return function (xyIndex) {
- var idx = specifiedXYIndex != null ? specifiedXYIndex : xyIndex;
- var brushWidth = idx ? rect.width : rect.height;
- var base = idx ? rect.x : rect.y;
- return [base, base + (brushWidth || 0)];
- };
- }
- export function makeRectIsTargetByCursor(rect, api, targetModel) {
- var boundingRect = normalizeRect(rect);
- return function (e, localCursorPoint) {
- return boundingRect.contain(localCursorPoint[0], localCursorPoint[1]) && !onIrrelevantElement(e, api, targetModel);
- };
- }
- function normalizeRect(rect) {
- return BoundingRect.create(rect);
- }
|