Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ScadaWeb/Mimics/PlgMimic/wwwroot/plugins/Mimic/css/mimic.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.mimic-wrapper {
.tooltip.show .tooltip-inner {
text-align: left;
max-width: none;
white-space: nowrap;
}
.mimic-wrapper {
overflow: auto;
overscroll-behavior: none;
position: relative;
Expand Down Expand Up @@ -38,7 +43,6 @@
.mimic-wrapper.view-mode .mimic .comp.wait-action {
cursor: wait !important;
}

.mimic-wrapper.edit-mode {
cursor: default;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ScadaWeb/Mimics/PlgMimic/wwwroot/plugins/Mimic/css/mimic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ $component-selected-box-shadow: 0 0 0 3px lime;
$component-hover-box-shadow: 0 0 0 1px var(--bs-gray-500);
$component-fiction-border: 1px dashed var(--bs-gray-600);

// Bootstrap tooltip override
.tooltip.show .tooltip-inner {
text-align: left;
max-width: none;
white-space: nowrap;
}

.mimic-wrapper {
overflow: auto;
overscroll-behavior: none;
Expand Down
39 changes: 32 additions & 7 deletions ScadaWeb/Mimics/PlgMimic/wwwroot/plugins/Mimic/js/mimic-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4704,12 +4704,24 @@ rs.mimic.MimicRenderer = class MimicRenderer extends rs.mimic.Renderer {
this._setCornerRadius(mimicElem, props.cornerRadius);
}

mimicElem
.attr("title", props.tooltip)
.css({
"background-color": props.backColor,
"color": props.foreColor
});
// Tooltip: native title for desktop, Bootstrap for touch devices
if (props.tooltip) {
const isTouchDevice = ('ontouchstart' in window || navigator.maxTouchPoints > 0);

if (isTouchDevice) {
mimicElem.prop("title", props.tooltip.replace(/\n|\r\n|\r/g, '<br>'));
mimicElem.attr("data-bs-toggle", "tooltip");
mimicElem.attr("data-bs-html", true);
mimicElem.addClass("user-select-none");
} else {
mimicElem.attr("title", props.tooltip);
}
}

mimicElem.css({
"background-color": props.backColor,
"color": props.foreColor
});

if (props.backgroundImage) {
let x = props.backgroundPadding.left;
Expand Down Expand Up @@ -5134,7 +5146,20 @@ rs.mimic.RegularComponentRenderer = class extends rs.mimic.ComponentRenderer {
this._setBorder(componentElem, props.border);
this._setCornerRadius(componentElem, props.cornerRadius);
this._setFont(componentElem, props.font, renderContext.fontMap);
componentElem.attr("title", props.tooltip);

// Tooltip: native title for desktop, Bootstrap for touch devices
if (props.tooltip) {
const isTouchDevice = ('ontouchstart' in window || navigator.maxTouchPoints > 0);

if (isTouchDevice) {
componentElem.prop("title", props.tooltip.replace(/\n|\r\n|\r/g, '<br>'));
componentElem.attr("data-bs-toggle", "tooltip");
componentElem.attr("data-bs-html", true);
componentElem.addClass("user-select-none");
} else {
componentElem.attr("title", props.tooltip);
}
}

if (props.enabled) {
this._restoreVisualState(componentElem, props);
Expand Down
39 changes: 32 additions & 7 deletions ScadaWeb/Mimics/PlgMimic/wwwroot/plugins/Mimic/js/mimic-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,24 @@ rs.mimic.MimicRenderer = class MimicRenderer extends rs.mimic.Renderer {
this._setCornerRadius(mimicElem, props.cornerRadius);
}

mimicElem
.attr("title", props.tooltip)
.css({
"background-color": props.backColor,
"color": props.foreColor
});
// Tooltip: native title for desktop, Bootstrap for touch devices
if (props.tooltip) {
const isTouchDevice = ('ontouchstart' in window || navigator.maxTouchPoints > 0);

if (isTouchDevice) {
mimicElem.prop("title", props.tooltip.replace(/\n|\r\n|\r/g, '<br>'));
mimicElem.attr("data-bs-toggle", "tooltip");
mimicElem.attr("data-bs-html", true);
mimicElem.addClass("user-select-none");
} else {
mimicElem.attr("title", props.tooltip);
}
}

mimicElem.css({
"background-color": props.backColor,
"color": props.foreColor
});

if (props.backgroundImage) {
let x = props.backgroundPadding.left;
Expand Down Expand Up @@ -752,7 +764,20 @@ rs.mimic.RegularComponentRenderer = class extends rs.mimic.ComponentRenderer {
this._setBorder(componentElem, props.border);
this._setCornerRadius(componentElem, props.cornerRadius);
this._setFont(componentElem, props.font, renderContext.fontMap);
componentElem.attr("title", props.tooltip);

// Tooltip: native title for desktop, Bootstrap for touch devices
if (props.tooltip) {
const isTouchDevice = ('ontouchstart' in window || navigator.maxTouchPoints > 0);

if (isTouchDevice) {
componentElem.prop("title", props.tooltip.replace(/\n|\r\n|\r/g, '<br>'));
componentElem.attr("data-bs-toggle", "tooltip");
componentElem.attr("data-bs-html", true);
componentElem.addClass("user-select-none");
} else {
componentElem.attr("title", props.tooltip);
}
}

if (props.enabled) {
this._restoreVisualState(componentElem, props);
Expand Down
10 changes: 10 additions & 0 deletions ScadaWeb/Mimics/PlgMimic/wwwroot/plugins/Mimic/js/mimic-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ function updateLayout() {
alignHorizontally();
}

// Initialize Bootstrap tooltips on all mimic elements
function initTooltips() {
if (mimic.dom && typeof bootstrap !== "undefined") {
mimic.dom.find("[data-bs-toggle='tooltip']").each(function () {
bootstrap.Tooltip.getOrCreateInstance(this);
});
}
}

async function loadMimic() {
spinnerElem.removeClass("d-none");
let result = await mimic.load(getLoaderUrl(), viewID);
Expand All @@ -159,6 +168,7 @@ async function loadMimic() {
mimicWrapperElem.append(unitedRenderer.createMimicDom());
toolbarElem.removeClass("d-none");
initScale();
initTooltips();
startUpdatingData();
startBlinking();
}
Expand Down