Page 1 of 1

How to re-render selected area in image area select

Posted: 25 Jan 2018, 14:59
by atul.raut
I want to select some portion of image on load event using Image area select.
Is this possible to re-render.

Re: How to re-render selected area in image area select

Posted: 25 Jan 2018, 19:08
by Melloware
So you want a certain area pre-selected basically?

Re: How to re-render selected area in image area select

Posted: 01 Feb 2018, 07:15
by atul.raut
Yes, i want to pre-select image area...

Re: How to re-render selected area in image area select

Posted: 01 Feb 2018, 14:31
by Melloware
So looking at the code there are javascript methods on the widget to setSelection.

Code: Select all

PrimeFaces.widgets.widget_areaSelect.setSelection(334,193,334,193);
Here is what the document says:

Code: Select all

/**
     * Set the current selection.
     * This method only sets the internal representation of selection in the plugin instance,
     * it does not update the visual interface.
     * If you want the new selection to be shown, call update() right after setSelection().
     * Also make sure that the show option is set to true.
     *
     * @param {int} x1 X coordinate of the top left corner of the selection area.
     * @param {int} y1 Y coordinate of the top left corner of the selection area.
     * @param {int} x2 X coordinate of the bottom right corner of the selection area.
     * @param {int} y2 Y coordinate of the bottom right corner of the selection area.
     */
    setSelection : function(x1, y1, x2, y2) {
        this.instance.setSelection(x1, y1, x2, y2);
    },
But I can't seem to make it work.