How to use the fabric.fabric.Object function in fabric

To help you get started, we’ve selected a few fabric examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.image-editor / test / command.spec.js View on Github external
it('After running the LOAD_IMAGE command, existing objects should not include cropzone.', done => {
            const objCropzone = new fabric.Object({type: 'cropzone'});

            invoker.execute(commands.ADD_OBJECT, graphics, objCropzone).then(() => {
                invoker.execute(commands.LOAD_IMAGE, graphics, 'image', imageURL).then(() => {
                    const lastUndoIndex = invoker._undoStack.length - 1;
                    const savedObjects = invoker._undoStack[lastUndoIndex].undoData.objects;

                    expect(savedObjects.length).toBe(0);
                    done();
                });
            });
        });
github nhn / tui.image-editor / test / command.spec.js View on Github external
it('`evented` attribute of the saved object must be true after LOAD_IMAGE.', done => {
            const objCircle = new fabric.Object({
                type: 'circle',
                evented: false
            });

            invoker.execute(commands.ADD_OBJECT, graphics, objCircle).then(() => {
                invoker.execute(commands.LOAD_IMAGE, graphics, 'image', imageURL).then(() => {
                    const lastUndoIndex = invoker._undoStack.length - 1;
                    const [savedObject] = invoker._undoStack[lastUndoIndex].undoData.objects;

                    expect(savedObject.evented).toBe(true);
                    done();
                });
            });
        });
github nhn / tui.image-editor / test / icon.spec.js View on Github external
it('add() should create the arrow icon when parameter value is "arrow".', () => {
        const path = icon._pathMap.arrow;

        spyOn(icon, '_createIcon').and.returnValue(new fabric.Object({}));

        icon.add('arrow');

        expect(icon._createIcon).toHaveBeenCalledWith(path);
    });
github nhn / tui.image-editor / test / command.spec.js View on Github external
beforeEach(() => {
            object = new fabric.Object();
            object2 = new fabric.Object();
            group = new fabric.Group();

            graphics.add(object);
            graphics.add(object2);
            graphics.add(group);
            group.add(object, object2);
        });
github nhn / tui.image-editor / test / command.spec.js View on Github external
beforeEach(() => {
            obj = new fabric.Object();
        });
github nhn / tui.image-editor / test / command.spec.js View on Github external
beforeEach(() => {
            object = new fabric.Object();
            object2 = new fabric.Object();
            group = new fabric.Group();

            graphics.add(object);
            graphics.add(object2);
            graphics.add(group);
            group.add(object, object2);
        });