本文整理匯總了TypeScript中vega.View類的典型用法代碼示例。如果您正苦於以下問題:TypeScript View類的具體用法?TypeScript View怎麽用?TypeScript View使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了View類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: clear
export function clear(id: string, parent: string, shiftKey: boolean) {
const bg = document.querySelector((parent ? `g.${parent} ` : '') + 'path.background');
const el = mark(id, parent);
let [clientX, clientY] = coords(el);
clientX += 10;
clientY -= 10;
click(bg, {clientX, clientY, shiftKey});
return view.data('sel_store');
}
示例2: brush
export function brush(id0: string, id1: string, parent: string, targetBrush: boolean) {
const el0 = mark(id0, parent);
const el1 = mark(id1, parent);
const [mdX, mdY] = coords(el0);
const [muX, muY] = coords(el1);
mouseEvt('mousedown', brushOrEl(el0, parent, targetBrush), {clientX: mdX, clientY: mdY});
mouseEvt('mouseup', window, {clientX: muX, clientY: muY});
return view.data('sel_store');
}
示例3: zoom
export function zoom(id: string, delta: number, parent: string, targetBrush: boolean) {
const el = mark(id, parent);
const [clientX, clientY] = coords(el);
mouseEvt('wheel', brushOrEl(el, parent, targetBrush), {
clientX,
clientY,
deltaX: delta,
deltaY: delta,
deltaZ: delta
});
mouseEvt('wheel', brushOrEl(el, parent, targetBrush), {
clientX,
clientY,
deltaX: Math.sign(delta),
deltaY: Math.sign(delta),
deltaZ: Math.sign(delta)
});
return view.data('sel_store');
}
示例4: pt
export function pt(id: string, parent: string, shiftKey: boolean) {
const el = mark(id, parent);
const [clientX, clientY] = coords(el);
click(el, {clientX, clientY, shiftKey});
return view.data('sel_store');
}