Issue #930Opened March 7, 2018by alfaalex811 reactions

[Question] Update resizer after asset changed

Question

Hi! I trying to change default assets manager with ours custom manager.

    editor.Commands.add('open-assets', {
        run(editorImage,b,target) {
            editorImage.getSelected().set('src', 'http://placehold.it/'+Math.floor((Math.random() * 800) + 400)+'x'+Math.floor((Math.random() * 400) + 200)+'/fff/000/testimage.jpg');
        }
    })

On double click the selected image is replaced with a new one with different size. It works, but the resizers element not updating their position. It is possibile to re-initialize it?

image

Thanks!

Answers (3)

alfaalex81March 12, 20181 reactions

I have an image on canvas, for example 300x200, double click on it and I select a new image from asset manager, now is 600x400. When i launch your suggested code the new image is not ready. I solved with a preloader,

In Italy we say: "I am lost in a glass of water" :)

Thanks for the support.

artfMarch 8, 20180 reactions

Try to reselect the component

var selected = editor.getSelected();
editor.select().select(selected);
alfaalex81March 8, 20180 reactions

Thanks for your reply, I tried your suggestion, but the image is not ready yet when I launch selection update. There are a callback or a listener on loaded image?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.