Skip to content

Commit 776c0ac

Browse files
committed
Merge remote-tracking branch 'origin/master' into build-with-esbuild
2 parents 8ec3eaf + c7b1003 commit 776c0ac

File tree

251 files changed

+16818
-1311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+16818
-1311
lines changed

draftlogs/6990_add.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add support for numeric text font `weight` [[#6990](https://github.com/plotly/plotly.js/pull/6990)]

draftlogs/6996_fix.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix `getFullTransformMatrix` in shadow DOM [[#6996](https://github.com/plotly/plotly.js/pull/6996)],
2+
with thanks to @OpportunityLiu for the contribution!

draftlogs/6997_fix.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix drag on legend scrollbar while `edits.legendPosition` is `true` [[#6997](https://github.com/plotly/plotly.js/pull/6997)],
2+
with thanks to @OpportunityLiu for the contribution!

draftlogs/6998_fix.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Fix numerical instability in 3D plots [[6998](https://github.com/plotly/plotly.js/pull/6998)],
2+
with thanks to @hborchardt for the contribution!

src/components/annotations/draw.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
198198
fontColor: hoverFont.color,
199199
fontWeight: hoverFont.weight,
200200
fontStyle: hoverFont.style,
201-
fontVariant: hoverFont.variant
201+
fontVariant: hoverFont.variant,
202+
fontShadow: hoverFont.fontShadow,
203+
fontLineposition: hoverFont.fontLineposition,
204+
fontTextcase: hoverFont.fontTextcase,
202205
}, {
203206
container: fullLayout._hoverlayer.node(),
204207
outerContainer: fullLayout._paper.node(),

src/components/colorbar/defaults.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,9 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
124124
coerce('title.text', layout._dfltTitle.colorbar);
125125

126126
var tickFont = colorbarOut.showticklabels ? colorbarOut.tickfont : font;
127-
var dfltTitleFont = Lib.extendFlat({}, tickFont, {
128-
weight: font.weight,
129-
style: font.style,
130-
variant: font.variant,
131-
color: font.color,
127+
128+
var dfltTitleFont = Lib.extendFlat({}, font, {
129+
family: tickFont.family,
132130
size: Lib.bigFont(tickFont.size)
133131
});
134132
Lib.coerceFont(coerce, 'title.font', dfltTitleFont);

src/components/drawing/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ drawing.font = function(s, font) {
3434
var color = font.color;
3535
var size = font.size;
3636
var family = font.family;
37+
var shadow = font.shadow;
38+
var lineposition = font.lineposition;
39+
var textcase = font.textcase;
3740

3841
if(family) s.style('font-family', family);
3942
if(size + 1) s.style('font-size', size + 'px');
@@ -42,8 +45,38 @@ drawing.font = function(s, font) {
4245
if(weight) s.style('font-weight', weight);
4346
if(style) s.style('font-style', style);
4447
if(variant) s.style('font-variant', variant);
48+
49+
if(textcase) s.style('text-transform', dropNone(textcase2transform(textcase)));
50+
if(shadow) s.style('text-shadow', shadow === 'auto' ? svgTextUtils.makeTextShadow(Color.contrast(color)) : dropNone(shadow));
51+
if(lineposition) s.style('text-decoration-line', dropNone(lineposition2decorationLine(lineposition)));
52+
};
53+
54+
function dropNone(a) {
55+
return a === 'none' ? undefined : a;
56+
}
57+
58+
var textcase2transformOptions = {
59+
normal: 'none',
60+
lower: 'lowercase',
61+
upper: 'uppercase',
62+
'word caps': 'capitalize'
4563
};
4664

65+
function textcase2transform(textcase) {
66+
return textcase2transformOptions[textcase];
67+
}
68+
69+
function lineposition2decorationLine(lineposition) {
70+
return (
71+
lineposition
72+
.replace('under', 'underline')
73+
.replace('over', 'overline')
74+
.replace('through', 'line-through')
75+
.split('+')
76+
.join(' ')
77+
);
78+
}
79+
4780
/*
4881
* Positioning helpers
4982
* Note: do not use `setPosition` with <text> nodes modified by
@@ -1136,6 +1169,9 @@ drawing.textPointStyle = function(s, trace, gd) {
11361169
weight: d.tw || trace.textfont.weight,
11371170
style: d.ty || trace.textfont.style,
11381171
variant: d.tv || trace.textfont.variant,
1172+
textcase: d.tC || trace.textfont.textcase,
1173+
lineposition: d.tE || trace.textfont.lineposition,
1174+
shadow: d.tS || trace.textfont.shadow,
11391175
size: fontSize,
11401176
color: fontColor
11411177
})

src/components/fx/hover.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,9 @@ function createHoverText(hoverData, opts) {
961961
var fontWeight = opts.fontWeight || fullLayout.font.weight;
962962
var fontStyle = opts.fontStyle || fullLayout.font.style;
963963
var fontVariant = opts.fontVariant || fullLayout.font.variant;
964+
var fontTextcase = opts.fontTextcase || fullLayout.font.textcase;
965+
var fontLineposition = opts.fontLineposition || fullLayout.font.lineposition;
966+
var fontShadow = opts.fontShadow || fullLayout.font.shadow;
964967

965968
var c0 = hoverData[0];
966969
var xa = c0.xa;
@@ -1041,13 +1044,17 @@ function createHoverText(hoverData, opts) {
10411044
var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine;
10421045
var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor);
10431046
var contrastColor = Color.contrast(commonBgColor);
1047+
var commonLabelOptsFont = commonLabelOpts.font;
10441048
var commonLabelFont = {
1045-
weight: commonLabelOpts.font.weight || fontWeight,
1046-
style: commonLabelOpts.font.style || fontStyle,
1047-
variant: commonLabelOpts.font.variant || fontVariant,
1048-
family: commonLabelOpts.font.family || fontFamily,
1049-
size: commonLabelOpts.font.size || fontSize,
1050-
color: commonLabelOpts.font.color || contrastColor
1049+
weight: commonLabelOptsFont.weight || fontWeight,
1050+
style: commonLabelOptsFont.style || fontStyle,
1051+
variant: commonLabelOptsFont.variant || fontVariant,
1052+
textcase: commonLabelOptsFont.textcase || fontTextcase,
1053+
lineposition: commonLabelOptsFont.lineposition || fontLineposition,
1054+
shadow: commonLabelOptsFont.shadow || fontShadow,
1055+
family: commonLabelOptsFont.family || fontFamily,
1056+
size: commonLabelOptsFont.size || fontSize,
1057+
color: commonLabelOptsFont.color || contrastColor
10511058
};
10521059

10531060
lpath.style({
@@ -1370,6 +1377,9 @@ function createHoverText(hoverData, opts) {
13701377
weight: fontWeight,
13711378
style: fontStyle,
13721379
variant: fontVariant,
1380+
textcase: fontTextcase,
1381+
lineposition: fontLineposition,
1382+
shadow: fontShadow,
13731383
family: fontFamily,
13741384
size: fontSize
13751385
});
@@ -1413,7 +1423,10 @@ function createHoverText(hoverData, opts) {
14131423
color: d.fontColor || contrastColor,
14141424
weight: d.fontWeight || fontWeight,
14151425
style: d.fontStyle || fontStyle,
1416-
variant: d.fontVariant || fontVariant
1426+
variant: d.fontVariant || fontVariant,
1427+
textcase: d.fontTextcase || fontTextcase,
1428+
lineposition: d.fontLineposition || fontLineposition,
1429+
shadow: d.fontShadow || fontShadow,
14171430
})
14181431
.text(text)
14191432
.attr('data-notex', 1)
@@ -1432,7 +1445,10 @@ function createHoverText(hoverData, opts) {
14321445
color: nameColor,
14331446
weight: d.fontWeight || fontWeight,
14341447
style: d.fontStyle || fontStyle,
1435-
variant: d.fontVariant || fontVariant
1448+
variant: d.fontVariant || fontVariant,
1449+
textcase: d.fontTextcase || fontTextcase,
1450+
lineposition: d.fontLineposition || fontLineposition,
1451+
shadow: d.fontShadow || fontShadow,
14361452
}).text(name)
14371453
.attr('data-notex', 1)
14381454
.call(svgTextUtils.positionText, 0, 0)

src/components/legend/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
3333
};
3434

3535
var globalFont = layoutOut.font || {};
36-
var grouptitlefont = Lib.coerceFont(coerce, 'grouptitlefont', Lib.extendFlat({}, globalFont, {
36+
var grouptitlefont = Lib.coerceFont(coerce, 'grouptitlefont', globalFont, { overrideDflt: {
3737
size: Math.round(globalFont.size * 1.1)
38-
}));
38+
}});
3939

4040
var legendTraceCount = 0;
4141
var legendReallyHasATrace = false;

src/components/legend/draw.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,23 @@ function drawOne(gd, opts) {
423423
dragElement.init({
424424
element: legend.node(),
425425
gd: gd,
426-
prepFn: function() {
426+
prepFn: function(e) {
427+
if(e.target === scrollBar.node()) {
428+
return;
429+
}
427430
var transform = Drawing.getTranslate(legend);
428431
x0 = transform.x;
429432
y0 = transform.y;
430433
},
431434
moveFn: function(dx, dy) {
432-
var newX = x0 + dx;
433-
var newY = y0 + dy;
435+
if(x0 !== undefined && y0 !== undefined) {
436+
var newX = x0 + dx;
437+
var newY = y0 + dy;
434438

435-
Drawing.setTranslate(legend, newX, newY);
436-
xf = dragElement.align(newX, legendObj._width, gs.l, gs.l + gs.w, legendObj.xanchor);
437-
yf = dragElement.align(newY + legendObj._height, -legendObj._height, gs.t + gs.h, gs.t, legendObj.yanchor);
439+
Drawing.setTranslate(legend, newX, newY);
440+
xf = dragElement.align(newX, legendObj._width, gs.l, gs.l + gs.w, legendObj.xanchor);
441+
yf = dragElement.align(newY + legendObj._height, -legendObj._height, gs.t + gs.h, gs.t, legendObj.yanchor);
442+
}
438443
},
439444
doneFn: function() {
440445
if(xf !== undefined && yf !== undefined) {

0 commit comments

Comments
 (0)