Изменение стандартного UI-элемента в веб UI-контроле
В этом разделе
Если вам необходимо изменить логику работы стандартного UI-элемента, вам потребуется реализовать JavaScript код, который переопределяет стандартный UI-элемент в фабрике UI-элементов.
Вот JavaScript-код, который демонстрирует, как создать UI-кнопку, которая включает инструмент "Annotation+Pan", и зарегистрировать новую кнопку вместо стандартной UI-кнопки, которая включает только инструмент "Pan":
/**
Creates UI button for activating the visual tool, which allows to annotate and pan images in image viewer.
*/
function __createAnnotationAndPanToolButton() {
return new Vintasoft.Imaging.DocumentViewer.UIElements.WebUiVisualToolButtonJS({
cssClass: "vsdv-tools-panButton",
title: "Pan",
localizationId: "panToolButton"
}, "AnnotationVisualTool,PanTool");
}
/**
Registers new UI button, which enables Annotation+Pan tool, instead of standard UI button, which enables only Pan tool.
*/
function __registerNewPanButton() {
with (Vintasoft.Imaging.DocumentViewer) {
// register the "Pan" button in web UI elements factory
WebUiElementsFactoryJS.registerElement("panToolButton", __createAnnotationAndPanToolButton);
}
}