Skip to content

Commit ad84d28

Browse files
authored
Rename LayoutItem.fullWidth to fullSize (#8358)
1 parent b50fba3 commit ad84d28

File tree

12 files changed

+37
-35
lines changed

12 files changed

+37
-35
lines changed

docs/docs/configuration/legend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The legend configuration is passed into the `options.plugins.legend` namespace.
1515
| `align` | `string` | `'center'` | Alignment of the legend. [more...](#align)
1616
| `maxHeight` | `number` | | Maximum height of the legend, in pixels
1717
| `maxWidth` | `number` | | Maximum width of the legend, in pixels
18-
| `fullWidth` | `boolean` | `true` | Marks that this box should take the full width of the canvas (pushing down other boxes). This is unlikely to need to be changed in day-to-day use.
18+
| `fullSize` | `boolean` | `true` | Marks that this box should take the full width/height of the canvas (moving other boxes). This is unlikely to need to be changed in day-to-day use.
1919
| `onClick` | `function` | | A callback that is called when a click event is registered on a label item. Arguments: `[event, legendItem, legend]`.
2020
| `onHover` | `function` | | A callback that is called when a 'mousemove' event is registered on top of a label item. Arguments: `[event, legendItem, legend]`.
2121
| `onLeave` | `function` | | A callback that is called when a 'mousemove' event is registered outside of a previously hovered label item. Arguments: `[event, legendItem, legend]`.

docs/docs/getting-started/v3-migration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ The following properties were renamed during v3 development:
402402
* `helpers.callCallback` was renamed to `helpers.callback`
403403
* `helpers.drawRoundedRectangle` was renamed to `helpers.roundedRect`
404404
* `helpers.getValueOrDefault` was renamed to `helpers.valueOrDefault`
405+
* `LayoutItem.fullWidth` was renamed to `LayoutItem.fullSize`
405406
* `Scale.calculateTickRotation` was renamed to `Scale.calculateLabelRotation`
406407
* `Tooltip.options.legendColorBackgroupd` was renamed to `Tooltip.options.multiKeyBackground`
407408

@@ -434,6 +435,7 @@ The private APIs listed below were renamed:
434435
* `DatasetController.onDataUnshift` was renamed to `DatasetController._onDataUnshift`
435436
* `DatasetController.removeElements` was renamed to `DatasetController._removeElements`
436437
* `DatasetController.resyncElements` was renamed to `DatasetController._resyncElements`
438+
* `LayoutItem.isFullWidth` was renamed to `LayoutItem.isFullSize`
437439
* `RadialLinearScale.setReductions` was renamed to `RadialLinearScale._setReductions`
438440
* `Scale.handleMargins` was renamed to `Scale._handleMargins`
439441

src/core/core.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class Chart {
324324

325325
each(scales, (scale) => {
326326
// Set LayoutItem parameters for backwards compatibility
327-
scale.fullWidth = scale.options.fullWidth;
327+
scale.fullSize = scale.options.fullSize;
328328
scale.position = scale.options.position;
329329
scale.weight = scale.options.weight;
330330
layouts.addBox(me, scale);

src/core/core.layouts.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ function setLayoutDims(layouts, params) {
4949
layout = layouts[i];
5050
// store dimensions used instead of available chartArea in fitBoxes
5151
if (layout.horizontal) {
52-
layout.width = layout.box.fullWidth && params.availableWidth;
52+
layout.width = layout.box.fullSize && params.availableWidth;
5353
layout.height = params.hBoxMaxHeight;
5454
} else {
5555
layout.width = params.vBoxMaxWidth;
56-
layout.height = layout.box.fullWidth && params.availableHeight;
56+
layout.height = layout.box.fullSize && params.availableHeight;
5757
}
5858
}
5959
}
@@ -166,7 +166,7 @@ function fitBoxes(boxes, chartArea, params) {
166166
refit = true;
167167
}
168168
}
169-
if (!box.fullWidth) { // fullWidth boxes don't need to be re-fitted in any case
169+
if (!box.fullSize) { // fullSize boxes don't need to be re-fitted in any case
170170
refitBoxes.push(layout);
171171
}
172172
}
@@ -184,17 +184,17 @@ function placeBoxes(boxes, chartArea, params) {
184184
layout = boxes[i];
185185
box = layout.box;
186186
if (layout.horizontal) {
187-
box.left = box.fullWidth ? userPadding.left : chartArea.left;
188-
box.right = box.fullWidth ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;
187+
box.left = box.fullSize ? userPadding.left : chartArea.left;
188+
box.right = box.fullSize ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;
189189
box.top = y;
190190
box.bottom = y + box.height;
191191
box.width = box.right - box.left;
192192
y = box.bottom;
193193
} else {
194194
box.left = x;
195195
box.right = x + box.width;
196-
box.top = box.fullWidth ? userPadding.top : chartArea.top;
197-
box.bottom = box.fullWidth ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h;
196+
box.top = box.fullSize ? userPadding.top : chartArea.top;
197+
box.bottom = box.fullSize ? params.outerHeight - userPadding.right : chartArea.top + chartArea.h;
198198
box.height = box.bottom - box.top;
199199
x = box.right;
200200
}
@@ -219,7 +219,7 @@ defaults.set('layout', {
219219
* @prop {string} position - The position of the item in the chart layout. Possible values are
220220
* 'left', 'top', 'right', 'bottom', and 'chartArea'
221221
* @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area
222-
* @prop {boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
222+
* @prop {boolean} fullSize - if true, and the item is horizontal, then push vertical boxes down
223223
* @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
224224
* @prop {function} update - Takes two parameters: width and height. Returns size of item
225225
* @prop {function} draw - Draws the element
@@ -249,7 +249,7 @@ export default {
249249
}
250250

251251
// initialize item with default values
252-
item.fullWidth = item.fullWidth || false;
252+
item.fullSize = item.fullSize || false;
253253
item.position = item.position || 'top';
254254
item.weight = item.weight || 0;
255255
// @ts-ignore
@@ -284,7 +284,7 @@ export default {
284284
* @param {object} options - the new item options.
285285
*/
286286
configure(chart, item, options) {
287-
const props = ['fullWidth', 'position', 'weight'];
287+
const props = ['fullSize', 'position', 'weight'];
288288
const ilen = props.length;
289289
let i = 0;
290290
let prop;

src/core/core.scale.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,8 @@ export default class Scale extends Element {
906906
/**
907907
* @return {boolean}
908908
*/
909-
isFullWidth() {
910-
return this.options.fullWidth;
909+
isFullSize() {
910+
return this.options.fullSize;
911911
}
912912

913913
/**

src/plugins/plugin.legend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class Legend extends Element {
6565
this._margins = undefined;
6666
this.position = undefined;
6767
this.weight = undefined;
68-
this.fullWidth = undefined;
68+
this.fullSize = undefined;
6969
}
7070

7171
update(maxWidth, maxHeight, margins) {
@@ -540,7 +540,7 @@ export default {
540540
display: true,
541541
position: 'top',
542542
align: 'center',
543-
fullWidth: true,
543+
fullSize: true,
544544
reverse: false,
545545
weight: 1000,
546546

src/plugins/plugin.title.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Title extends Element {
2323
this.height = undefined;
2424
this.position = undefined;
2525
this.weight = undefined;
26-
this.fullWidth = undefined;
26+
this.fullSize = undefined;
2727
}
2828

2929
update(maxWidth, maxHeight) {
@@ -170,7 +170,7 @@ export default {
170170
font: {
171171
style: 'bold',
172172
},
173-
fullWidth: true,
173+
fullSize: true,
174174
padding: 10,
175175
position: 'top',
176176
text: '',

test/specs/core.layouts.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe('Chart.layouts', function() {
206206
x2: {
207207
type: 'category',
208208
position: 'top',
209-
fullWidth: true,
209+
fullSize: true,
210210
offset: false
211211
},
212212
y: {

test/specs/plugin.legend.tests.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('Legend block tests', function() {
77
display: true,
88
position: 'top',
99
align: 'center',
10-
fullWidth: true, // marks that this box should take the full width of the canvas (pushing down other boxes)
10+
fullSize: true,
1111
reverse: false,
1212
weight: 1000,
1313

@@ -768,24 +768,24 @@ describe('Legend block tests', function() {
768768
options: {
769769
plugins: {
770770
legend: {
771-
fullWidth: true,
771+
fullSize: true,
772772
position: 'top',
773773
weight: 150
774774
}
775775
}
776776
}
777777
});
778778

779-
expect(chart.legend.fullWidth).toBe(true);
779+
expect(chart.legend.fullSize).toBe(true);
780780
expect(chart.legend.position).toBe('top');
781781
expect(chart.legend.weight).toBe(150);
782782

783-
chart.options.plugins.legend.fullWidth = false;
783+
chart.options.plugins.legend.fullSize = false;
784784
chart.options.plugins.legend.position = 'left';
785785
chart.options.plugins.legend.weight = 42;
786786
chart.update();
787787

788-
expect(chart.legend.fullWidth).toBe(false);
788+
expect(chart.legend.fullSize).toBe(false);
789789
expect(chart.legend.position).toBe('left');
790790
expect(chart.legend.weight).toBe(42);
791791
});

test/specs/plugin.title.tests.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Title block tests', function() {
99
color: Chart.defaults.color,
1010
display: false,
1111
position: 'top',
12-
fullWidth: true,
12+
fullSize: true,
1313
weight: 2000,
1414
font: {
1515
style: 'bold'
@@ -291,24 +291,24 @@ describe('Title block tests', function() {
291291
options: {
292292
plugins: {
293293
title: {
294-
fullWidth: true,
294+
fullSize: true,
295295
position: 'top',
296296
weight: 150
297297
}
298298
}
299299
}
300300
});
301301

302-
expect(chart.titleBlock.fullWidth).toBe(true);
302+
expect(chart.titleBlock.fullSize).toBe(true);
303303
expect(chart.titleBlock.position).toBe('top');
304304
expect(chart.titleBlock.weight).toBe(150);
305305

306-
chart.options.plugins.title.fullWidth = false;
306+
chart.options.plugins.title.fullSize = false;
307307
chart.options.plugins.title.position = 'left';
308308
chart.options.plugins.title.weight = 42;
309309
chart.update();
310310

311-
expect(chart.titleBlock.fullWidth).toBe(false);
311+
expect(chart.titleBlock.fullSize).toBe(false);
312312
expect(chart.titleBlock.position).toBe('left');
313313
expect(chart.titleBlock.weight).toBe(42);
314314
});

0 commit comments

Comments
 (0)