VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-form/js/layouts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-form/js/layouts/ChainLayout.js
import FCore from "../core/FCore";
import LinearAnchorEditor from "../anchoreditors/LinearAnchorEditor";
import ChainAnchor from "../anchors/ChainAnchor";
import LinearLayout from "./LinearLayout";
import BaseLayout from "../core/BaseLayout";
import {AssemblerInstance} from "../core/Assembler";

var _ = FCore._;


function ChainLayout() {
    LinearLayout.call(this);
}

Object.defineProperties(ChainLayout.prototype, Object.getOwnPropertyDescriptors(LinearLayout.prototype));
ChainLayout.prototype.constructor = ChainLayout;

ChainLayout.prototype.tag = 'ChainLayout';
ChainLayout.prototype.menuIcon = 'span.mdi.mdi-id-card';

ChainLayout.prototype.TOP_CLASS_NAME = 'as-chain-layout';


ChainLayout.prototype.getAnchorConstructor = function () {
    return ChainAnchor;
};

ChainLayout.prototype.getAnchorEditorConstructor = function () {
    return LinearAnchorEditor;
};


ChainLayout.prototype.getAcceptsStyleNames = function () {
    return BaseLayout.prototype.getAcceptsStyleNames.call(this).concat(['overflowX']);
};


ChainLayout.prototype.setStyleOverflowX = function (value) {
    if (['visible', 'hidden', 'auto'].indexOf(value) < 0) value = 'visible';
    this.view.addStyle('overflowX', value);
    return value;
};


ChainLayout.prototype.getStyleOverflowXDescriptor = function () {
    return {
        type: 'enum',
        values: ['visible', 'hidden', 'auto']
    };
};


ChainLayout.prototype.measureMinSize = function () {
    var width = 0;
    var height = 0;
    var child;
    for (var i = 0; i < this.children.length; ++i) {
        child = this.children[i];
        var minSize = child.measureMinSize();
        width = Math.max(width, child.style.left + minSize.width + child.style.right);
        height = Math.max(height, child.style.top + minSize.height + child.style.bottom);
    }
    return { width: width, height: height };
};


ChainLayout.prototype.render = function () {
    return _({ class: this.TOP_CLASS_NAME });
};


ChainLayout.prototype.onAddChild = function (child, index) {
    var anchor = new ChainAnchor();
    anchor.attachChild(child);
    if (index == -1 || !this.view.childNodes[index]) {
        this.view.addChild(anchor.view);
    }
    else {
        this.view.addChildBefore(anchor.view, this.view.childNodes[index]);
    }
};

ChainLayout.prototype.addChildByPosition = function (child, posX, posY) {
    var bound = this.view.getBoundingClientRect();
    var at = undefined;
    var x;
    for (var i = 0; i < this.children.length; ++i) {
        x = this.children[i].view.getBoundingClientRect().right - bound.left;
        if (x >= posX) {
            at = this.children[i];
            break;
        }
    }

    if (at) {
        this.addChildBefore(child, at);
    }
    else {
        this.addChild(child);
    }
};

AssemblerInstance.addClass(ChainLayout);

export default ChainLayout;

VaKeR 2022