fixed edit label positions in mxCellEditor
parent
28957e8c97
commit
76e0cf343a
|
@ -9,6 +9,7 @@ import mxRectangle from '../util/mxRectangle';
|
||||||
import mxEvent from '../util/mxEvent';
|
import mxEvent from '../util/mxEvent';
|
||||||
import mxClient from '../mxClient';
|
import mxClient from '../mxClient';
|
||||||
import mxConstants from '../util/mxConstants';
|
import mxConstants from '../util/mxConstants';
|
||||||
|
import mxText from "../shape/mxText";
|
||||||
|
|
||||||
class mxCellEditor {
|
class mxCellEditor {
|
||||||
/**
|
/**
|
||||||
|
@ -593,75 +594,76 @@ class mxCellEditor {
|
||||||
this.bounds.x += m.x * tmp;
|
this.bounds.x += m.x * tmp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let bds = mxRectangle.fromRectangle(state);
|
let bounds = mxRectangle.fromRectangle(state);
|
||||||
const hpos = mxUtils.getValue(
|
let hpos = mxUtils.getValue(
|
||||||
state.style,
|
state.style,
|
||||||
mxConstants.STYLE_LABEL_POSITION,
|
mxConstants.STYLE_LABEL_POSITION,
|
||||||
mxConstants.ALIGN_CENTER
|
mxConstants.ALIGN_CENTER
|
||||||
);
|
);
|
||||||
const vpos = mxUtils.getValue(
|
let vpos = mxUtils.getValue(
|
||||||
state.style,
|
state.style,
|
||||||
mxConstants.STYLE_VERTICAL_LABEL_POSITION,
|
mxConstants.STYLE_VERTICAL_LABEL_POSITION,
|
||||||
mxConstants.ALIGN_MIDDLE
|
mxConstants.ALIGN_MIDDLE
|
||||||
);
|
);
|
||||||
|
|
||||||
bds =
|
bounds =
|
||||||
state.shape != null &&
|
state.shape != null &&
|
||||||
hpos === mxConstants.ALIGN_CENTER &&
|
hpos === mxConstants.ALIGN_CENTER &&
|
||||||
vpos === mxConstants.ALIGN_MIDDLE
|
vpos === mxConstants.ALIGN_MIDDLE
|
||||||
? state.shape.getLabelBounds(bds)
|
? state.shape.getLabelBounds(bounds)
|
||||||
: bds;
|
: bounds;
|
||||||
|
|
||||||
if (lw != null) {
|
if (lw != null) {
|
||||||
bds.width = parseFloat(lw) * scale;
|
bounds.width = parseFloat(lw) * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!state.view.graph.cellRenderer.legacySpacing ||
|
!state.view.graph.cellRenderer.legacySpacing ||
|
||||||
state.style[mxConstants.STYLE_OVERFLOW] !== 'width'
|
state.style[mxConstants.STYLE_OVERFLOW] !== 'width'
|
||||||
) {
|
) {
|
||||||
|
const dummyMXText = new mxText(); // FIXME!!!! ===================================================================================================
|
||||||
const spacing =
|
const spacing =
|
||||||
parseInt(state.style[mxConstants.STYLE_SPACING] || 2) * scale;
|
parseInt(state.style[mxConstants.STYLE_SPACING] || 2) * scale;
|
||||||
const spacingTop =
|
const spacingTop =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_TOP] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_TOP] || 0) +
|
||||||
this.baseSpacingTop) *
|
dummyMXText.baseSpacingTop) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingRight =
|
const spacingRight =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_RIGHT] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_RIGHT] || 0) +
|
||||||
this.baseSpacingRight) *
|
dummyMXText.baseSpacingRight) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingBottom =
|
const spacingBottom =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_BOTTOM] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_BOTTOM] || 0) +
|
||||||
this.baseSpacingBottom) *
|
dummyMXText.baseSpacingBottom) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingLeft =
|
const spacingLeft =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_LEFT] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_LEFT] || 0) +
|
||||||
this.baseSpacingLeft) *
|
dummyMXText.baseSpacingLeft) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
|
|
||||||
const hpos = mxUtils.getValue(
|
hpos = mxUtils.getValue(
|
||||||
state.style,
|
state.style,
|
||||||
mxConstants.STYLE_LABEL_POSITION,
|
mxConstants.STYLE_LABEL_POSITION,
|
||||||
mxConstants.ALIGN_CENTER
|
mxConstants.ALIGN_CENTER
|
||||||
);
|
);
|
||||||
const vpos = mxUtils.getValue(
|
vpos = mxUtils.getValue(
|
||||||
state.style,
|
state.style,
|
||||||
mxConstants.STYLE_VERTICAL_LABEL_POSITION,
|
mxConstants.STYLE_VERTICAL_LABEL_POSITION,
|
||||||
mxConstants.ALIGN_MIDDLE
|
mxConstants.ALIGN_MIDDLE
|
||||||
);
|
);
|
||||||
|
|
||||||
bds = new mxRectangle(
|
bounds = new mxRectangle(
|
||||||
bds.x + spacingLeft,
|
bounds.x + spacingLeft,
|
||||||
bds.y + spacingTop,
|
bounds.y + spacingTop,
|
||||||
bds.width -
|
bounds.width -
|
||||||
(hpos === mxConstants.ALIGN_CENTER && lw == null
|
(hpos === mxConstants.ALIGN_CENTER && lw == null
|
||||||
? spacingLeft + spacingRight
|
? spacingLeft + spacingRight
|
||||||
: 0),
|
: 0),
|
||||||
bds.height -
|
bounds.height -
|
||||||
(vpos === mxConstants.ALIGN_MIDDLE
|
(vpos === mxConstants.ALIGN_MIDDLE
|
||||||
? spacingTop + spacingBottom
|
? spacingTop + spacingBottom
|
||||||
: 0)
|
: 0)
|
||||||
|
@ -669,10 +671,10 @@ class mxCellEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bounds = new mxRectangle(
|
this.bounds = new mxRectangle(
|
||||||
bds.x + state.absoluteOffset.x,
|
bounds.x + state.absoluteOffset.x,
|
||||||
bds.y + state.absoluteOffset.y,
|
bounds.y + state.absoluteOffset.y,
|
||||||
bds.width,
|
bounds.width,
|
||||||
bds.height
|
bounds.height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1130,26 +1132,27 @@ class mxCellEditor {
|
||||||
) {
|
) {
|
||||||
result = state.shape.getLabelBounds(mxRectangle.fromRectangle(state));
|
result = state.shape.getLabelBounds(mxRectangle.fromRectangle(state));
|
||||||
} else {
|
} else {
|
||||||
|
const dummyMXText = new mxText(); // FIXME!!!! ===================================================================================================
|
||||||
const spacing =
|
const spacing =
|
||||||
parseInt(state.style[mxConstants.STYLE_SPACING] || 0) * scale;
|
parseInt(state.style[mxConstants.STYLE_SPACING] || 0) * scale;
|
||||||
const spacingTop =
|
const spacingTop =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_TOP] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_TOP] || 0) +
|
||||||
baseSpacingTop) *
|
dummyMXText.baseSpacingTop) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingRight =
|
const spacingRight =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_RIGHT] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_RIGHT] || 0) +
|
||||||
baseSpacingRight) *
|
dummyMXText.baseSpacingRight) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingBottom =
|
const spacingBottom =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_BOTTOM] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_BOTTOM] || 0) +
|
||||||
baseSpacingBottom) *
|
dummyMXText.baseSpacingBottom) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
const spacingLeft =
|
const spacingLeft =
|
||||||
(parseInt(state.style[mxConstants.STYLE_SPACING_LEFT] || 0) +
|
(parseInt(state.style[mxConstants.STYLE_SPACING_LEFT] || 0) +
|
||||||
baseSpacingLeft) *
|
dummyMXText.baseSpacingLeft) *
|
||||||
scale +
|
scale +
|
||||||
spacing;
|
spacing;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue