client/js/renderer/baseeditor.js
author ymh <ymh.work@gmail.com>
Thu, 05 Jan 2017 19:34:53 +0100
changeset 648 e388117572d8
parent 503 18cb4c4c4e5e
permissions -rw-r--r--
Improve display of editor tooltip. Add a vertical scroll if they too tall.


define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
    'use strict';

    var Utils = requtils.getUtils();

    /* _BaseEditor Begin */
    //var _BaseEditor = Renderer._BaseEditor = Utils.inherit(Renderer._BaseRepresentation);
    var _BaseEditor = Utils.inherit(BaseRepresentation);

    _(_BaseEditor.prototype).extend({
        _init: function() {
            this.renderer.buttons_layer.activate();
            this.type = "editor";
            this.editor_block = new paper.Path();
            var _pts = _.map(_.range(8), function() {return [0,0];});
            this.editor_block.add.apply(this.editor_block, _pts);
            this.editor_block.strokeWidth = this.options.tooltip_border_width;
            this.editor_block.strokeColor = this.options.tooltip_border_color;
            this.editor_block.opacity = this.options.tooltip_opacity;
            this.editor_$ = $('<div>')
                .appendTo(this.renderer.editor_$)
                .css({
                    position: "absolute",
                    opacity: this.options.tooltip_opacity
                })
                .hide();
        },
        destroy: function() {
            this.editor_block.remove();
            this.editor_$.remove();
        }
    }).value();

    /* _BaseEditor End */

    return _BaseEditor;

});