Skip to content

Commit

Permalink
Merge pull request #2 from fusioncharts/develop
Browse files Browse the repository at this point in the history
taking updates
  • Loading branch information
siddharthapaul001 authored Jan 29, 2020
2 parents 56092c5 + 0b57be7 commit 046fce3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
4 changes: 4 additions & 0 deletions package/raphael.js
Original file line number Diff line number Diff line change
Expand Up @@ -2992,6 +2992,10 @@ var pathDimensions = R.pathBBox = function (path) {
large_arc_flag = large_arc_flag && +large_arc_flag;
// for more information of where this math came from visit:
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
// If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a "lineto") joining the endpoints
if (rx === 0 || ry === 0) {
return l2c(x1, y1, x2, y2);
}
var _120 = PI * 120 / 180,
rad = deg2rad * (+angle || 0),
res = [],
Expand Down
2 changes: 1 addition & 1 deletion package/raphael.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package/raphael.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions source/raphael.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ var loaded,
isEdge = R.isEdge = /Edge/.test(navigator.userAgent),
isIE11 = R.isIE11 = /trident/i.test(navigator.userAgent) &&
/rv:11/i.test(navigator.userAgent) && !win.opera,
isIE10 = R.isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1,
isFirefox = R.isFirefox = /Firefox/.test(navigator.userAgent),
isWindows = R.isWindows = /Windows/.test(navigator.userAgent),
mStr = 'm',
Expand Down Expand Up @@ -1884,6 +1885,10 @@ var loaded,
large_arc_flag = large_arc_flag && +large_arc_flag;
// for more information of where this math came from visit:
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
// If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a "lineto") joining the endpoints
if (rx === 0 || ry === 0){
return l2c(x1, y1, x2, y2);
}
var _120 = PI * 120 / 180,
rad = deg2rad * (+angle || 0),
res = [],
Expand Down
8 changes: 3 additions & 5 deletions source/raphael.svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -2403,12 +2403,10 @@ export default function (R) {
// '-ms-touch-action : none' permits no default touch behaviors in IE (10 and 11) browser
// '-touch-action : none' permits no default touch behaviors in mozilla of windows
if (supportsTouch) {
if (R.isEdge) {
css += 'touch-action:none;';
} else if (R.isFirefox && R.isWindows) {
css += 'touch-action:none;';
} else if (R.isIE11) {
if (R.isIE10) {
css += '-ms-touch-action:none;';
} else {
css += 'touch-action:none;';
}
}
x = x || 0;
Expand Down
25 changes: 25 additions & 0 deletions tests/unit/arc-to-curve-as-line-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Raphael from '../../source/raphael';

describe('Arc is treated as a straight line segment when rx = 0 or ry = 0', function(){
let expectedCurve = ['C', 11, 12, 22, 24, 22, 24];
it('Arc is treated as a straight line segment when rx = 0 and ry = 0', function(){
let curve = Raphael.path2curve(["M", "11", "12", "A", "0", "0", "5", "5", "1", "22", "24"]);
curve[1].forEach((element, idx) => {
expect(element).toBe(expectedCurve[idx]);
});
});

it('Arc is treated as a straight line segment when rx = 0', function(){
let curve = Raphael.path2curve(["M", "11", "12", "A", "0", "5", "5", "5", "1", "22", "24"]);
curve[1].forEach((element, idx) => {
expect(element).toBe(expectedCurve[idx]);
});
});

it('Arc is treated as a straight line segment when ry = 0', function(){
let curve = Raphael.path2curve(["M", "11", "12", "A", "5", "0", "5", "5", "1", "22", "24"]);
curve[1].forEach((element, idx) => {
expect(element).toBe(expectedCurve[idx]);
});
});
});

0 comments on commit 046fce3

Please sign in to comment.