iOS:fix when LayoutSpec.MOST and weight both setted
This commit is contained in:
parent
528e6625b5
commit
b266fdaa20
@ -1,64 +1,34 @@
|
|||||||
|
|
||||||
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout } from "doric";
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout } from "doric";
|
||||||
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue } from "doric/lib/src/util/flexbox";
|
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue } from "doric/lib/src/util/flexbox";
|
||||||
|
import { colors } from "./utils";
|
||||||
const colors = [
|
|
||||||
"#f0932b",
|
|
||||||
"#eb4d4b",
|
|
||||||
"#6ab04c",
|
|
||||||
"#e056fd",
|
|
||||||
"#686de0",
|
|
||||||
"#30336b",
|
|
||||||
]
|
|
||||||
|
|
||||||
function box(idx = 0) {
|
|
||||||
return stack([], {
|
|
||||||
flexConfig: {
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
},
|
|
||||||
backgroundColor: Color.parse(colors[idx || 0])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function boxStr(str: string, idx = 0) {
|
|
||||||
return text({
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
text: str,
|
|
||||||
textColor: Color.WHITE,
|
|
||||||
layoutConfig: layoutConfig().just(),
|
|
||||||
backgroundColor: Color.parse(colors[idx || 0])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function label(str: string) {
|
|
||||||
return text({
|
|
||||||
text: str,
|
|
||||||
textSize: 16,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
class LayoutDemo extends Panel {
|
class LayoutDemo extends Panel {
|
||||||
build(root: Group) {
|
build(root: Group) {
|
||||||
flexlayout(
|
flexlayout(
|
||||||
[
|
[
|
||||||
box(0),
|
stack([], {
|
||||||
box(1),
|
flexConfig: {
|
||||||
box(2),
|
width: 100,
|
||||||
box(3),
|
height: 100,
|
||||||
box(4),
|
},
|
||||||
box(0),
|
backgroundColor: colors[0]
|
||||||
box(1),
|
}),
|
||||||
box(2),
|
stack([], {
|
||||||
box(3),
|
flexConfig: {
|
||||||
box(4),
|
width: 100,
|
||||||
box(0),
|
height: 100,
|
||||||
box(1),
|
},
|
||||||
box(2),
|
backgroundColor: colors[1],
|
||||||
box(3),
|
}),
|
||||||
box(4),
|
stack([], {
|
||||||
|
flexConfig: {
|
||||||
|
width: 100,
|
||||||
|
height: 100,
|
||||||
|
},
|
||||||
|
backgroundColor: colors[2],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
layoutConfig: layoutConfig().fit(),
|
layoutConfig: layoutConfig().fit(),
|
||||||
|
@ -77,14 +77,22 @@ - (void)measure:(CGSize)targetSize {
|
|||||||
CGFloat width;
|
CGFloat width;
|
||||||
CGFloat height;
|
CGFloat height;
|
||||||
if (self.widthSpec == DoricLayoutMost) {
|
if (self.widthSpec == DoricLayoutMost) {
|
||||||
|
if (self.view.superview.doricLayout.layoutType == DoricHLayout && self.weight > 0) {
|
||||||
|
width = self.measuredWidth = 0;
|
||||||
|
} else {
|
||||||
width = self.measuredWidth = targetSize.width;
|
width = self.measuredWidth = targetSize.width;
|
||||||
|
}
|
||||||
} else if (self.widthSpec == DoricLayoutJust) {
|
} else if (self.widthSpec == DoricLayoutJust) {
|
||||||
width = self.measuredWidth = self.width;
|
width = self.measuredWidth = self.width;
|
||||||
} else {
|
} else {
|
||||||
width = targetSize.width;
|
width = targetSize.width;
|
||||||
}
|
}
|
||||||
if (self.heightSpec == DoricLayoutMost) {
|
if (self.heightSpec == DoricLayoutMost) {
|
||||||
|
if (self.view.superview.doricLayout.layoutType == DoricVLayout && self.weight > 0) {
|
||||||
|
height = self.measuredWidth = 0;
|
||||||
|
} else {
|
||||||
height = self.measuredHeight = targetSize.height;
|
height = self.measuredHeight = targetSize.height;
|
||||||
|
}
|
||||||
} else if (self.heightSpec == DoricLayoutJust) {
|
} else if (self.heightSpec == DoricLayoutJust) {
|
||||||
height = self.measuredHeight = self.height;
|
height = self.measuredHeight = self.height;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1705,7 +1705,7 @@ var doric = (function (exports) {
|
|||||||
(module.exports = function (key, value) {
|
(module.exports = function (key, value) {
|
||||||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
||||||
})('versions', []).push({
|
})('versions', []).push({
|
||||||
version: '3.6.5',
|
version: '3.6.4',
|
||||||
mode: 'global',
|
mode: 'global',
|
||||||
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
||||||
});
|
});
|
||||||
@ -6489,13 +6489,7 @@ var doric = (function (exports) {
|
|||||||
defer = functionBindContext(port.postMessage, port, 1);
|
defer = functionBindContext(port.postMessage, port, 1);
|
||||||
// Browsers with postMessage, skip WebWorkers
|
// Browsers with postMessage, skip WebWorkers
|
||||||
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
||||||
} else if (
|
} else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
|
||||||
global_1.addEventListener &&
|
|
||||||
typeof postMessage == 'function' &&
|
|
||||||
!global_1.importScripts &&
|
|
||||||
!fails(post) &&
|
|
||||||
location.protocol !== 'file:'
|
|
||||||
) {
|
|
||||||
defer = post;
|
defer = post;
|
||||||
global_1.addEventListener('message', listener, false);
|
global_1.addEventListener('message', listener, false);
|
||||||
// IE8-
|
// IE8-
|
||||||
@ -9867,7 +9861,7 @@ var doric = (function (exports) {
|
|||||||
var INVALID_PORT = 'Invalid port';
|
var INVALID_PORT = 'Invalid port';
|
||||||
|
|
||||||
var ALPHA = /[A-Za-z]/;
|
var ALPHA = /[A-Za-z]/;
|
||||||
var ALPHANUMERIC = /[\d+-.A-Za-z]/;
|
var ALPHANUMERIC = /[\d+\-.A-Za-z]/;
|
||||||
var DIGIT = /\d/;
|
var DIGIT = /\d/;
|
||||||
var HEX_START = /^(0x|0X)/;
|
var HEX_START = /^(0x|0X)/;
|
||||||
var OCT = /^[0-7]+$/;
|
var OCT = /^[0-7]+$/;
|
||||||
|
Reference in New Issue
Block a user