Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Get value of iframe element width.
const iframeElementWidthValue = calculateNumericalTagValue(
calc,
this.bot3D.bot,
'aux.iframe.element.width',
DEFAULT_IFRAME_ELEMENT_WIDTH
);
let iframeElementWidthValueChanged = false;
if (iframeElementWidthValue !== this._elementWidth) {
this._elementWidth = iframeElementWidthValue;
iframeElementWidthValueChanged = true;
}
// Get value of iframe url.
const iframeValue = calculateBotValue(
calc,
this.bot3D.bot,
'aux.iframe'
);
let iframeValueChanged = false;
if (hasValue(iframeValue) && isValidURL(iframeValue)) {
if (this.url !== iframeValue) {
this.url = iframeValue;
iframeValueChanged = true;
}
} else {
if (this.url !== null && this.url !== undefined) {
this.url = null;
iframeValueChanged = true;
}
tap(update => {
const bot = update;
// Update the context background color.
//let contextBackgroundColor =
//bot.tags['aux.context.color'];
let contextBackgroundColor = calculateBotValue(
calc,
bot,
`aux.context.color`
);
this._contextBackground = hasValue(
contextBackgroundColor
)
? new Color(contextBackgroundColor)
: undefined;
this._pannable = calculateBooleanTagValue(
calc,
bot,
`aux.context.pannable`,
true
bots.forEach(bot => {
if (isUserBot(bot.bot)) {
return;
}
let localPosition = calculateGridTileLocalCenter(
calculateBotValue(calc, bot.bot, bot.context + 'X'),
calculateBotValue(calc, bot.bot, bot.context + 'Y'),
calculateBotValue(calc, bot.bot, bot.context + 'Z'),
calculateGridScale(calc, bot.contextGroup.bot)
);
let axial: Axial = realPosToGridPos(
new Vector2(localPosition.x, localPosition.z),
scale
);
const hexgrid = this.hexGrid.addAt(axial);
hexgrid.height =
centerHeight || defaultHeight || DEFAULT_WORKSPACE_HEIGHT;
});
private _calculateUserTokenInfo(
context: BotCalculationContext,
bot: Bot
): UserTokenInfo {
return {
id: bot.id,
token: calculateBotValue(context, bot, 'aux.token'),
username: calculateBotValue(context, bot, 'aux.token.username'),
locked: calculateBooleanTagValue(
context,
bot,
'aux.token.locked',
false
),
};
}
private _calculateUserTokenInfo(
context: BotCalculationContext,
bot: Bot
): UserTokenInfo {
return {
id: bot.id,
token: calculateBotValue(context, bot, 'aux.token'),
username: calculateBotValue(context, bot, 'aux.token.username'),
locked: calculateBooleanTagValue(
context,
bot,
'aux.token.locked',
false
),
};
}
private _calculateUserAccountInfo(
context: BotCalculationContext,
bot: Bot
): UserAccountInfo {
return {
username: calculateBotValue(context, bot, 'aux.account.username'),
roles: getBotRoles(context, bot),
locked: calculateBooleanTagValue(
context,
bot,
'aux.account.locked',
false
),
};
}
bots.forEach(bot => {
if (isUserBot(bot.bot)) {
return;
}
let localPosition = calculateGridTileLocalCenter(
calculateBotValue(calc, bot.bot, bot.context + 'X'),
calculateBotValue(calc, bot.bot, bot.context + 'Y'),
calculateBotValue(calc, bot.bot, bot.context + 'Z'),
calculateGridScale(calc, bot.contextGroup.bot)
);
let axial: Axial = realPosToGridPos(
new Vector2(localPosition.x, localPosition.z),
scale
);
const hexgrid = this.hexGrid.addAt(axial);
hexgrid.height =
centerHeight || defaultHeight || DEFAULT_WORKSPACE_HEIGHT;
});
private _updateColor(calc: BotCalculationContext, bot: Bot) {
if (bot.tags['aux.color']) {
this.backgroundColor = calculateBotValue(calc, bot, 'aux.color');
} else {
this.backgroundColor = '#FFF';
}
}
tap(update => {
const bot = update;
let userBackgroundColor = calculateBotValue(
calc,
bot,
`aux.context.color`
);
this._userInventoryColor = hasValue(userBackgroundColor)
? new Color(userBackgroundColor)
: undefined;
})
)