Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Bail if the mouse is not over the button.
if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {
return;
}
// Emit the step requested signal.
this._stepRequested.emit('decrement');
// Finished.
return;
}
// Handle an increment button repeat.
if (part === 'increment') {
// Bail if the mouse is not over the button.
if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {
return;
}
// Emit the step requested signal.
this._stepRequested.emit('increment');
// Finished.
return;
}
// Handle a track repeat.
if (part === 'track') {
// Bail if the mouse is not over the track.
if (!ElementExt.hitTest(this.trackNode, mouseX, mouseY)) {
return;
}
// Bail if the thumb was pressed.
if (part === 'thumb') {
return;
}
// Schedule the timer for another repeat.
this._repeatTimer = window.setTimeout(this._onRepeat, 20);
// Get the current mouse position.
let mouseX = this._pressData.mouseX;
let mouseY = this._pressData.mouseY;
// Handle a decrement button repeat.
if (part === 'decrement') {
// Bail if the mouse is not over the button.
if (!ElementExt.hitTest(this.decrementNode, mouseX, mouseY)) {
return;
}
// Emit the step requested signal.
this._stepRequested.emit('decrement');
// Finished.
return;
}
// Handle an increment button repeat.
if (part === 'increment') {
// Bail if the mouse is not over the button.
if (!ElementExt.hitTest(this.incrementNode, mouseX, mouseY)) {
return;
}
private _evtMouseLeave(event: MouseEvent): void {
// Cancel any pending submenu opening.
this._cancelOpenTimer();
// If there is no open child menu, just reset the active index.
if (!this._childMenu) {
this.activeIndex = -1;
return;
}
// If the mouse is over the child menu, cancel the close timer.
let { clientX, clientY } = event;
if (ElementExt.hitTest(this._childMenu.node, clientX, clientY)) {
this._cancelCloseTimer();
return;
}
// Otherwise, reset the active index and start the close timer.
this.activeIndex = -1;
this._startCloseTimer();
}
private _evtMouseDown(event: MouseEvent): void {
// Bail if the mouse press was not on the menu bar. This can occur
// when the document listener is installed for an active menu bar.
if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {
return;
}
// Stop the propagation of the event. Immediate propagation is
// also stopped so that an open menu does not handle the event.
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
// Check if the mouse is over one of the menu items.
let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {
return ElementExt.hitTest(node, event.clientX, event.clientY);
});
// If the press was not on an item, close the child menu.
if (index === -1) {
function findDropTarget(
panel: DockPanel,
clientX: number,
clientY: number,
edges: DockPanel.IEdges
): IDropTarget {
// Bail if the mouse is not over the dock panel.
if (!ElementExt.hitTest(panel.node, clientX, clientY)) {
return { zone: 'invalid', target: null };
}
// Look up the layout for the panel.
let layout = panel.layout as DockLayout;
// If the layout is empty, indicate the entire root drop zone.
if (layout.isEmpty) {
return { zone: 'root-all', target: null };
}
// Test the edge zones when in multiple document mode.
if (panel.mode === 'multiple-document') {
// Get the client rect for the dock panel.
let panelRect = panel.node.getBoundingClientRect();
let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {
return ElementExt.hitTest(node, event.clientX, event.clientY);
});
let index = ArrayExt.findFirstIndex(tabs, tab => {
return ElementExt.hitTest(tab, event.clientX, event.clientY);
});
let index = ArrayExt.findFirstIndex(this.contentNode.children, node => {
return ElementExt.hitTest(node, event.clientX, event.clientY);
});
function hitTestMenus(menu: Menu, x: number, y: number): boolean {
for (let temp: Menu | null = menu; temp; temp = temp.childMenu) {
if (ElementExt.hitTest(temp.node, x, y)) {
return true;
}
}
return false;
}
return ArrayExt.findFirstIndex(nodes, node => {
return ElementExt.hitTest(node, x, y);
});
}