diff --git a/ui5/canv/controller/Ged.controller.js b/ui5/canv/controller/Ged.controller.js index edafcbc0b87d231375ddfcd2c7ff388fc6487e35..d4451700cacf421ec9fe253386e4b304a7e524be 100644 --- a/ui5/canv/controller/Ged.controller.js +++ b/ui5/canv/controller/Ged.controller.js @@ -120,11 +120,22 @@ sap.ui.define([ exec = `exec:SetMarkerStyle(${pars.value})`; else if (item == 'attmark/color') exec = this.getColorExec(data._painter, pars.value, 'SetMarkerColor'); + } else if ((data._kind === 'TAttText') && (obj.fTextColor !== undefined) && (obj.fTextFont !== undefined) && (obj.fTextSize !== undefined)) { + if (item == 'atttext/color') + exec = this.getColorExec(data._painter, pars.value, 'SetTextColor'); + else if (item == 'atttext/size') + exec = `exec:SetTextSize(${pars.value})`; + else if ((item == 'atttext/font_index') && data._painter?.textatt) + exec = `exec:SetTextFont(${data._painter.textatt.setGedFont(pars.value)})`; + else if (item == 'atttext/align') + exec = `exec:SetTextAlign(${pars.value})`; + else if (item == 'atttext/angle') + exec = `exec:SetTextAngle(${pars.value})`; } } if (data._painter) - data._painter.interactiveRedraw("pad", exec); // TODO: some objects can readraw directly, no need to redraw pad + data._painter.interactiveRedraw('pad', exec); // TODO: some objects can readraw directly, no need to redraw pad else if (this.currentPadPainter) this.currentPadPainter.redraw(); }, @@ -333,25 +344,31 @@ sap.ui.define([ return; } - if (painter.lineatt && painter.lineatt.used && !painter.lineatt.not_standard) { + if (painter.lineatt?.used && !painter.lineatt.not_standard) { let model = new JSONModel( { attline: painter.lineatt } ); - model.attachPropertyChange({ _kind: "TAttLine", _painter: painter, _handle: painter.lineatt }, this.modelPropertyChange, this); - - this.addFragment(oPage, "TAttLine", model); + model.attachPropertyChange({ _kind: 'TAttLine', _painter: painter, _handle: painter.lineatt }, this.modelPropertyChange, this); + this.addFragment(oPage, 'TAttLine', model); } - if (painter.fillatt && painter.fillatt.used) { + if (painter.fillatt?.used) { let model = new JSONModel( { attfill: painter.fillatt } ); - model.attachPropertyChange({ _kind: "TAttFill", _painter: painter, _handle: painter.fillatt }, this.modelPropertyChange, this); - - this.addFragment(oPage, "TAttFill", model); + model.attachPropertyChange({ _kind: 'TAttFill', _painter: painter, _handle: painter.fillatt }, this.modelPropertyChange, this); + this.addFragment(oPage, 'TAttFill', model); } - if (painter.markeratt && painter.markeratt.used) { + if (painter.markeratt?.used) { let model = new JSONModel( { attmark: painter.markeratt } ); - model.attachPropertyChange({ _kind: "TAttMarker", _painter: painter, _handle: painter.markeratt }, this.modelPropertyChange, this); + model.attachPropertyChange({ _kind: 'TAttMarker', _painter: painter, _handle: painter.markeratt }, this.modelPropertyChange, this); + this.addFragment(oPage, 'TAttMarker', model); + } + + if (painter.textatt) { + painter.textatt.font_index = Math.floor(painter.textatt.font/10); + painter.textatt.size_visible = painter.textatt.size > 0; - this.addFragment(oPage, "TAttMarker", model); + let model = new JSONModel( { atttext: painter.textatt } ); + model.attachPropertyChange({ _kind: 'TAttText', _painter: painter, _handle: painter.textatt }, this.modelPropertyChange, this); + this.addFragment(oPage, 'TAttText', model); } if (typeof painter.processTitleChange == 'function') { @@ -363,22 +380,18 @@ sap.ui.define([ } } - if (selectedClass == "TAxis") { + if (selectedClass == 'TAxis') { let model = new JSONModel({}); this.setAxisModel(model); - this.addFragment(oPage, "Axis", model); - model.attachPropertyChange({ _kind: "TAxis" }, this.processAxisModelChange, this); + this.addFragment(oPage, 'Axis', model); + model.attachPropertyChange({ _kind: 'TAxis' }, this.processAxisModelChange, this); } if (typeof painter.getHisto == 'function') { - painter.options.Mode3Dindx = painter.options.Mode3D ? 1 : 0; - let model = new JSONModel({ opts : painter.options }); - // model.attachPropertyChange({}, painter.processTitleChange, painter); this.addFragment(oPage, "Hist", model); - model.attachPropertyChange({ options: painter.options }, this.processHistModelChange, this); } }, diff --git a/ui5/canv/view/TAttText.fragment.xml b/ui5/canv/view/TAttText.fragment.xml new file mode 100644 index 0000000000000000000000000000000000000000..95b58926c79f763192f58fc58295bbf85953abc3 --- /dev/null +++ b/ui5/canv/view/TAttText.fragment.xml @@ -0,0 +1,62 @@ +<core:FragmentDefinition + xmlns="sap.m" + xmlns:l="sap.ui.layout" + xmlns:jsroot="rootui5.canv.controller" + xmlns:core="sap.ui.core"> + <VBox tooltip="TAttText parameters"> + <HBox renderType="Bare" width="100%"> + <jsroot:ColorButton text="text" attrcolor="{/atttext/color}" tooltip="Text color"/> + <Input visible="{/atttext/size_visible}" value="{/atttext/size}" tooltip="Text size" type="Number"> + <layoutData> + <FlexItemData growFactor="1"/> + </layoutData> + </Input> + <Select selectedKey="{/atttext/align}" tooltip="Text align" visible="{/atttext/align_used}"> + <layoutData> + <FlexItemData growFactor="1"/> + </layoutData> + <items> + <core:Item text="11: left bottom" key="11"/> + <core:Item text="12: left centered" key="12"/> + <core:Item text="13: left top" key="13"/> + <core:Item text="21: middle bottom" key="21"/> + <core:Item text="22: middle centered" key="22"/> + <core:Item text="23: middle top" key="23"/> + <core:Item text="31: right bottom" key="31"/> + <core:Item text="32: right centered" key="32"/> + <core:Item text="33: right top" key="33"/> + </items> + </Select> + </HBox> + <HBox renderType="Bare" width="100%"> + <Select selectedKey="{/atttext/font_index}" tooltip="Font style"> + <layoutData> + <FlexItemData growFactor="5"/> + </layoutData> + <items> + <core:Item text="none" key="0"/> + <core:Item text="Times New Roman italic" key="1"/> + <core:Item text="Times New Roman bold" key="2"/> + <core:Item text="Times New Roman bold italic" key="3"/> + <core:Item text="Arial" key="4"/> + <core:Item text="Arial oblique" key="5"/> + <core:Item text="Arial bold" key="6"/> + <core:Item text="Arial bold oblique" key="7"/> + <core:Item text="Courier New" key="8"/> + <core:Item text="Courier New oblique" key="9"/> + <core:Item text="Courier New bold" key="10"/> + <core:Item text="Courier New bold oblique" key="11"/> + <core:Item text="Symbol" key="12"/> + <core:Item text="Times New Roman" key="13"/> + <core:Item text="Wingdings" key="14"/> + <core:Item text="Symbol italic" key="15"/> + </items> + </Select> + <Input visible="{/atttext/angle_used}" value="{/atttext/angle}" tooltip="Text angle" type="Number"> + <layoutData> + <FlexItemData growFactor="1"/> + </layoutData> + </Input> + </HBox> + </VBox> +</core:FragmentDefinition>