Commit 25c4dad5f8b7df18630cae205384a032a2ade466

Authored by ww
1 parent c263f243

perf: 优化组件样式绑定

@@ -353,14 +353,14 @@ Format.prototype.immediateRefresh = function () { @@ -353,14 +353,14 @@ Format.prototype.immediateRefresh = function () {
353 var label2 = label.cloneNode(false); 353 var label2 = label.cloneNode(false);
354 var label3 = label2.cloneNode(false); 354 var label3 = label2.cloneNode(false);
355 var label4 = label3.cloneNode(false); 355 var label4 = label3.cloneNode(false);
356 -  
357 356
  357 +
358 // Workaround for ignored background in IE 358 // Workaround for ignored background in IE
359 label2.style.backgroundColor = Format.inactiveTabBackgroundColor; 359 label2.style.backgroundColor = Format.inactiveTabBackgroundColor;
360 label3.style.backgroundColor = Format.inactiveTabBackgroundColor; 360 label3.style.backgroundColor = Format.inactiveTabBackgroundColor;
361 label4.style.backgroundColor = Format.inactiveTabBackgroundColor; 361 label4.style.backgroundColor = Format.inactiveTabBackgroundColor;
362 label4.style.borderStyle = 'none' 362 label4.style.borderStyle = 'none'
363 - 363 +
364 // TODO Thingskit 新增数据绑定面板 Data Source Bind 364 // TODO Thingskit 新增数据绑定面板 Data Source Bind
365 if (hasDataSourceBindPanel) { 365 if (hasDataSourceBindPanel) {
366 mxUtils.write(label4, mxResources.get('dataSourcePanel')) 366 mxUtils.write(label4, mxResources.get('dataSourcePanel'))
@@ -4259,7 +4259,6 @@ StyleFormatPanel.prototype.addFill = function (container) { @@ -4259,7 +4259,6 @@ StyleFormatPanel.prototype.addFill = function (container) {
4259 }); 4259 });
4260 4260
4261 mxEvent.addListener(fillStyleSelect, 'change', function (evt) { 4261 mxEvent.addListener(fillStyleSelect, 'change', function (evt) {
4262 - console.log('enter')  
4263 graph.setCellStyles('fillStyle', fillStyleSelect.value, ss.cells); 4262 graph.setCellStyles('fillStyle', fillStyleSelect.value, ss.cells);
4264 ui.fireEvent(new mxEventObject('styleChanged', 'keys', ['fillStyle'], 4263 ui.fireEvent(new mxEventObject('styleChanged', 'keys', ['fillStyle'],
4265 'values', [fillStyleSelect.value], 'cells', ss.cells)); 4264 'values', [fillStyleSelect.value], 'cells', ss.cells));
@@ -15,9 +15,15 @@ mxAlarmListComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxAlarmListComponent.prototype.customProperties = [
15 mxAlarmListComponent.prototype.shapeKey = 'mxgraph.thingskit/alarmListComponent' 15 mxAlarmListComponent.prototype.shapeKey = 'mxgraph.thingskit/alarmListComponent'
16 16
17 mxAlarmListComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxAlarmListComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h);
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxAlarmListComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxAlarmListComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxAlarmListComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxCircularFlowMeterComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxCircularFlowMeterComponent.prototype.customProperties = [
15 mxCircularFlowMeterComponent.prototype.shapeKey = 'mxgraph.thingskit/circularFlowMeterComponent' 15 mxCircularFlowMeterComponent.prototype.shapeKey = 'mxgraph.thingskit/circularFlowMeterComponent'
16 16
17 mxCircularFlowMeterComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxCircularFlowMeterComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxCircularFlowMeterComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxCircularFlowMeterComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxCircularFlowMeterComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxDigitalClockComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxDigitalClockComponent.prototype.customProperties = [
15 mxDigitalClockComponent.prototype.shapeKey = 'mxgraph.thingskit/digitalClockComponent' 15 mxDigitalClockComponent.prototype.shapeKey = 'mxgraph.thingskit/digitalClockComponent'
16 16
17 mxDigitalClockComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxDigitalClockComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxDigitalClockComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxDigitalClockComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxDigitalClockComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxHistogramChartComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxHistogramChartComponent.prototype.customProperties = [
15 mxHistogramChartComponent.prototype.shapeKey = 'mxgraph.thingskit/histogramChartComponent' 15 mxHistogramChartComponent.prototype.shapeKey = 'mxgraph.thingskit/histogramChartComponent'
16 16
17 mxHistogramChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxHistogramChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxHistogramChartComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxHistogramChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxHistogramChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxImageComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxImageComponent.prototype.customProperties = [
15 mxImageComponent.prototype.shapeKey = 'mxgraph.thingskit/imageComponent' 15 mxImageComponent.prototype.shapeKey = 'mxgraph.thingskit/imageComponent'
16 16
17 mxImageComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxImageComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxImageComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxImageComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxImageComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxInstrumentChartComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxInstrumentChartComponent.prototype.customProperties = [
15 mxInstrumentChartComponent.prototype.shapeKey = 'mxgraph.thingskit/instrumentChartComponent' 15 mxInstrumentChartComponent.prototype.shapeKey = 'mxgraph.thingskit/instrumentChartComponent'
16 16
17 mxInstrumentChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxInstrumentChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxInstrumentChartComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxInstrumentChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxInstrumentChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxLineChartComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxLineChartComponent.prototype.customProperties = [
15 mxLineChartComponent.prototype.shapeKey = 'mxgraph.thingskit/lineChartComponent' 15 mxLineChartComponent.prototype.shapeKey = 'mxgraph.thingskit/lineChartComponent'
16 16
17 mxLineChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxLineChartComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxLineChartComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxLineChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxLineChartComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxParameterSettingsComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxParameterSettingsComponent.prototype.customProperties = [
15 mxParameterSettingsComponent.prototype.shapeKey = 'mxgraph.thingskit/parameterSettingsComponent' 15 mxParameterSettingsComponent.prototype.shapeKey = 'mxgraph.thingskit/parameterSettingsComponent'
16 16
17 mxParameterSettingsComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxParameterSettingsComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxParameterSettingsComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxParameterSettingsComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxParameterSettingsComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxRectFlowMeterComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxRectFlowMeterComponent.prototype.customProperties = [
15 mxRectFlowMeterComponent.prototype.shapeKey = 'mxgraph.thingskit/rectFlowMeterComponent' 15 mxRectFlowMeterComponent.prototype.shapeKey = 'mxgraph.thingskit/rectFlowMeterComponent'
16 16
17 mxRectFlowMeterComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxRectFlowMeterComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxRectFlowMeterComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxRectFlowMeterComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxRectFlowMeterComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxSwitchComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxSwitchComponent.prototype.customProperties = [
15 mxSwitchComponent.prototype.shapeKey = 'mxgraph.thingskit/switchComponent' 15 mxSwitchComponent.prototype.shapeKey = 'mxgraph.thingskit/switchComponent'
16 16
17 mxSwitchComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxSwitchComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxSwitchComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxSwitchComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxSwitchComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxThermometerComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxThermometerComponent.prototype.customProperties = [
15 mxThermometerComponent.prototype.shapeKey = 'mxgraph.thingskit/thermometerComponent' 15 mxThermometerComponent.prototype.shapeKey = 'mxgraph.thingskit/thermometerComponent'
16 16
17 mxThermometerComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxThermometerComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxThermometerComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxThermometerComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxThermometerComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -15,9 +15,15 @@ mxVariableImageComponent.prototype.customProperties = [ @@ -15,9 +15,15 @@ mxVariableImageComponent.prototype.customProperties = [
15 mxVariableImageComponent.prototype.shapeKey = 'mxgraph.thingskit/variableImageComponent' 15 mxVariableImageComponent.prototype.shapeKey = 'mxgraph.thingskit/variableImageComponent'
16 16
17 mxVariableImageComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 17 mxVariableImageComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  18 + this.paintBackground(c, x, y, w, h)
18 this.foreground(c, x, y, w, h) 19 this.foreground(c, x, y, w, h)
19 } 20 }
20 21
  22 +mxVariableImageComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  23 + svgCanvas.rect(x, y, w, h);
  24 + svgCanvas.fillAndStroke()
  25 +}
  26 +
21 mxVariableImageComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 27 mxVariableImageComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
22 var cell = this.state.cell 28 var cell = this.state.cell
23 var status = getCellStatus(this.state.view.graph) 29 var status = getCellStatus(this.state.view.graph)
@@ -13,9 +13,15 @@ mxVideoComponent.prototype.customProperties = [{ componentType: 'text' }] @@ -13,9 +13,15 @@ mxVideoComponent.prototype.customProperties = [{ componentType: 'text' }]
13 mxVideoComponent.prototype.shapeKey = 'mxgraph.thingskit/videoComponent' 13 mxVideoComponent.prototype.shapeKey = 'mxgraph.thingskit/videoComponent'
14 14
15 mxVideoComponent.prototype.paintVertexShape = function (c, x, y, w, h) { 15 mxVideoComponent.prototype.paintVertexShape = function (c, x, y, w, h) {
  16 + // this.paintBackground(c, x, y, w, h)
16 this.foreground(c, x, y, w, h) 17 this.foreground(c, x, y, w, h)
17 } 18 }
18 19
  20 +mxVideoComponent.prototype.paintBackground = function (svgCanvas, x, y, w, h) {
  21 + svgCanvas.rect(x, y, w, h);
  22 + svgCanvas.fillAndStroke()
  23 +}
  24 +
19 mxVideoComponent.prototype.foreground = function (svgCanvas, x, y, w, h) { 25 mxVideoComponent.prototype.foreground = function (svgCanvas, x, y, w, h) {
20 var cell = this.state.cell 26 var cell = this.state.cell
21 cell.setAttribute('shapeKey', this.shapeKey) 27 cell.setAttribute('shapeKey', this.shapeKey)