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

Custom Controllers for Element #28

Open
SeungpilPark opened this issue Aug 24, 2017 · 1 comment
Open

Custom Controllers for Element #28

SeungpilPark opened this issue Aug 24, 2017 · 1 comment

Comments

@SeungpilPark
Copy link
Member

No description provided.

SeungpilPark pushed a commit that referenced this issue Aug 24, 2017
@SeungpilPark
Copy link
Member Author

커스텀 컨트롤러 작성법

create 또는 action 하나만 작성 가능.

create 는 주어진 shape 으로 원하는 선 연결 후 새로 생성된다.

shape.controllers = [
                {
                    image: 'annotation.png',
                    create: {
                        shape: 'OG.CircleShape',
                        width: 100,
                        height: 100,
                        style: {}
                    }
                    action: function (element) {
                        console.log(element);
                    }
                }
            ]

create 모드로 생성되었을 때는 후처리로 다음을 이용한다.

/**
     *
     * @param {Function} callbackFunc 콜백함수(event, sourceElement, targetElement)
     */
    onDuplicated: function (callbackFunc) {
        $(this.getRootElement()).bind('duplicated', function (event, sourceElement, targetElement) {
            callbackFunc(event, sourceElement, targetElement);
        });
    },

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

1 participant