Commit f5734fe7 authored by rockyl's avatar rockyl

Merge branch 'auto_align_qx' into dev

# Conflicts:
#	src/2d/display/Sprite.ts
#	src/2d/text/TextField.ts
#	src/zeroing/launcher.ts
parents 3088fd51 dc88a857
File added
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
<option name="languageLevel" value="FLOW" />
</component>
</project>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Checkout_at_2020_5_15,_2_12_下午_[Default_Changelist]" date="1589523138013" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2020_5_15,_2_12_下午_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2020/5/15, 2:12 下午 [Default Changelist]" />
</changelist>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]" date="1589438835098" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2020/5/14, 2:47 下午 [Default Changelist]" />
</changelist>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -26,10 +26,10 @@ export default {
},
],
plugins: [
progress(),
// progress(),
resolve({}),
typescript({
//useTsconfigDeclarationDir: true,
// useTsconfigDeclarationDir: true,
}),
commonjs(),
process.env.BUILD === 'production' && uglify({})
......
import {DisplayObject} from './DisplayObject';
import {Rectangle} from "../math/Rectangle";
import {Point} from '../math/index';
import { DisplayObject } from './DisplayObject';
import { Rectangle } from "../math/Rectangle";
import { Point } from '../math/index';
import CanvasRenderer from '../renderers/CanvasRenderer';
import {Event} from "../events/Event"
import {WebglRenderer} from '../renderers/WebglRenderer';
import {applyAutoAdjust} from "../../zeroing/decorators/auto-adjust";
import {applyScript} from "../../zeroing/decorators/scripts";
import {applyEvents} from "../../zeroing/decorators/events";
import {afterConstructor} from "../../zeroing/decorators/after-constructor";
import {injectProperties, instantiateScript} from "../../zeroing/utils/index";
import {isUI} from "../../zeroing/game-warpper/nodes/IUIComponent";
import { Event } from "../events/Event"
import { WebglRenderer } from '../renderers/WebglRenderer';
import { applyAutoAdjust } from "../../zeroing/decorators/auto-adjust";
import { applyScript } from "../../zeroing/decorators/scripts";
import { applyEvents } from "../../zeroing/decorators/events";
import { afterConstructor } from "../../zeroing/decorators/after-constructor";
import { injectProperties, instantiateScript, toBoolean } from "../../zeroing/utils/index";
import { isUI } from "../../zeroing/game-warpper/nodes/IUIComponent";
import Transform from "../math/Transform";
/**
......@@ -23,6 +23,7 @@ import Transform from "../math/Transform";
@applyScript
@applyEvents
export default class Container extends DisplayObject {
percentWidth: number;
percentHeight: number;
left: number;
......@@ -52,6 +53,7 @@ export default class Container extends DisplayObject {
*/
containerUpdateTransform;
constructor() {
super();
this._instanceType = "Container";
......@@ -81,6 +83,7 @@ export default class Container extends DisplayObject {
onChildrenChange(index) {
/* empty */
//子类需要时重写
this.dispatchEvent(Event.MAYBE_ALIGN);
}
attachVisibility() {
......@@ -189,9 +192,9 @@ export default class Container extends DisplayObject {
this.onChildrenChange(id1 < id2 ? id1 : id2);
return true;
}
}
/**
* 获取child的层级索引index
* @param {DisplayObject} child - The DisplayObject instance to identify
......@@ -439,7 +442,7 @@ export default class Container extends DisplayObject {
this._lastBoundsID = this._boundsID
this._bounds.clear();
//算自己的
if(!this._calculateBounds()){
this._calculateBounds();
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (!child.visible || !child.renderable) {
......@@ -467,7 +470,6 @@ export default class Container extends DisplayObject {
}
}
}
}
/**
* 加"_"的方法基本是为了自己特殊处理
......@@ -487,7 +489,7 @@ export default class Container extends DisplayObject {
this._bounds.height = this._height;
}*/
if(widthSetted || heightSetted){
if (widthSetted || heightSetted) {
const rect = this._localBoundsSelf;
var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
......@@ -509,7 +511,7 @@ export default class Container extends DisplayObject {
//如果不可见
if (!this.visible) return null
//如果禁止子级的鼠标事件
if (isMouseEvent && !this.mouseChildren){
if (isMouseEvent && !this.mouseChildren) {
return this.hitTestSelf(globalPoint);
}
var children = this.children;
......@@ -619,6 +621,7 @@ export default class Container extends DisplayObject {
//自身绘制方法
}
/**
* canvas渲染方式
* @param {CanvasRenderer} renderer - The renderer
......@@ -728,6 +731,13 @@ export default class Container extends DisplayObject {
//if (this.stage) this.stage.layoutInvalid = true;
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
this.__width = (toBoolean(this.percentWidth) || (toBoolean(this.left) && toBoolean(this.right)))
? 0
: value;
}
}
......@@ -757,7 +767,38 @@ export default class Container extends DisplayObject {
//if (this.stage) this.stage.layoutInvalid = true;
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
// 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0
this.__height = (toBoolean(this.percentHeight) || (toBoolean(this.top) && toBoolean(this.bottom)))
? 0
: value;
}
}
protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
get x(): number {
return this.position.x;
}
set x(value: number) {
if (value == this.transform.position.x) return;
this.transform.position.x = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
}
get y(): number {
return this.position.y;
}
set y(value: number) {
if (value == this.transform.position.y) return;
this.transform.position.y = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
}
clone(withEvents = false, withScripts = false) {
......
import {ObservablePoint, Point, Rectangle} from '../math';
import {sign, TextureCache} from '../utils';
import { ObservablePoint, Point, Rectangle } from '../math';
import { sign, TextureCache } from '../utils';
// import { BLEND_MODES } from '../const';
import Texture from '../texture/Texture';
import {Event} from '../events/Event';
import { Event } from '../events/Event';
import Container from './Container';
import {DisplayObject} from "./DisplayObject";
import { DisplayObject } from "./DisplayObject";
import CanvasRenderer from '../renderers/CanvasRenderer';
import {SCALE_MODES} from '../const';
import {WebglRenderer} from '../renderers/WebglRenderer';
import { SCALE_MODES } from '../const';
import { WebglRenderer } from '../renderers/WebglRenderer';
import { abs } from "../utils/twiddle";
const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
/**
......@@ -401,11 +402,19 @@ export default class Sprite extends Container {
this.scale.x = 1;
this._width = undefined;
} else {
value = abs(value);
const s = sign(this.scale.y) || 1;
this.scale.x = s * value / this._texture.orig.width;
this._width = value;
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentWidth) || this.percentWidth === null) {
this.__width = value;
} else {
this.__width = 0;
}
}
}
......@@ -424,11 +433,19 @@ export default class Sprite extends Container {
this.scale.y = 1;
this._height = undefined;
} else {
value = abs(value);
const s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height;
this._height = value;
}
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentHeight) || this.percentHeight === null) {
this.__height = value;
} else {
this.__height = 0;
}
}
}
......
......@@ -12,6 +12,7 @@ import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer";
import {GlobalPro, isWebGLSupported} from "../utils/index";
// import { alignMgr } from "../../zeroing/decorators/AlignManager";
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
......@@ -972,13 +973,15 @@ export class Stage extends Container {
if (!GlobalPro.startTime) GlobalPro.startTime = Date.now();
//console.log('flushAll', Date.now());
if (!Stage._pause) {
let len = Stage.allUpdateObjList.length;
for (let i = 0; i < len; i++) {
Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush();
}
}
// alignMgr.flush();
requestAnimationFrame(Stage.flushAll);
}
......
......@@ -9,8 +9,9 @@ import {HashObject} from "../HashObject";
*/
export class Event extends HashObject {
// public static IMAGE_LOADED: string = "onImageLoaded"
public static MAYBE_ALIGN: string = "maybeAlign";
// public static IMAGE_LOADED: string = "onImageLoaded"
/**
* 舞台尺寸发生变化时触发
* @Event
......
import { ALIGN_MODE, AUTO_SIZE_MODE } from "./auto-adjust";
import { toBoolean } from "../utils/utils";
import { Container } from "../../2d/display/index";
/**
* 自适应管理器
* @constructor
*/
class AlignManager {
// 这个列表里的对象会在渲染前被自动调整
private alignList = [];
constructor() {
}
/**
* flash (渲染前)
*/
public flush() {
const list = this.alignList;
list.forEach((v: Container) => {
this.autoSize(v); // 去调整大小
this.align(v); // 去自动对齐
});
// 要在这里单独检查,因为对齐一次后可能遇到其父节点需要对齐导致其再对齐一次
list.forEach((v) => {
if (v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
v.alignEnabled = false;
}
});
// 干掉列表
list.length = 0;
}
/**
* align
* @param that
*/
private align(that) {
if (!that.alignEnabled) return; // 如果的自动对齐关闭里则啥也不干
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// that.alignEnabled = false;
// }
const {
percentWidth, percentHeight,
top, bottom, left, right,
percentTop, percentBottom, percentLeft, percentRight,
horizonCenter, verticalCenter
} = that;
let {_width: tW_Z = 0, _height: tH_Z = 0} = that;
const {_width: pW_Z = 0, _height: pH_Z = 0} = (that.parent || {});
/// TODO null / 100 == 0 ?????? wtf!!!! 我裂开了
// percentWidth /= 100;
// percentHeight /= 100;
// percentTop /= 100;
// percentBottom /= 100;
// percentLeft /= 100;
// percentRight /= 100;
const judgePL = toBoolean(percentLeft)
, judgePR = toBoolean(percentRight)
, judgePT = toBoolean(percentTop)
, judgePB = toBoolean(percentBottom);
// 先转化一下
const _left = judgePL ? percentLeft / 100 * pW_Z : left
, _right = judgePR ? percentRight / 100 * pW_Z : right
, _top = judgePT ? percentTop / 100 * pH_Z : top
, _bottom = judgePB ? percentBottom / 100 * pH_Z : bottom;
/**
* 计算 width 和 x 值
*/
if (toBoolean(_left) && toBoolean(_right)) { // _left _right 都有则直接拉伸或缩小
that.x = _left;
that.width = pW_Z - _left - _right;
} else {
// 先设置下自己的 width
toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
// 先考虑 horizonCenter 属性
if (toBoolean(horizonCenter)) {
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
} else if (toBoolean(_left)) { // 假如有 _left
that.x = _left;
} else if (toBoolean(_right)) { // 假如有 _right
that.x = pW_Z - _right - tW_Z;
}
}
/**
* 计算 height 和 y 值
*/
if (toBoolean(_top) && toBoolean(_bottom)) { // _top _bottom 都有则直接拉伸或缩小
that.y = _top;
that.height = pH_Z - _top - _bottom;
} else {
// 先设置下自己的 height
toBoolean(percentHeight) && (tH_Z = that.height = pH_Z * percentHeight / 100);
// 先考虑 horizonCenter 属性
if (toBoolean(verticalCenter)) {
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
that.y = pH_Z / 2 - tH_Z / 2 + verticalCenter;
} else if (toBoolean(_top)) { // 假如有 _top
that.y = _top;
} else if (toBoolean(_bottom)) { // 假如有 _bottom
that.y = pH_Z - _bottom - tH_Z;
}
}
that.children.forEach(v => this.align(v));
}
/**
* 自动大小
* @param that
*/
private autoSize(that) {
const len = that.children.length
if (len > 0) {
// 检测本身的是否是可以自动宽
// if (that.autoWidth
if (that.autoSizeMode === AUTO_SIZE_MODE.ALL
|| that.autoSizeMode === AUTO_SIZE_MODE.WIDTH
// && !toBoolean(that.right) /// TODO 我把它注释了 注释这行可以让容器设置了 right 后反向撑开,保持 right 边距不变
&& !toBoolean(that.percentWidth)) {
/// TODO 下面这段注释的代码可以实现让其左边撑开,不过还有未知bug
// 找出子节点最小x
// let minX = 0;
// for(let i = 0; i < len; i++) {
// if(that.children[i].x < minX) {
// minX = that.children[i].x;
// }
// }
// if(minX < 0) {
// that.children.forEach(v => v.x -= minX);
// that.x += minX;
// that.width -= minX;
// }
// 找出最右值
let maxR = 0;
for (let i = 0; i < len; i++) {
if (toBoolean(that.children[i].right)) continue; /// TODO 开启这个,忽略带 right 值的子节点
let _x = that.children[i].x || 0;
let _w = that.children[i].__width || 0;
(_x + _w > maxR) ? maxR = _x + _w : 0;
}
that.width = maxR;
}
// 检测本身的是否是可以自动高
if (that.autoSizeMode === AUTO_SIZE_MODE.ALL
|| that.autoSizeMode === AUTO_SIZE_MODE.HEIGHT
// && !toBoolean(that.bottom) /// TODO 我把它注释了 注释这行可以让容器设置了 bottom 后反向撑开,保持 bottom 边距不变
&& !toBoolean(that.percentHeight)) {
/// TODO 下面这段注释的代码可以实现让其上边撑开,不过还有未知bug
// 找出子节点最小y
// let minY = 0;
// for(let i = 1; i < len; i++) {
// if(that.children[i].y < minY) {
// minY = that.children[i].y;
// }
// }
// if(minY < 0) {
// that.children.forEach(v => v.y -= minY);
// that.y += minY;
// that.height -= minY;
// }
// 找出最下值
let maxB = 0;
for (let i = 0; i < len; i++) {
if (toBoolean(that.children[i].bottom)) continue; /// TODO 开启这个,忽略带 bottom 值的子节点
let _y = that.children[i].y || 0;
let _h = that.children[i].__height || 0;
(_y + _h > maxB) ? maxB = _y + _h : 0;
}
that.height = maxB;
}
}
}
/**
* 添加一个变脏的对象
* @param obj
*/
public addAlign(obj) {
const list = this.alignList;
if (list.indexOf(obj) < 0) {
list.push(obj);
}
}
}
function tt(...v) {
for (let i = 0; i < v.length; i++) {
if (!toBoolean(v[i])) return false;
}
return true;
}
export let alignMgr = new AlignManager();
This diff is collapsed.
This diff is collapsed.
......@@ -11,8 +11,10 @@ import {Event} from "../2d/events/Event";
import builtinLoadingView from "./game-warpper/LoadingView";
import {queryParams} from "./web";
import {initAutoLayout} from "./game-warpper/auto-layout";
import { alignMgr } from "./decorators/AlignManager";
export let gameStage: GameStage;
export let alignManager = alignMgr;
export function launch(url, loadingDelegate?, onStart?) {
if (queryParams.__proxy_mode__) {
......
......@@ -14,13 +14,13 @@ export const linkScheme = 'link://';
* @param predicate
*/
export function arrayFind(arr, predicate) {
if (!arr) {
if(!arr) {
return;
}
for (let i = 0, li = arr.length; i < li; i++) {
for(let i = 0, li = arr.length; i < li; i++) {
const item = arr[i];
if (predicate(item, i, arr)) {
if(predicate(item, i, arr)) {
return item;
}
}
......@@ -34,14 +34,14 @@ export function objClone(obj) {
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
}
const percentKeys = ['width', 'height'];
const percentKeys = ['width', 'height', 'top', 'left', 'bottom', 'right'];
export function propertyParse(key, node, properties) {
let value = properties[key];
let targetKey = key;
if (percentKeys.indexOf(key) >= 0) {
if (typeof value === 'string') {
if (value[value.length - 1] === '%') {
if(percentKeys.indexOf(key) >= 0) {
if(typeof value === 'string') {
if(value[value.length - 1] === '%') {
targetKey = 'percent' + key[0].toUpperCase() + key.substr(1);
}
value = parseInt(value);
......@@ -60,9 +60,9 @@ export function getDataByPath(scope, path, throwException?) {
let func = new Function('scope', `return scope` + (path ? ('.' + path) : ''));
try {
return func(scope);
} catch (e) {
} catch(e) {
//console.warn(e);
if (throwException) {
if(throwException) {
throw e;
}
}
......@@ -77,8 +77,8 @@ export function safeEval(code, throwException = false) {
let func = new Function(code);
try {
return func();
} catch (e) {
if (throwException) {
} catch(e) {
if(throwException) {
throw e;
}
}
......@@ -95,20 +95,20 @@ export function safeEval(code, throwException = false) {
* @return 是否有字段注入
*/
export function injectProp(target: any, data?: any, callback?: Function, ignoreMethod: boolean = true, ignoreNull: boolean = true): boolean {
if (!target || !data) {
if(!target || !data) {
return false;
}
let result = false;
for (let key in data) {
for(let key in data) {
let value: any = data[key];
if ((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) {
if (callback) {
if((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) {
if(callback) {
callback(target, key, value);
} else {
try {
target[key] = value;
} catch (e) {
} catch(e) {
}
}
......@@ -126,17 +126,17 @@ export function injectProp(target: any, data?: any, callback?: Function, ignoreM
* @param config
*/
export function copyProp(target, data, config?) {
if (data) {
for (let key in config) {
if(data) {
for(let key in config) {
let valueConfig = config[key];
if (Array.isArray(valueConfig)) {
if(Array.isArray(valueConfig)) {
target[key] = {};
for (let field of valueConfig) {
for(let field of valueConfig) {
target[key][field] = data[key][field];
}
} else if (typeof valueConfig === 'string') {
} else if(typeof valueConfig === 'string') {
target[valueConfig] = data[valueConfig];
} else if (typeof valueConfig === 'object') {
} else if(typeof valueConfig === 'object') {
target[key] = {};
copyProp(target[key], data[key], valueConfig)
}
......@@ -149,11 +149,11 @@ export function copyProp(target, data, config?) {
* @param obj
*/
export function obj2query(obj: any): string {
if (!obj) {
if(!obj) {
return '';
}
let arr: string[] = [];
for (let key in obj) {
for(let key in obj) {
arr.push(key + (key ? '=' : '') + obj[key]);
}
return arr.join('&');
......@@ -169,7 +169,7 @@ function requireForCJS(id) {
* @param node
*/
export function importCJSCode(code, node?) {
if (node) {
if(node) {
let create = new Function('module', 'require', code);
let module = {
exports: {},
......@@ -201,19 +201,19 @@ export function importUMDCode(code) {
* @param char
*/
export function trimChar(str: string, char: string) {
if (!str || !char) {
if(!str || !char) {
return;
}
while (true) {
while(true) {
let len = str.length, from = 0, end = len;
if (str[0] === char) {
if(str[0] === char) {
from = 1;
}
if (str[len - 1] === char) {
if(str[len - 1] === char) {
end = len - 1;
}
str = str.substring(from, end);
if (str.length == len) {
if(str.length == len) {
break;
}
}
......@@ -227,7 +227,7 @@ export function trimChar(str: string, char: string) {
*/
export function joinPath(...segments: string[]) {
let result = [];
for (let segment of segments) {
for(let segment of segments) {
result.push(trimChar(segment, '/'));
}
return result.join('/');
......@@ -240,10 +240,10 @@ export function joinPath(...segments: string[]) {
*/
export function findVariable(name: string, ...contexts) {
let result;
for (let context of contexts) {
if (context) {
for(let context of contexts) {
if(context) {
result = context[name];
if (result !== undefined) {
if(result !== undefined) {
break;
}
}
......@@ -258,7 +258,7 @@ let el;
* @param htmlText
*/
export function htmlToPureText(htmlText) {
if (!el) {
if(!el) {
el = document.createElement('div');
}
el.innerHTML = htmlText;
......@@ -277,7 +277,7 @@ const zhReg = /[\u4e00-\u9fa5]/;
*/
export function strLen(str) {
let len = 0;
for (let char of str) {
for(let char of str) {
len += char.match(zhReg) ? 2 : 1;
}
return len;
......@@ -291,12 +291,12 @@ export function strLen(str) {
*/
export function strShort(str, limit, replace = '…') {
let result = '';
if (strLen(str) > limit) {
if(strLen(str) > limit) {
let len = 0;
for (let i = 0, li = str.length; i < li; i++) {
for(let i = 0, li = str.length; i < li; i++) {
const char = str[i];
len += char.match(zhReg) ? 2 : 1;
if (len > limit) {
if(len > limit) {
result += replace;
break;
} else {
......@@ -328,8 +328,8 @@ export const cmdOldPrefix = '//z-';
* @param source
*/
export function injectProperties(target, source) {
for (let key in source) {
if (key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) {
for(let key in source) {
if(key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) {
propertyParse(key, target, source);
}
}
......@@ -344,14 +344,25 @@ export function injectProperties(target, source) {
* @param includeSelf
*/
export function traverseViewNode(node: Container, callback: Function, includeSelf = false) {
if (includeSelf) {
if(includeSelf) {
callback(node);
}
for (let child of node.children) {
for(let child of node.children) {
callback(child, node);
if (child.children && child.children.length > 0) {
if(child.children && child.children.length > 0) {
traverseViewNode(child, callback);
}
}
}
/**
* 数字转化为boolean值
* NaN -> false 'aaa' -> false null -> false undefined -> false
* 666 -> true '007' -> true Infinity -> true
* @param v
* @returns {boolean}
*/
export function toBoolean(v): boolean {
return !isNaN(v) && v !== null && v !== undefined;
}
......@@ -438,10 +438,10 @@ rollup-plugin-node-resolve@^5.2.0:
resolve "^1.11.1"
rollup-pluginutils "^2.8.1"
rollup-plugin-progress@^1.1.1:
version "1.1.1"
resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.1.tgz#fcce2f915d545014ac89ea0927ee97cb48052f60"
integrity sha1-/M4vkV1UUBSsieoJJ+6Xy0gFL2A=
rollup-plugin-progress@^1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.2.tgz#5c1dfe7c50f654906bc34d167d5512ee1a4b72d5"
integrity sha1-XB3+fFD2VJBrw00WfVUS7hpLctU=
dependencies:
chalk "^2.4.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment