Skip to content

Commit 586ff25

Browse files
committed
remove legacy toggleSpikelines hack
now that this is baked into pull_font_svg
1 parent 52f307e commit 586ff25

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

src/components/modebar/modebar.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ proto.createButton = function(config) {
161161
button.appendChild(icon());
162162
}
163163
else {
164-
button.appendChild(this.createIcon(icon || Icons.question, config.name));
164+
button.appendChild(this.createIcon(icon || Icons.question));
165165
}
166166
button.setAttribute('data-gravity', config.gravity || 'n');
167167

@@ -175,7 +175,7 @@ proto.createButton = function(config) {
175175
* @Param {string} thisIcon.path
176176
* @Return {HTMLelement}
177177
*/
178-
proto.createIcon = function(thisIcon, name) {
178+
proto.createIcon = function(thisIcon) {
179179
var iconHeight = isNumeric(thisIcon.height) ?
180180
Number(thisIcon.height) :
181181
thisIcon.ascent - thisIcon.descent,
@@ -194,10 +194,7 @@ proto.createIcon = function(thisIcon, name) {
194194
}
195195
else if(thisIcon.ascent !== undefined) {
196196
// Legacy icon transform calculation
197-
var transform = name === 'toggleSpikelines' ?
198-
'matrix(1.5 0 0 -1.5 0 ' + thisIcon.ascent + ')' :
199-
'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')';
200-
path.setAttribute('transform', transform);
197+
path.setAttribute('transform', 'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')');
201198
}
202199

203200
icon.appendChild(path);

test/jasmine/tests/modebar_test.js

-24
Original file line numberDiff line numberDiff line change
@@ -272,30 +272,6 @@ describe('ModeBar', function() {
272272
expect(path.attr('d')).toBeDefined();
273273
expect(path.attr('transform')).toEqual('matrix(1.5 0 0 -1.5 0 850)');
274274
});
275-
276-
it('with the legacy spikelines button config', function() {
277-
var modeBar = createModeBar(getMockGraphInfo(), [[
278-
{
279-
name: 'toggleSpikelines',
280-
attr: '_cartesianSpikesEnabled',
281-
val: 'on',
282-
click: noop,
283-
icon: {
284-
width: 1000,
285-
path: 'M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z',
286-
ascent: 850,
287-
descent: -150
288-
}
289-
}
290-
]]);
291-
292-
var svg = getIconSvg(modeBar);
293-
expect(svg).toBeDefined();
294-
expect(svg.attr('viewBox')).toBe('0 0 1000 1000');
295-
var path = svg.select('path');
296-
expect(path.attr('d')).toBeDefined();
297-
expect(path.attr('transform')).toEqual('matrix(1.5 0 0 -1.5 0 850)');
298-
});
299275
});
300276
});
301277

0 commit comments

Comments
 (0)