Skip to content
New issue

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

The objects inside a group - controls are not working #7927

Closed
dennisideaonce opened this issue May 5, 2022 · 3 comments
Closed

The objects inside a group - controls are not working #7927

dennisideaonce opened this issue May 5, 2022 · 3 comments

Comments

@dennisideaonce
Copy link

dennisideaonce commented May 5, 2022

Version

4.6.0

Problem

The objects inside a group - controls are not working.

The problem:

Coming as

The expectation:

Expectation

In the actual application:

Screen.Recording.2022-05-05.at.10.16.02.PM.mov

The controls of the selected object are not at the right position. It should be above the selected group object. I am sure I am missing something.

Jsfiddle: http://jsfiddle.net/e3j40v6d/28/

Description

I am trying to build a simple image editing tool using fabric js. I have created a group of active selections by using the below code:

group() {
    const object = this.canvas.getActiveObject();
    if (object.type != 'activeSelection') {
        return;
    }
    let isTextboxInGroup = false;
    for (let obj of object.getObjects()) {
        if (obj.type === 'textbox') {
            isTextboxInGroup = true;
        }
    }

    const newgroup = object.toGroup();
    newgroup.perPixelTargetFind = true;
    newgroup.objectCaching = false;
    newgroup.id = this.randomId();
    newgroup.lockUniScaling = isTextboxInGroup ? true : false;
    this.canvas.discardActiveObject();
    this.canvas.setActiveObject(newgroup);
    this.canvas.requestRenderAll();
}

I want to click on a button and select an object from the group and use its controls like scaling up and down rotate freely. Right now the controls and selected objects are not at the right position. I am not able to use the controls at all.

makeCurrentObjectActive($event, object) { // object is an object from the group
    // this.ungroup();
    if (!object) {
      return true;
    }

    $event.preventDefault();
    $event.stopImmediatePropagation();
    // delete object.group; // If I add this the object box sorounding it goes into too left, I understand that deletes the group
    this.canvas.discardActiveObject();
    this.canvas.setActiveObject(object);
    this.canvas.requestRenderAll();
  }

Any help is highly appreciated, Thank you!

@ShaMan123
Copy link
Contributor

Dude you're looking for v6.
#7670

@dennisideaonce
Copy link
Author

Yes I just noticed the same. One quick question is there any estimated date of release for this?

I hope it will also work for .toGroup(); @ShaMan123

@bobbhy
Copy link

bobbhy commented Aug 14, 2023

@dennisideaonce did you find any workaround for this without migrating to v6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants