me.afterFit();
//
me.afterUpdate();
-
- return me.minSize;
}
afterUpdate() {}
me.paddingBottom = 0;
// Reset minSize
- me.minSize = {
+ me._minSize = {
width: 0,
height: 0
};
// Reset hit boxes
var hitboxes = me.legendHitBoxes = [];
- var minSize = me.minSize;
+ var minSize = me._minSize;
var isHorizontal = me.isHorizontal();
if (isHorizontal) {
return;
}
- var rtlHelper = getRtlHelper(opts.rtl, me.left, me.minSize.width);
+ var rtlHelper = getRtlHelper(opts.rtl, me.left, me._minSize.width);
var ctx = me.ctx;
var fontColor = valueOrDefault(labelOpts.fontColor, defaults.fontColor);
var labelFont = helpers.options._parseFont(labelOpts);
var x = cursor.x;
var y = cursor.y;
- rtlHelper.setWidth(me.minSize.width);
+ rtlHelper.setWidth(me._minSize.width);
- // Use (me.left + me.minSize.width) and (me.top + me.minSize.height)
+ // Use (me.left + me._minSize.width) and (me.top + me._minSize.height)
// instead of me.right and me.bottom because me.width and me.height
- // may have been changed since me.minSize was calculated
+ // may have been changed since me._minSize was calculated
if (isHorizontal) {
- if (i > 0 && x + width + labelOpts.padding > me.left + me.minSize.width) {
+ if (i > 0 && x + width + labelOpts.padding > me.left + me._minSize.width) {
y = cursor.y += itemHeight;
cursor.line++;
x = cursor.x = me.left + alignmentOffset(legendWidth, lineWidths[cursor.line]);
}
- } else if (i > 0 && y + itemHeight > me.top + me.minSize.height) {
+ } else if (i > 0 && y + itemHeight > me.top + me._minSize.height) {
x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;
cursor.line++;
y = cursor.y = me.top + alignmentOffset(legendHeight, columnHeights[cursor.line]);
options: options
});
- var minSize = title.update(400, 200);
+ title.update(400, 200);
- expect(minSize).toEqual({
- width: 0,
- height: 0
- });
+ expect(title.width).toEqual(0);
+ expect(title.height).toEqual(0);
// Now we have a height since we display
title.options.display = true;
- minSize = title.update(400, 200);
+ title.update(400, 200);
- expect(minSize).toEqual({
- width: 400,
- height: 34.4
- });
+ expect(title.width).toEqual(400);
+ expect(title.height).toEqual(34.4);
});
it('should update correctly when vertical', function() {
options: options
});
- var minSize = title.update(200, 400);
+ title.update(200, 400);
- expect(minSize).toEqual({
- width: 0,
- height: 0
- });
+ expect(title.width).toEqual(0);
+ expect(title.height).toEqual(0);
// Now we have a height since we display
title.options.display = true;
- minSize = title.update(200, 400);
+ title.update(200, 400);
- expect(minSize).toEqual({
- width: 34.4,
- height: 400
- });
+ expect(title.width).toEqual(34.4);
+ expect(title.height).toEqual(400);
});
it('should have the correct size when there are multiple lines of text', function() {
options: options
});
- var minSize = title.update(200, 400);
+ title.update(200, 400);
- expect(minSize).toEqual({
- width: 56,
- height: 400
- });
+ expect(title.width).toEqual(56);
+ expect(title.height).toEqual(400);
});
it('should draw correctly horizontally', function() {
// Now we have a height since we display
title.options.display = true;
- var minSize = title.update(400, 200);
+ title.update(400, 200);
title.top = 50;
title.left = 100;
- title.bottom = title.top + minSize.height;
- title.right = title.left + minSize.width;
+ title.bottom = title.top + title.height;
+ title.right = title.left + title.width;
title.draw();
expect(context.getCalls()).toEqual([{
// Now we have a height since we display
title.options.display = true;
- var minSize = title.update(200, 400);
+ title.update(200, 400);
title.top = 50;
title.left = 100;
- title.bottom = title.top + minSize.height;
- title.right = title.left + minSize.width;
+ title.bottom = title.top + title.height;
+ title.right = title.left + title.width;
title.draw();
expect(context.getCalls()).toEqual([{
// Reset call tracker
context.resetCalls();
- minSize = title.update(200, 400);
+ title.update(200, 400);
title.top = 50;
title.left = 100;
- title.bottom = title.top + minSize.height;
- title.right = title.left + minSize.width;
+ title.bottom = title.top + title.height;
+ title.right = title.left + title.width;
title.draw();
expect(context.getCalls()).toEqual([{