
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
@hc-master/renderer
Advanced tools
基于pixiJS的渲染引擎,处理智能设计项目的渲染数据JSON Schema,以数据驱动的形式渲染图形图像的React渲染组件
从npm获取 @hc-master/renderer
npm install @hc-master/renderer
在你的react项目中引入
import { Renderer } from '@hc-master/renderer'
// resDataJson为智能设计项目数据
function App() {
const [index] = useState(0);
const curData = useMemo(() => resDataJson.pagesData[index], [index]);
const onMount = function(app) {
console.log('==>>>::: 监听组件挂载');
}
const onCompleted = function(app) {
console.log('==>>>::: 监听组件资源加载并渲染完成');
}
const onUnmount = function(app) {
console.log('==>>>::: 监听组件卸载');
}
const handlePrev = function() {
let v = indexRef.current-1;
indexRef.current = v < 0 ? 0 : v
setCurData(resDataJson.pagesData[indexRef.current])
}
const handleNext = function() {
const count = resDataJson.pagesData.length-1;
let v = indexRef.current+1;
indexRef.current = v > count ? count : v;
setCurData(resDataJson.pagesData[indexRef.current])
}
const handleChange = function() {
const id = '9f6c1d44-d61c-4ad9-8f85-1d981f4548ce';
const index = curData.stageJson.findIndex(item => item.id === id);
// 找到指定数据
const item = curData.stageJson[index] as FrameType;
if (!item.photo) return
// 改变数据内容
item.photo = {
...item.photo,
image: 'http://sts-test.gdoss.xstore.ctyun.cn/simooapp/debug/user_data/urqtj013qcgc0oct/photos/2023/08/14/1692008690_20230814_102450_159D15C9.jpg?x-amz-process=image/resize,m_fill,w_400,h_0',
origHeight: 1501,
origWidth: 1994,
width: 400,
height: 554,
scale: {
x: 4.98,
y: 4.98
},
x: 0,
y: 0
};
// 更新数据(Immutable Data)
curData.stageJson[index] = {...item}
setCurData({...curData})
}
return (
<div className='App'>
<Button onClick={handlePrev}>上页</Button>
<Button onClick={handleNext}>下页</Button>
<Button onClick={handleChange}>替换页内容</Button>
<Renderer
data={curData}
designWidth={resDataJson.designWidth}
designHeight={resDataJson.designHeight}
onMount={onMount}
onCompleted={onCompleted}
/>
</div>
)
}
以下为组件的props详细
需要传入的解析的JSON,从智能设计服务获取
渲染的画布尺寸宽度
渲染的画布尺寸高度
标记当前页码(多页渲染时使用)
渲染组件挂载时的事件监听
渲染组件卸载时的事件监听
渲染组件完成渲染时的事件监听
获取字体文件URL事件
FAQs
基于pixiJS的渲染引擎,处理智能设计项目的渲染数据JSON Schema,以数据驱动的形式渲染图形图像的React渲染组件
We found that @hc-master/renderer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.