Applied a couple of simpler rules

This commit is contained in:
fbarl
2016-12-05 18:35:52 +01:00
committed by Filip Barl
parent 0cb48f6d71
commit e47c3e0973
43 changed files with 212 additions and 143 deletions

View File

@@ -17,7 +17,7 @@ const letterRange = endLetterRange - startLetterRange;
export function text2degree(text) {
const input = text.substr(0, 2).toUpperCase();
let num = 0;
for (let i = 0; i < input.length; i++) {
for (let i = 0; i < input.length; i += 1) {
const charCode = Math.max(Math.min(input[i].charCodeAt(), endLetterRange), startLetterRange);
num += Math.pow(letterRange, input.length - i - 1) * (charCode - startLetterRange);
}

View File

@@ -55,8 +55,7 @@ function setInlineStyles(svg, target, emptySvgDeclarationComputed) {
// hardcode computed css styles inside svg
const allElements = traverse(svg);
const allTargetElements = traverse(target);
let i = allElements.length;
while (i--) {
for (let i = allElements.length - 1; i >= 0; i -= 1) {
explicitlySetStyle(allElements[i], allTargetElements[i]);
}

View File

@@ -1,9 +1,9 @@
import { includes } from 'lodash';
import { scaleLog } from 'd3-scale';
import { formatMetricSvg } from './string-utils';
import { colors } from './color-utils';
import React from 'react';
import { formatMetricSvg } from './string-utils';
import { colors } from './color-utils';
export function getClipPathDefinition(clipId, size, height,
x = -size * 0.5, y = size * 0.5 - height) {