dist/modules/extras/label-types/BasicLabelType.js
/**
     * Show tag of the label
     * @param label label
     * @param path path created from label
     * @param ratio ratio based on the zoom of the workspace
     */
Show tag of the label
@param label label
@param path path created from label
@param ratio ratio based on the zoom of the workspace
Show tag of the label @param label label @param path path created from label @param ratio ratio based on the zoom of the workspace
showLabelTag(label, path, ratio) {
        const class_ = this.labeller.getClass(label.class_id);
        const text = new this.paper.PointText(new paper_1.Point(50, 50));
        text.content = this.tagContent(label, class_);
        text.style = {
            fontSize: 12 * ratio,
            fontWeight: 600,
            fillColor: 'white'
        };
        const bounds = text.bounds.scale(1.25);
        const box = new this.paper.Path.Rectangle(bounds, 0);
        const color = new paper_1.Color(class_.color);
        box.fillColor = color;
        const tag = new this.paper.Group([box, text]);
        const posit = this.options.labelTagPosition || 'topLeft';
        tag.bounds[posit] = path.bounds[posit];
        tag.data.index = label.id;
        tag.locked = true;
        return tag;
    }
showLabelTag ( label , path , ratio ) { const class_ = this . labeller . getClass ( label . class_id ) ; const text = new this . paper . PointText ( new paper_1 . Point ( 50 , 50 ) ) ; text . content = this . tagContent ( label , class_ ) ; text . style = { fontSize : 12 * ratio , fontWeight : 600 , fillColor : 'white' } ; const bounds = text . bounds . scale ( 1.25 ) ; const box = new this . paper . Path . Rectangle ( bounds , 0 ) ; const color = new paper_1 . Color ( class_ . color ) ; box . fillColor = color ; const tag = new this . paper . Group ( [ box , text ] ) ; const posit = this . options . labelTagPosition || 'topLeft' ; tag . bounds [ posit ] = path . bounds [ posit ] ; tag . data . index = label . id ; tag . locked = true ; return tag ; }
Show tag of the label
 @param label label
 @param path path created from label
 @param ratio ratio based on the zoom of the workspace
Show tag of the label @param label label @param path path created from label @param ratio ratio based on the zoom of the workspace
// create a text at a random point // set content ant style // get the bounds of the text and offset it // to create the background draw a rectangle // combine the background and text to make tag // move the tag to specified position // for selecting the label by clicking the tag // lock tag