Commit 25c4dad5f8b7df18630cae205384a032a2ade466

Authored by ww
1 parent c263f243

perf: 优化组件样式绑定

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