amis/packages/office-viewer/examples/presetShape.ts
吴多益 0f97e378d9
chore: 换一下 office-viewer 包名 (#7321)
* chore: 换一下 office-viewer 包名

* 恢复误改的文件
2023-07-03 14:31:27 +08:00

33 lines
915 B
TypeScript

import {presetShape} from '../src/openxml/drawing/presetShape';
import {shapeToSVG} from '../src/openxml/drawing/svg/shapeToSVG';
const container = document.getElementById('shapes')! as HTMLElement;
for (const shapeName in presetShape) {
// 临时测试用
if (shapeName !== 'smileyFace') {
// continue;
}
const shape = presetShape[shapeName];
console.log('render shape', shapeName);
const svg = shapeToSVG(shape, [], {}, 100, 100, {
fillColor: '#4472C4'
});
const div = document.createElement('div');
div.style.display = 'inline-block';
div.style.margin = '12px 40px';
div.style.width = '100px';
div.style.height = '120px';
div.style.boxSizing = 'border-box';
div.style.verticalAlign = 'top';
div.style.textAlign = 'center';
div.appendChild(svg);
const p = document.createElement('p');
p.innerText = shapeName;
div.appendChild(p);
container.appendChild(div);
}