in web/frontend/libs/@deltix/hd.components-order-grid/index.umd.js [729:908]
constructor() {
super(...arguments);
this.state = {
hovered: false,
grow: false,
id: undefined,
price: undefined,
cumulativeQuantity: undefined,
quantity: undefined,
next: undefined,
worstPrice: undefined
};
this.orderLineHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.marketQuantityHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.cumulativeQuantityHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.priceHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.orderCountHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.worstPriceHitArea = new PIXI__namespace.Rectangle(0, 0, 0, 0);
this.hideTween = this.props.createTween().duration(400).setEasing(hd_componentsMultiApp.Ease.inOutCubic).reverse().onUpdate(v => {
this.rootRef.current.alpha = v;
}).onComplete(() => {
this.rootRef.current.alpha = 1;
this.setState(Object.assign(Object.assign({}, this.state.next), {
next: undefined
}));
});
this.growTween = this.props.createTween().duration(400).onUpdate(v => {
const {
height,
width,
showCumulativeQuantity,
showUserQuantity
} = this.props;
this.growRef.current.visible = true;
const blockWidth = width * getQuantityWidth(showCumulativeQuantity, showUserQuantity);
this.growRef.current.clear().beginFill(this.props.color, v / 3).drawRect(0, 0, blockWidth, height);
}).onComplete(() => {
this.growRef.current.clear().visible = false;
this.setState({
grow: false
});
});
this.growRef = /*#__PURE__*/React__namespace.createRef();
this.rootRef = /*#__PURE__*/React__namespace.createRef();
this.renderNumberOfOrders = (xOffset, width, height, priceStyle) => {
return jsxRuntime.jsx(Container, Object.assign({
x: xOffset,
interactive: true,
hitArea: this.orderCountHitArea,
buttonMode: true,
pointertap: this.onSelectedQuantity
}, {
children: jsxRuntime.jsx(hd_componentsMultiApp.AlignText, {
width: width,
height: height,
horizontal: 'center',
vertical: 'middle',
text: this.props.orderCount == null ? '' : this.props.orderCount + '',
style: priceStyle
}, void 0)
}), void 0);
};
this.renderPrice = (xOffset, width, height, priceStyle, align) => {
return jsxRuntime.jsx(Container, Object.assign({
x: xOffset,
interactive: true,
buttonMode: true,
hitArea: this.priceHitArea,
pointertap: this.onSelectedPrice
}, {
children: jsxRuntime.jsx(hd_componentsMultiApp.Price, {
formatPrice: this.props.formatPrice,
price: this.props.price,
height: height,
align: align,
width: width,
style: priceStyle,
decimalPart: this.props.pricePrecision
}, void 0)
}), void 0);
};
this.renderCumulativeQty = (xOffset, width, height, ceilPartStyle, zeroPartStyle, decimalPartStyle, align) => {
return jsxRuntime.jsx(Container, Object.assign({
x: xOffset,
interactive: true,
hitArea: this.cumulativeQuantityHitArea,
buttonMode: true,
pointertap: this.onSelectedQuantity,
pointerover: this.showHint,
pointerout: this.hideHint
}, {
children: jsxRuntime.jsx(hd_componentsMultiApp.MarketQuantity, {
formatQuantity: this.props.formatQuantity,
quantity: this.props.cumulativeQuantity,
height: height,
width: width,
precision: this.props.quantityPrecision,
ceilPartStyle: ceilPartStyle,
zeroPartStyle: zeroPartStyle,
decimalPartStyle: decimalPartStyle,
align: align,
abbreviations: this.props.abbreviations
}, void 0)
}), void 0);
};
this.renderWorstPrice = (xOffset, width, height, priceStyle, align) => {
return jsxRuntime.jsx(Container, Object.assign({
x: xOffset,
interactive: true,
buttonMode: true,
hitArea: this.worstPriceHitArea,
pointertap: this.onSelectedWorstPrice
}, {
children: jsxRuntime.jsx(hd_componentsMultiApp.Price, {
formatPrice: this.props.formatPrice,
price: this.props.worstPrice,
height: height,
align: align,
width: width,
style: priceStyle,
decimalPart: this.props.pricePrecision
}, void 0)
}), void 0);
};
this.onSelectedPrice = () => this.props.onSelect(this.props.price, this.props.quantity, this.props.exchange, hd_componentsOrderBook.ELineType.price);
this.onSelectedQuantity = () => this.props.onSelect(this.props.price, this.props.quantity, this.props.exchange, hd_componentsOrderBook.ELineType.quantity);
this.onSelectedWorstPrice = () => this.props.onSelect(this.props.worstPrice, this.props.quantity, this.props.exchange, hd_componentsOrderBook.ELineType.worst_price);
this.toggleHover = () => {
const next = !this.state.hovered;
this.setState({
hovered: next
});
if (next && !this.props.aggregatingQuantity) {
this.props.onHover(this.props.price);
}
};
this.showHint = event => {
const container = event.target;
const qty = this.props.showCumulativeQuantity ? this.props.cumulativeQuantity : this.props.quantity;
const hintText = qty.toString();
const hintWidth = hintText.length * 9.8;
const hintHeight = this.props.height;
const hintY = (this.props.side === hd_componentsOrderBook.L2MessageSide.sell ? this.props.index : this.props.index + 1) * this.props.height;
this.setState(state => Object.assign(Object.assign({}, state), {
hintText,
hintHeight,
hintWidth,
hintContainerX: container.x,
hintY
}), () => {
this.props.showHint(hintText, container.x + this.qtyContainerWidth() - hintWidth, hintY, hintWidth, hintHeight);
});
};
this.qtyContainerWidth = () => (this.props.showCumulativeQuantity ? this.cumulativeQuantityHitArea : this.marketQuantityHitArea).width;
this.hideHint = () => {
this.setState(state => Object.assign(Object.assign({}, state), {
hintText: void 0
}));
this.props.hideHint();
};
this.containsPoint = ({
x,
y
}) => {
return this.orderLineHitArea.contains(x, y);
};
}