MCPcopy Create free account
hub / github.com/react/react / applyNodeProps

Function applyNodeProps

packages/react-art/src/ReactFiberConfigART.js:140–184  ·  view source on GitHub ↗
(instance, props, prevProps = {})

Source from the content-addressed store, hash-verified

138}
139
140function applyNodeProps(instance, props, prevProps = {}) {
141 const scaleX = getScaleX(props);
142 const scaleY = getScaleY(props);
143
144 pooledTransform
145 .transformTo(1, 0, 0, 1, 0, 0)
146 .move(props.x || 0, props.y || 0)
147 .rotate(props.rotation || 0, props.originX, props.originY)
148 .scale(scaleX, scaleY, props.originX, props.originY);
149
150 if (props.transform != null) {
151 pooledTransform.transform(props.transform);
152 }
153
154 if (
155 instance.xx !== pooledTransform.xx ||
156 instance.yx !== pooledTransform.yx ||
157 instance.xy !== pooledTransform.xy ||
158 instance.yy !== pooledTransform.yy ||
159 instance.x !== pooledTransform.x ||
160 instance.y !== pooledTransform.y
161 ) {
162 instance.transformTo(pooledTransform);
163 }
164
165 if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) {
166 instance.indicate(props.cursor, props.title);
167 }
168
169 if (instance.blend && props.opacity !== prevProps.opacity) {
170 instance.blend(props.opacity == null ? 1 : props.opacity);
171 }
172
173 if (props.visible !== prevProps.visible) {
174 if (props.visible == null || props.visible) {
175 instance.show();
176 } else {
177 instance.hide();
178 }
179 }
180
181 for (const type in EVENT_TYPES) {
182 addEventListeners(instance, EVENT_TYPES[type], props[type]);
183 }
184}
185
186function applyRenderableNodeProps(instance, props, prevProps = {}) {
187 applyNodeProps(instance, props, prevProps);

Callers 3

applyGroupPropsFunction · 0.85
applyRenderableNodePropsFunction · 0.85

Calls 4

getScaleXFunction · 0.85
getScaleYFunction · 0.85
addEventListenersFunction · 0.85
moveMethod · 0.80

Tested by

no test coverage detected