feat:add view tag and findViewByTag
This commit is contained in:
@@ -169,6 +169,12 @@ class View {
|
||||
}
|
||||
return f;
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/** Anchor start*/
|
||||
get left() {
|
||||
return this.x;
|
||||
@@ -405,6 +411,21 @@ class Superview extends View {
|
||||
}
|
||||
}
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return this.findViewTraversal(this, tag);
|
||||
}
|
||||
findViewTraversal(view, tag) {
|
||||
for (let v of view.allSubviews()) {
|
||||
let find = v.findViewByTag(tag);
|
||||
if (find) {
|
||||
return find;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
isDirty() {
|
||||
if (super.isDirty()) {
|
||||
return true;
|
||||
|
@@ -59,18 +59,8 @@ var doric = (function (exports) {
|
||||
|
||||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
||||
|
||||
function createCommonjsModule(fn, basedir, module) {
|
||||
return module = {
|
||||
path: basedir,
|
||||
exports: {},
|
||||
require: function (path, base) {
|
||||
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
||||
}
|
||||
}, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
function commonjsRequire () {
|
||||
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
||||
function createCommonjsModule(fn, module) {
|
||||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
/*! *****************************************************************************
|
||||
@@ -2855,6 +2845,10 @@ var doric = (function (exports) {
|
||||
|
||||
hiddenKeys[METADATA] = true;
|
||||
});
|
||||
var internalMetadata_1 = internalMetadata.REQUIRED;
|
||||
var internalMetadata_2 = internalMetadata.fastKey;
|
||||
var internalMetadata_3 = internalMetadata.getWeakData;
|
||||
var internalMetadata_4 = internalMetadata.onFreeze;
|
||||
|
||||
var onFreeze = internalMetadata.onFreeze;
|
||||
|
||||
|
@@ -1628,6 +1628,12 @@ class View {
|
||||
}
|
||||
return f;
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/** Anchor start*/
|
||||
get left() {
|
||||
return this.x;
|
||||
@@ -1864,6 +1870,21 @@ class Superview extends View {
|
||||
}
|
||||
}
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return this.findViewTraversal(this, tag);
|
||||
}
|
||||
findViewTraversal(view, tag) {
|
||||
for (let v of view.allSubviews()) {
|
||||
let find = v.findViewByTag(tag);
|
||||
if (find) {
|
||||
return find;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
isDirty() {
|
||||
if (super.isDirty()) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user