mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix background example (#3663)
This commit is contained in:
45
.vscode/launch.json
vendored
45
.vscode/launch.json
vendored
@ -1,70 +1,41 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"name": "Sync on iOS",
|
|
||||||
"type": "nativescript",
|
|
||||||
"platform": "ios",
|
|
||||||
"request": "launch",
|
|
||||||
"appRoot": "${workspaceRoot}",
|
|
||||||
"sourceMaps": true,
|
|
||||||
"diagnosticLogging": false,
|
|
||||||
"emulator": false,
|
|
||||||
"rebuild": false,
|
|
||||||
"syncAllFiles": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Launch on iOS",
|
"name": "Launch on iOS",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "ios",
|
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
"platform": "ios",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": true
|
||||||
"emulator": false,
|
|
||||||
"rebuild": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach on iOS",
|
"name": "Attach on iOS",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "ios",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
|
"platform": "ios",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": false
|
||||||
"emulator": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sync on Android",
|
|
||||||
"type": "nativescript",
|
|
||||||
"platform": "android",
|
|
||||||
"request": "launch",
|
|
||||||
"appRoot": "${workspaceRoot}",
|
|
||||||
"sourceMaps": true,
|
|
||||||
"diagnosticLogging": false,
|
|
||||||
"emulator": false,
|
|
||||||
"rebuild": false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Launch on Android",
|
"name": "Launch on Android",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "android",
|
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
"platform": "android",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": true
|
||||||
"emulator": false,
|
|
||||||
"rebuild": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach on Android",
|
"name": "Attach on Android",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "android",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
|
"platform": "android",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": false
|
||||||
"emulator": false
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
52
apps/.vscode/launch.json
vendored
52
apps/.vscode/launch.json
vendored
@ -1,77 +1,41 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"name": "Sync on iOS",
|
|
||||||
"type": "nativescript",
|
|
||||||
"platform": "ios",
|
|
||||||
"request": "launch",
|
|
||||||
"appRoot": "${workspaceRoot}",
|
|
||||||
"sourceMaps": true,
|
|
||||||
"diagnosticLogging": false,
|
|
||||||
"emulator": false,
|
|
||||||
"rebuild": false,
|
|
||||||
"syncAllFiles": true,
|
|
||||||
"stopOnEntry": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Launch on iOS",
|
"name": "Launch on iOS",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "ios",
|
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
"platform": "ios",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": true
|
||||||
"emulator": false,
|
|
||||||
"rebuild": true,
|
|
||||||
"stopOnEntry": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach on iOS",
|
"name": "Attach on iOS",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "ios",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
|
"platform": "ios",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": false
|
||||||
"emulator": false,
|
|
||||||
"stopOnEntry": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Sync on Android",
|
|
||||||
"type": "nativescript",
|
|
||||||
"platform": "android",
|
|
||||||
"request": "launch",
|
|
||||||
"appRoot": "${workspaceRoot}",
|
|
||||||
"sourceMaps": true,
|
|
||||||
"diagnosticLogging": false,
|
|
||||||
"emulator": false,
|
|
||||||
"rebuild": false,
|
|
||||||
"syncAllFiles": true,
|
|
||||||
"stopOnEntry": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Launch on Android",
|
"name": "Launch on Android",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "android",
|
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
"platform": "android",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": true
|
||||||
"emulator": false,
|
|
||||||
"rebuild": true,
|
|
||||||
"stopOnEntry": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach on Android",
|
"name": "Attach on Android",
|
||||||
"type": "nativescript",
|
"type": "nativescript",
|
||||||
"platform": "android",
|
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
|
"platform": "android",
|
||||||
"appRoot": "${workspaceRoot}",
|
"appRoot": "${workspaceRoot}",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"diagnosticLogging": false,
|
"watch": false
|
||||||
"emulator": false,
|
|
||||||
"stopOnEntry": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
3
apps/.vscode/settings.json
vendored
3
apps/.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1997,8 +1997,8 @@ const fontProperty = new ShorthandProperty<Style, string>({
|
|||||||
[fontFamilyProperty, unsetValue]
|
[fontFamilyProperty, unsetValue]
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
let font = parseFont(value);
|
const font = parseFont(value);
|
||||||
let fontSize = parseFloat(font.fontSize);
|
const fontSize = parseFloat(font.fontSize);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[fontStyleProperty, font.fontStyle],
|
[fontStyleProperty, font.fontStyle],
|
||||||
|
@ -193,6 +193,22 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
|||||||
const lbi: Point = { x: nativeViewLayerBounds.left + left, y: nativeViewLayerBounds.bottom - bottom }; // left-bottom-inside
|
const lbi: Point = { x: nativeViewLayerBounds.left + left, y: nativeViewLayerBounds.bottom - bottom }; // left-bottom-inside
|
||||||
|
|
||||||
let hasNonUniformBorder: boolean;
|
let hasNonUniformBorder: boolean;
|
||||||
|
|
||||||
|
// TODO: This is inefficient.
|
||||||
|
// We need to know what caused the change and reuse as much as possible.
|
||||||
|
if (nativeView.topBorderLayer) {
|
||||||
|
nativeView.topBorderLayer.removeFromSuperlayer();
|
||||||
|
}
|
||||||
|
if (nativeView.rightBorderLayer) {
|
||||||
|
nativeView.rightBorderLayer.removeFromSuperlayer();
|
||||||
|
}
|
||||||
|
if (nativeView.bottomBorderLayer) {
|
||||||
|
nativeView.bottomBorderLayer.removeFromSuperlayer();
|
||||||
|
}
|
||||||
|
if (nativeView.leftBorderLayer) {
|
||||||
|
nativeView.leftBorderLayer.removeFromSuperlayer();
|
||||||
|
}
|
||||||
|
|
||||||
const borderTopColor = background.borderTopColor;
|
const borderTopColor = background.borderTopColor;
|
||||||
if (top > 0 && borderTopColor && borderTopColor.ios) {
|
if (top > 0 && borderTopColor && borderTopColor.ios) {
|
||||||
const topBorderPath = CGPathCreateMutable();
|
const topBorderPath = CGPathCreateMutable();
|
||||||
@ -209,8 +225,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
|||||||
layer.addSublayer(topBorderLayer);
|
layer.addSublayer(topBorderLayer);
|
||||||
nativeView.topBorderLayer = topBorderLayer;
|
nativeView.topBorderLayer = topBorderLayer;
|
||||||
hasNonUniformBorder = true;
|
hasNonUniformBorder = true;
|
||||||
} else if (nativeView.topBorderLayer) {
|
|
||||||
nativeView.topBorderLayer.removeFromSuperlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const borderRightColor = background.borderRightColor;
|
const borderRightColor = background.borderRightColor;
|
||||||
@ -229,8 +243,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
|||||||
layer.addSublayer(rightBorderLayer);
|
layer.addSublayer(rightBorderLayer);
|
||||||
nativeView.rightBorderLayer = rightBorderLayer;
|
nativeView.rightBorderLayer = rightBorderLayer;
|
||||||
hasNonUniformBorder = true;
|
hasNonUniformBorder = true;
|
||||||
} else if (nativeView.rightBorderLayer) {
|
|
||||||
nativeView.rightBorderLayer.removeFromSuperlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const borderBottomColor = background.borderBottomColor;
|
const borderBottomColor = background.borderBottomColor;
|
||||||
@ -249,8 +261,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
|||||||
layer.addSublayer(bottomBorderLayer);
|
layer.addSublayer(bottomBorderLayer);
|
||||||
nativeView.bottomBorderLayer = bottomBorderLayer;
|
nativeView.bottomBorderLayer = bottomBorderLayer;
|
||||||
hasNonUniformBorder = true;
|
hasNonUniformBorder = true;
|
||||||
} else if (nativeView.bottomBorderLayer) {
|
|
||||||
nativeView.bottomBorderLayer.removeFromSuperlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const borderLeftColor = background.borderLeftColor;
|
const borderLeftColor = background.borderLeftColor;
|
||||||
@ -269,8 +279,6 @@ function drawNonUniformBorders(nativeView: NativeView, background: Background) {
|
|||||||
layer.addSublayer(leftBorderLayer);
|
layer.addSublayer(leftBorderLayer);
|
||||||
nativeView.leftBorderLayer = leftBorderLayer;
|
nativeView.leftBorderLayer = leftBorderLayer;
|
||||||
hasNonUniformBorder = true;
|
hasNonUniformBorder = true;
|
||||||
} else if (nativeView.leftBorderLayer) {
|
|
||||||
nativeView.leftBorderLayer.removeFromSuperlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeView.hasNonUniformBorder = hasNonUniformBorder;
|
nativeView.hasNonUniformBorder = hasNonUniformBorder;
|
||||||
|
Reference in New Issue
Block a user