本文整理汇总了TypeScript中app/scripts/common.Matrix.scaling方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Matrix.scaling方法的具体用法?TypeScript Matrix.scaling怎么用?TypeScript Matrix.scaling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app/scripts/common.Matrix
的用法示例。
在下文中一共展示了Matrix.scaling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fromPathOpString
export function fromPathOpString(pathString: string, pathOpsString: string) {
const A = pathOpsString.split(' ');
const mutator = new Path(pathString).mutate();
for (let i = 0; i < A.length; i++) {
const op = A[i] as PathOp;
switch (op) {
case 'RV': // Reverse.
mutator.reverseSubPath(+A[i + 1]);
i += 1;
break;
case 'SB': // Shift back.
mutator.shiftSubPathBack(+A[i + 1]);
i += 1;
break;
case 'SF': // Shift forward.
mutator.shiftSubPathForward(+A[i + 1]);
i += 1;
break;
case 'S': // Split.
const subIdx = +A[i + 1];
const cmdIdx = +A[i + 2];
const args = [+A[i + 3]];
i += 3;
while (!isNaN(+A[i + 1]) && i < A.length) {
args.push(+A[i + 1]);
i++;
}
mutator.splitCommand(subIdx, cmdIdx, ...args);
break;
case 'SIH': // Split in half.
mutator.splitCommandInHalf(+A[i + 1], +A[i + 2]);
i += 2;
break;
case 'US': // Unsplit.
mutator.unsplitCommand(+A[i + 1], +A[i + 2]);
i += 2;
break;
case 'CV': // Convert.
mutator.convertCommand(+A[i + 1], +A[i + 2], A[i + 3] as SvgChar);
i += 3;
break;
case 'UCV': // Unconvert.
mutator.unconvertSubPath(+A[i + 1]);
i += 1;
break;
case 'RT': // Revert.
mutator.revert();
break;
case 'M': // Move subpath.
mutator.moveSubPath(+A[i + 1], +A[i + 2]);
i += 2;
break;
case 'AC': // Add collapsing sub path.
mutator.addCollapsingSubPath({ x: +A[i + 1], y: +A[i + 2] }, +A[i + 3]);
i += 3;
break;
case 'DC': // Delete collapsing sub paths.
mutator.deleteCollapsingSubPaths();
break;
case 'SSSP': // Split stroked sub path.
mutator.splitStrokedSubPath(+A[i + 1], +A[i + 2]);
i += 2;
break;
case 'SFSP': // Split filled sub path.
mutator.splitFilledSubPath(+A[i + 1], +A[i + 2], +A[i + 3]);
i += 3;
break;
case 'DFSP': // Delete filled sub path.
mutator.deleteFilledSubPath(+A[i + 1]);
i += 1;
break;
case 'DFSPS': // Delete filled subpath segment.
mutator.deleteFilledSubPathSegment(+A[i + 1], +A[i + 2]);
i += 2;
break;
case 'DSSP': // Delete stroked sub path.
mutator.deleteStrokedSubPath(+A[i + 1]);
i += 1;
break;
case 'T': // Transform.
const isTransformOpFn = (token: string) => {
token = (token || '').toLowerCase();
return new Set(['scale', 'rotate', 'translate']).has(token);
};
while (isTransformOpFn(A[i + 1])) {
const transformOp = A[i + 1];
let matrix: Matrix;
switch (transformOp) {
case 'scale':
matrix = Matrix.scaling(+A[i + 2], +A[i + 3]);
i += 3;
break;
case 'rotate':
matrix = Matrix.rotation(+A[i + 2]);
i += 2;
break;
case 'translate':
matrix = Matrix.translation(+A[i + 2], +A[i + 3]);
i += 3;
break;
//.........这里部分代码省略.........