MCPcopy
hub / github.com/clientIO/joint / HookSetAny

Function HookSetAny

packages/joint-react/src/hooks/use-update-element.stories.tsx:222–256  ·  view source on GitHub ↗
({ label, id }: SimpleElement)

Source from the content-addressed store, hash-verified

220});
221
222function HookSetAny({ label, id }: SimpleElement) {
223 const set = useUpdateElement(id);
224
225 return (
226 <HTMLNode className="node">
227 <button
228 className={BUTTON_CLASSNAME}
229 onClick={() =>
230 set('position', (previous) => {
231 if (previous === undefined) {
232 return { x: 0, y: 0 };
233 }
234 return { x: previous.x + 10, y: previous.y + 10 };
235 })
236 }
237 >
238 Set Position
239 </button>
240 <button
241 className={BUTTON_CLASSNAME}
242 onClick={() =>
243 set('size', (previous) => {
244 if (previous === undefined) {
245 return { width: 0, height: 0 };
246 }
247 return { width: previous.width + 10, height: previous.height + 10 };
248 })
249 }
250 >
251 Set Size
252 </button>
253 label: {label}
254 </HTMLNode>
255 );
256}
257
258export const SetAnyProperty: Story = makeStory<Story>({
259 apiURL: API_URL,

Callers

nothing calls this directly

Calls 2

useUpdateElementFunction · 0.90
setFunction · 0.50

Tested by

no test coverage detected