minitel-standalone
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -109,3 +109,3 @@ import { EventEmitter } from 'node:events'; | ||
mapLocation(attributes, inheritMe, nextNode, nodes, weAt) { | ||
return nextNode.mapLocationWrapper(inheritMe, {}, nodes, weAt); | ||
return nextNode.mapLocationWrapper(inheritMe, { width: attributes.width, height: attributes.height }, nodes, weAt); | ||
} | ||
@@ -112,0 +112,0 @@ mapLocationWrapper(inheritedAttributes, forcedAttributes, nodes, weAt) { |
@@ -141,3 +141,43 @@ import { RichChar } from '../richchar.js'; | ||
mapLocation(attributes, inheritMe, nextNode, nodes, weAt) { | ||
const location = nextNode.mapLocationWrapper(inheritMe, {}, nodes, weAt); | ||
let renderAttributes = attributes; | ||
let autoedX = false; | ||
let autoedY = false; | ||
if (attributes.width != null && attributes.height != null && attributes.overflowY !== 'hidden') { | ||
if (attributes.height != null) { | ||
if (attributes.overflowY === 'auto') { | ||
renderAttributes = Object.assign(Object.assign({}, attributes), { width: attributes.overflowX === 'hidden' ? attributes.width : null, height: null }); | ||
const possibleRender = super.getDimensions(renderAttributes, inheritMe); | ||
if (possibleRender.height <= attributes.height) | ||
autoedY = true; | ||
} | ||
if (!autoedY) { | ||
const width = attributes.width != null && attributes.overflowX === 'hidden' | ||
? attributes.width - 1 | ||
: null; | ||
renderAttributes = Object.assign(Object.assign({}, attributes), { width, height: null }); | ||
} | ||
} | ||
} | ||
else { | ||
if (attributes.width != null) { | ||
if (attributes.overflowX === 'auto') { | ||
renderAttributes = Object.assign(Object.assign({}, attributes), { height: attributes.height, width: null }); | ||
const possibleRender = super.getDimensions(renderAttributes, inheritMe); | ||
if (possibleRender.width <= attributes.width) | ||
autoedX = true; | ||
} | ||
if (!autoedX) { | ||
const height = attributes.height != null ? attributes.height - 1 : null; | ||
renderAttributes = Object.assign(Object.assign({}, attributes), { height, width: null }); | ||
} | ||
} | ||
} | ||
const dimensions = super.getDimensions(renderAttributes, inheritMe); | ||
if (attributes.overflowY !== 'hidden' && attributes.overflowY !== 'noscrollbar' && !autoedY && attributes.height != null) { | ||
dimensions.width += 1; | ||
} | ||
if (attributes.overflowX !== 'hidden' && attributes.overflowX !== 'noscrollbar' && !autoedX && attributes.width != null) { | ||
dimensions.height += 1; | ||
} | ||
const location = nextNode.mapLocationWrapper(inheritMe, renderAttributes, nodes, weAt); | ||
location.x -= this.scrollDelta[1]; | ||
@@ -144,0 +184,0 @@ location.y -= this.scrollDelta[0]; |
@@ -29,3 +29,3 @@ import { MinitelObject } from '../abstract/minitelobject.js'; | ||
prevLocation.x += getDeltaFromSetting(relevant[1].width, maxWidth, attributes.widthAlign); | ||
prevLocation.y += getDeltaFromSetting(relevant[1].height, maxWidth, attributes.heightAlign); | ||
prevLocation.y += getDeltaFromSetting(relevant[1].height, maxHeight, attributes.heightAlign); | ||
return prevLocation; | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "minitel-standalone", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "A standalone package for minitel components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -153,3 +153,3 @@ import { EventEmitter } from 'node:events'; | ||
mapLocation(attributes: T, inheritMe: Partial<T>, nextNode: MinitelObject, nodes: MinitelObject[], weAt: number): LocationDescriptor { | ||
return nextNode.mapLocationWrapper(inheritMe, {}, nodes, weAt) | ||
return nextNode.mapLocationWrapper(inheritMe, { width: attributes.width, height: attributes.height }, nodes, weAt) | ||
} | ||
@@ -156,0 +156,0 @@ mapLocationWrapper(inheritedAttributes: Partial<T>, forcedAttributes: Partial<T>, nodes: MinitelObject[], weAt: number): LocationDescriptor { |
@@ -169,3 +169,56 @@ import { Focusable } from '../abstract/focusable.js'; | ||
mapLocation(attributes: ScrollableAttributes, inheritMe: Partial<ScrollableAttributes>, nextNode: MinitelObject, nodes: MinitelObject[], weAt: number): LocationDescriptor { | ||
const location = nextNode.mapLocationWrapper(inheritMe, {}, nodes, weAt); | ||
let renderAttributes = attributes; | ||
let autoedX = false; | ||
let autoedY = false; | ||
if (attributes.width != null && attributes.height != null && attributes.overflowY !== 'hidden') { | ||
if (attributes.height != null) { | ||
if (attributes.overflowY === 'auto') { | ||
renderAttributes = { | ||
...attributes, | ||
width: attributes.overflowX === 'hidden' ? attributes.width : null, | ||
height: null, | ||
}; | ||
const possibleRender = super.getDimensions(renderAttributes, inheritMe); | ||
if (possibleRender.height <= attributes.height) autoedY = true; | ||
} | ||
if (!autoedY) { | ||
const width = attributes.width != null && attributes.overflowX === 'hidden' | ||
? attributes.width - 1 | ||
: null; | ||
renderAttributes = { ...attributes, width, height: null }; | ||
} | ||
} | ||
} else { | ||
if (attributes.width != null) { | ||
if (attributes.overflowX === 'auto') { | ||
renderAttributes = { | ||
...attributes, | ||
height: attributes.height, | ||
width: null, | ||
}; | ||
const possibleRender = super.getDimensions(renderAttributes, inheritMe); | ||
if (possibleRender.width <= attributes.width) autoedX = true; | ||
} | ||
if (!autoedX) { | ||
const height = attributes.height != null ? attributes.height - 1 : null; | ||
renderAttributes = { ...attributes, height, width: null }; | ||
} | ||
} | ||
} | ||
const dimensions = super.getDimensions(renderAttributes, inheritMe); | ||
if (attributes.overflowY !== 'hidden' && attributes.overflowY !== 'noscrollbar' && !autoedY && attributes.height != null) { | ||
dimensions.width += 1; | ||
} | ||
if (attributes.overflowX !== 'hidden' && attributes.overflowX !== 'noscrollbar' && !autoedX && attributes.width != null) { | ||
dimensions.height += 1; | ||
} | ||
const location = nextNode.mapLocationWrapper(inheritMe, renderAttributes, nodes, weAt); | ||
location.x -= this.scrollDelta[1]; | ||
@@ -172,0 +225,0 @@ location.y -= this.scrollDelta[0]; |
@@ -50,3 +50,3 @@ import { MinitelObject } from '../abstract/minitelobject.js'; | ||
prevLocation.x += getDeltaFromSetting(relevant[1].width, maxWidth, attributes.widthAlign); | ||
prevLocation.y += getDeltaFromSetting(relevant[1].height, maxWidth, attributes.heightAlign); | ||
prevLocation.y += getDeltaFromSetting(relevant[1].height, maxHeight, attributes.heightAlign); | ||
@@ -53,0 +53,0 @@ return prevLocation; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264607
5568