forked from RDCNWebs/rd.rdlevel.cn
[RDView] 修复 hsb 属性读取异常和渲染异常
This commit is contained in:
parent
a14b4436f5
commit
5aedbbfbe0
@ -762,12 +762,15 @@ function createLayerFromBackground(key, bound, color, style, backgroundRepeat =
|
|||||||
const height = bound.height;
|
const height = bound.height;
|
||||||
const infoLeft = info.bounds.left;
|
const infoLeft = info.bounds.left;
|
||||||
const infoTop = info.bounds.top;
|
const infoTop = info.bounds.top;
|
||||||
|
const widthScale = width / info.bounds.width;
|
||||||
|
const heightScale = height / info.bounds.height;
|
||||||
layer.style.left = `${(left - pivotX) * style.scale}px`;
|
layer.style.left = `${(left - pivotX) * style.scale}px`;
|
||||||
layer.style.top = `${(top - pivotY) * style.scale}px`;
|
layer.style.top = `${(top - pivotY) * style.scale}px`;
|
||||||
layer.style.width = `${width * style.scale}px`;
|
layer.style.width = `${width * style.scale}px`;
|
||||||
layer.style.height = `${height * style.scale}px`;
|
layer.style.height = `${height * style.scale}px`;
|
||||||
layer.style.backgroundPosition = `-${infoLeft * style.scale}px -${infoTop * style.scale}px`;
|
layer.style.backgroundPosition = `-${infoLeft * widthScale * style.scale}px -${infoTop * heightScale * style.scale}px`;
|
||||||
layer.style.backgroundSize = `${assetSize.width * width * style.scale}px ${assetSize.height * height * style.scale}px`;
|
layer.style.backgroundSize = `${assetSize.width * widthScale * style.scale}px ${assetSize.height * heightScale * style.scale}px`;
|
||||||
|
console.log(layer.style.backgroundSize);
|
||||||
} else {
|
} else {
|
||||||
bound = bound ?? new Point(0, 0);
|
bound = bound ?? new Point(0, 0);
|
||||||
const left = bound.x;
|
const left = bound.x;
|
||||||
@ -963,7 +966,6 @@ function createElementEvent(obj, style) {
|
|||||||
}
|
}
|
||||||
if (!slices.has(key0)) {
|
if (!slices.has(key0)) {
|
||||||
if (!slices.has("event_Unknown")) {
|
if (!slices.has("event_Unknown")) {
|
||||||
console.log(slices);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
key0 = "event_Unknown";
|
key0 = "event_Unknown";
|
||||||
@ -1262,7 +1264,10 @@ function createElementEvent(obj, style) {
|
|||||||
const top = iconSize / 2 - iconBounds.height * s / 2;
|
const top = iconSize / 2 - iconBounds.height * s / 2;
|
||||||
const patternLayers = [];
|
const patternLayers = [];
|
||||||
const backLayers2 = createBackLayer(new Size(slcinfo.bounds.width, slcinfo.bounds.height), colorOf(obj.tab ?? evinfo.defaultTab), style);
|
const backLayers2 = createBackLayer(new Size(slcinfo.bounds.width, slcinfo.bounds.height), colorOf(obj.tab ?? evinfo.defaultTab), style);
|
||||||
for (let p of obj.pattern ?? "------") {
|
if (typeof obj.pattern !== "string" || obj.pattern.length !== 6) {
|
||||||
|
obj.pattern = "------";
|
||||||
|
}
|
||||||
|
for (let p of obj.pattern) {
|
||||||
const beatxLayer = createLayerFromBackground(p === "x" ? beatx : beatline, new Rect(left, top, width, iconBounds.height * s), null, style);
|
const beatxLayer = createLayerFromBackground(p === "x" ? beatx : beatline, new Rect(left, top, width, iconBounds.height * s), null, style);
|
||||||
patternLayers.push(...beatxLayer);
|
patternLayers.push(...beatxLayer);
|
||||||
left += width;
|
left += width;
|
||||||
@ -1511,18 +1516,19 @@ function createElementEvent(obj, style) {
|
|||||||
if (obj["$style"]) {
|
if (obj["$style"]) {
|
||||||
const hsb = obj["$style"].hsb ?? [
|
const hsb = obj["$style"].hsb ?? [
|
||||||
0,
|
0,
|
||||||
0,
|
1,
|
||||||
0
|
1
|
||||||
];
|
];
|
||||||
if (hsb[0] !== 0 || hsb[1] !== 0 || hsb[2] !== 0) {
|
if (hsb.length === 3 && (hsb[0] !== 0 || hsb[1] !== 0 || hsb[2] !== 0)) {
|
||||||
layersToAdd.forEach((layer) => {
|
layersToAdd.forEach((layer) => {
|
||||||
|
if (!layer.filterData) return;
|
||||||
layer.filterData.hue = hsb[0];
|
layer.filterData.hue = hsb[0];
|
||||||
layer.filterData.saturation = hsb[1];
|
layer.filterData.saturation = hsb[1];
|
||||||
layer.filterData.brightness = hsb[2];
|
layer.filterData.brightness = hsb[2];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
layersToAdd.forEach((layer) => {
|
layersToAdd.forEach((layer) => {
|
||||||
layer.updateFilter();
|
layer.updateFilter?.();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
element.onStateChange = (style2) => {
|
element.onStateChange = (style2) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user