mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Skip refresh of chlidren node.
This commit is contained in:
parent
39dd2486a5
commit
90bf53d762
@ -1064,9 +1064,10 @@ abstract class Topic extends NodeGraph {
|
||||
|
||||
workspace.append(this._outgoingLine);
|
||||
|
||||
if (!this.areChildrenShrunken()) {
|
||||
const incomingLines = this.getIncomingLines();
|
||||
incomingLines.forEach((line) => line.redraw());
|
||||
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
@ -1152,7 +1153,7 @@ abstract class Topic extends NodeGraph {
|
||||
const bgColor = this.getBackgroundColor();
|
||||
innerShape.setFill(bgColor);
|
||||
|
||||
if (redrawChildren || shapeChanged || connectionChanged) {
|
||||
if ((redrawChildren || shapeChanged || connectionChanged) && !this.areChildrenShrunken()) {
|
||||
this.getChildren().forEach((t) => t.redraw(true));
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
const DE = {
|
||||
LOADING: 'Laden ...',
|
||||
SAVING: 'Speichern ...',
|
||||
SAVE_COMPLETE: 'Speichern abgeschlossen',
|
||||
ZOOM_IN_ERROR: 'Vergrößerung zu hoch.',
|
||||
ZOOM_ERROR: 'Es kann nicht weiter vergrößert bzw. verkleinert werden.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED: 'Thema konnte nicht angelegt werden. Bitte wähle nur ein Thema aus.',
|
||||
ONE_TOPIC_MUST_BE_SELECTED: 'Thema konnte nicht angelegt werden. Es muss ein Thema ausgewählt werden.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE: 'Kinderknoten können nicht eingefaltet werden. Es muss ein Thema ausgewäht werden.',
|
||||
SAVE_COULD_NOT_BE_COMPLETED: 'Sichern wurde nicht abgeschlossen. Versuche es später nocheinmal.',
|
||||
UNEXPECTED_ERROR_LOADING: 'Es tut uns leid, ein unerwarteter Fehler ist aufgetreten.\nVersuche, den Editor neu zu laden. Falls das Problem erneut auftritt, kontaktiere uns bitte unter support@wisemapping.com.',
|
||||
MAIN_TOPIC: 'Hauptthema',
|
||||
SUB_TOPIC: 'Unterthema',
|
||||
ISOLATED_TOPIC: 'Isoliertes Thema',
|
||||
CENTRAL_TOPIC: 'Zentrales Thema',
|
||||
CLIPBOARD_IS_EMPTY: 'Es gibt nichts zu kopieren. Die Zwischenablage ist leer.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED: 'Das zentrale Thema kann nicht gelöscht werden.',
|
||||
RELATIONSHIP_COULD_NOT_BE_CREATED: 'Die Beziehung konnte nicht angelegt werden. Es muss erst ein Vater-Thema ausgewählt werden, um die Beziehung herzustellen.',
|
||||
SESSION_EXPIRED: 'Deine Sitzung ist abgelaufen, bitte melde dich erneut an.',
|
||||
CENTRAL_TOPIC_CONNECTION_STYLE_CAN_NOT_BE_CHANGED: 'Der Verbindungsstil kann für das zentrale Thema nicht geändert werden.',
|
||||
CENTRAL_TOPIC_STYLE_CAN_NOT_BE_CHANGED: 'Das zentrale Thema kann nicht in den Linienstil geändert werden.',
|
||||
const EN = {
|
||||
LOADING: 'Loading ..',
|
||||
SAVING: 'Saving ...',
|
||||
SAVE_COMPLETE: 'Save completed',
|
||||
ZOOM_IN_ERROR: 'Zoom too high.',
|
||||
ZOOM_ERROR: 'No more zoom can be applied.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED: 'Could not create a topic. Only one topic must be selected.',
|
||||
ONE_TOPIC_MUST_BE_SELECTED: 'Could not create a topic. One topic must be selected.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE: 'Children can not be collapsed. One topic must be selected.',
|
||||
SAVE_COULD_NOT_BE_COMPLETED: 'Save could not be completed, please try again latter.',
|
||||
MAIN_TOPIC: 'Main Topic',
|
||||
SUB_TOPIC: 'Sub Topic',
|
||||
ISOLATED_TOPIC: 'Isolated Topic',
|
||||
CENTRAL_TOPIC: 'Central Topic',
|
||||
ENTITIES_COULD_NOT_BE_DELETED: 'Could not delete topic or relation. At least one map entity must be selected.',
|
||||
CLIPBOARD_IS_EMPTY: 'Nothing to copy. Clipboard is empty.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED: 'Central topic can not be deleted.',
|
||||
RELATIONSHIP_COULD_NOT_BE_CREATED: 'Relationship could not be created. A parent relationship topic must be selected first.',
|
||||
SESSION_EXPIRED: 'Your session has expired, please log-in again.',
|
||||
CENTRAL_TOPIC_CONNECTION_STYLE_CAN_NOT_BE_CHANGED: 'Connection style can not be changed for central topic.',
|
||||
CENTRAL_TOPIC_STYLE_CAN_NOT_BE_CHANGED: 'Central topic can not be changed to line style.',
|
||||
};
|
||||
|
||||
export default DE;
|
||||
export default EN;
|
||||
|
@ -15,11 +15,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import { $assert } from '@wisemapping/core-js';
|
||||
import PositionType from '../PositionType';
|
||||
import SizeType from '../SizeType';
|
||||
import ChildrenSorterStrategy from './ChildrenSorterStrategy';
|
||||
|
||||
type NodeValue = number | SizeType | PositionType | boolean;
|
||||
type MapValue = {
|
||||
hasChanged: boolean;
|
||||
value: NodeValue | undefined;
|
||||
oldValue: NodeValue | undefined;
|
||||
};
|
||||
type NodeKey = 'order' | 'position' | 'size' | 'freeDisplacement' | 'shrink';
|
||||
|
||||
class Node {
|
||||
private _id: number;
|
||||
|
||||
@ -28,7 +36,7 @@ class Node {
|
||||
|
||||
private _sorter: ChildrenSorterStrategy;
|
||||
|
||||
private _properties;
|
||||
private _properties: Map<NodeKey, MapValue>;
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
_children!: Node[];
|
||||
@ -41,7 +49,7 @@ class Node {
|
||||
$assert(typeof id === 'number' && Number.isFinite(id), 'id can not be null');
|
||||
this._id = id;
|
||||
this._sorter = sorter;
|
||||
this._properties = {};
|
||||
this._properties = new Map();
|
||||
|
||||
this.setSize(size);
|
||||
this.setPosition(position);
|
||||
@ -50,27 +58,23 @@ class Node {
|
||||
this._heightChanged = false;
|
||||
}
|
||||
|
||||
/** */
|
||||
getId(): number {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
/** */
|
||||
hasFreeDisplacementChanged() {
|
||||
hasFreeDisplacementChanged(): boolean {
|
||||
return this.isPropertyChanged('freeDisplacement');
|
||||
}
|
||||
|
||||
/** */
|
||||
setShrunken(value: boolean) {
|
||||
setShrunken(value: boolean): void {
|
||||
this.setProperty('shrink', value);
|
||||
}
|
||||
|
||||
/** */
|
||||
areChildrenShrunken() {
|
||||
return this.getProperty('shrink');
|
||||
areChildrenShrunken(): boolean {
|
||||
return Boolean(this.getProperty('shrink'));
|
||||
}
|
||||
|
||||
setOrder(order: number) {
|
||||
setOrder(order: number): void {
|
||||
$assert(
|
||||
typeof order === 'number' && Number.isFinite(order),
|
||||
`Order can not be null. Value:${order}`,
|
||||
@ -81,25 +85,22 @@ class Node {
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
resetPositionState() {
|
||||
const prop = this._properties.position;
|
||||
resetPositionState(): void {
|
||||
const prop = this._properties.get('position');
|
||||
if (prop) {
|
||||
prop.hasChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
resetOrderState() {
|
||||
const prop = this._properties.order;
|
||||
resetOrderState(): void {
|
||||
const prop = this._properties.get('order');
|
||||
if (prop) {
|
||||
prop.hasChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
resetFreeState() {
|
||||
const prop = this._properties.freeDisplacement;
|
||||
resetFreeState(): void {
|
||||
const prop = this._properties.get('freeDisplacement');
|
||||
if (prop) {
|
||||
prop.hasChanged = false;
|
||||
}
|
||||
@ -109,12 +110,10 @@ class Node {
|
||||
return this.getProperty('order') as number;
|
||||
}
|
||||
|
||||
/** */
|
||||
hasOrderChanged() {
|
||||
return this.isPropertyChanged('order');
|
||||
hasOrderChanged(): boolean {
|
||||
return Boolean(this.isPropertyChanged('order'));
|
||||
}
|
||||
|
||||
/** */
|
||||
hasPositionChanged() {
|
||||
return this.isPropertyChanged('position');
|
||||
}
|
||||
@ -127,7 +126,6 @@ class Node {
|
||||
return this.getProperty('position') as PositionType;
|
||||
}
|
||||
|
||||
/** */
|
||||
setSize(size: SizeType): void {
|
||||
const currentSize = this.getSize();
|
||||
if (
|
||||
@ -140,7 +138,6 @@ class Node {
|
||||
}
|
||||
}
|
||||
|
||||
/** */
|
||||
getSize(): SizeType {
|
||||
return this.getProperty('size') as SizeType;
|
||||
}
|
||||
@ -155,7 +152,6 @@ class Node {
|
||||
this.setProperty('freeDisplacement', { ...newDisplacement });
|
||||
}
|
||||
|
||||
/** */
|
||||
getFreeDisplacement(): PositionType {
|
||||
const freeDisplacement = this.getProperty('freeDisplacement') as PositionType;
|
||||
return freeDisplacement || { x: 0, y: 0 };
|
||||
@ -173,13 +169,13 @@ class Node {
|
||||
}
|
||||
}
|
||||
|
||||
setProperty(key: string, value) {
|
||||
let prop = this._properties[key];
|
||||
private setProperty(key: NodeKey, value: NodeValue): void {
|
||||
let prop = this._properties.get(key);
|
||||
if (!prop) {
|
||||
prop = {
|
||||
hasChanged: false,
|
||||
value: null,
|
||||
oldValue: null,
|
||||
value: undefined,
|
||||
oldValue: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@ -189,21 +185,19 @@ class Node {
|
||||
prop.value = value;
|
||||
prop.hasChanged = true;
|
||||
}
|
||||
this._properties[key] = prop;
|
||||
this._properties.set(key, prop);
|
||||
}
|
||||
|
||||
private getProperty(key: string): null | number | PositionType | SizeType {
|
||||
const prop = this._properties[key];
|
||||
return $defined(prop) ? prop.value : null;
|
||||
private getProperty(key: NodeKey): NodeValue | undefined {
|
||||
return this._properties.get(key)?.value;
|
||||
}
|
||||
|
||||
isPropertyChanged(key: string) {
|
||||
const prop = this._properties[key];
|
||||
isPropertyChanged(key: NodeKey): boolean {
|
||||
const prop = this._properties.get(key);
|
||||
return prop ? prop.hasChanged : false;
|
||||
}
|
||||
|
||||
/** */
|
||||
getSorter() {
|
||||
getSorter(): ChildrenSorterStrategy {
|
||||
return this._sorter;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user