We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do we change the attributes of objects dynamically? For example, I want to change the scaleX, scaleY:
<div class="flex gap-2"> <UInput v-model.number="selectedObject.scaleX" :min="0.5" inputClass="bg-[#2e3447] ps-16 text-[#bbbfd9] ring-none!important ring-transparent focus:ring-none"> <template #leading> <span class="text-gray-500 dark:text-gray-400 text-xs">ScaleX:</span> </template> </UInput> <UInput v-model.number="selectedObject.scaleY" :min="0.5" inputClass="bg-[#2e3447] ps-16 text-[#bbbfd9] ring-none!important ring-transparent focus:ring-none"> <template #leading> <span class="text-gray-500 dark:text-gray-400 text-xs">ScaleY:</span> </template> </UInput> </div>
Then I have a watcher:
watch: { selectedObject: { deep: true, async handler(newAttrs: any) { await nextTick(); if (newAttrs) { const stage = this.$refs.stage.getStage(); const node = stage.findOne('.' + newAttrs.name); if (node) { node.setAttrs(newAttrs); node.draw(); node.getLayer().batchDraw(); // Redraw the layer } } } } },
But a component is redrawing only after I transform it manually.
I've tried to change the item config as well:
<v-stage ref="stage" :config="configStage" @mousedown="handleStageMouseDown" @touchstart="handleStageMouseDown"> <v-layer ref="layer"> <component :key="item.config.name" :is="item.type" :config="item.config" v-for="item in canvas"/> <v-transformer ref="transformer" /> </v-layer> </v-stage>
But it only updates when the item is not transformed. So It might be the issue with the transformer.
The text was updated successfully, but these errors were encountered:
The same issue is with rotation. this.$refs.transformer.getNode().forceUpdate() helps only for width, and height changes.
Sorry, something went wrong.
Can you please make a small online demo of what you are trying? With codesandbox or something similar.
No branches or pull requests
How do we change the attributes of objects dynamically?
For example, I want to change the scaleX, scaleY:
Then I have a watcher:
But a component is redrawing only after I transform it manually.
I've tried to change the item config as well:
But it only updates when the item is not transformed. So It might be the issue with the transformer.
The text was updated successfully, but these errors were encountered: