-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented multiple properties view #79
base: master
Are you sure you want to change the base?
Changes from 1 commit
6080cc2
fe9a6a8
eba2774
1d4ed39
393ff0a
b165697
d97537b
adea85c
3f6098a
fc72909
ed60e55
d89b147
e2ec1f4
80ce591
92e0c07
547335d
462ae1d
9058ba7
b8a629b
2a9ec0a
082aeb3
b00aae5
c4c957c
4c88447
86ee3a1
02928de
786929c
2f19905
73d9102
347eef1
162c400
2366a93
446702f
2655512
bb2e3de
614fa4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,16 +33,48 @@ class ImageWithPorts extends joint.shapes.basic.Generic { | |
return attrs; | ||
} | ||
} | ||
|
||
/** | ||
* Class which wraps diagram object. | ||
*/ | ||
export class DefaultDiagramNode implements DiagramNode { | ||
private logicalId: string; | ||
|
||
/** | ||
* Image object on the screen. | ||
*/ | ||
private jointObject: ImageWithPorts; | ||
|
||
/** | ||
* Name and type of diagramm. | ||
*/ | ||
private name: string; | ||
private type: string; | ||
|
||
/** | ||
* Default properties. | ||
*/ | ||
private constPropertiesPack: PropertiesPack; | ||
|
||
/** | ||
* Properties, which can be changes by user. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changeD |
||
*/ | ||
private changeableProperties: Map<String, Property>; | ||
|
||
/** | ||
* Path to image. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really helpful. What kind of path? Filepath, url? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea. |
||
*/ | ||
private imagePath: string; | ||
|
||
/** | ||
* Text objects which are on the screen | ||
*/ | ||
private propertyEditElements: Map<String, PropertyEditElement>; | ||
private parentNode: DiagramContainer; | ||
|
||
/** | ||
* Graph, where diagram is located. Used to set new properties on the screen. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't understand it. |
||
*/ | ||
private graph : joint.dia.Graph; | ||
|
||
private resizeParameters = { | ||
|
@@ -62,7 +94,10 @@ export class DefaultDiagramNode implements DiagramNode { | |
height: 0, | ||
}; | ||
|
||
private lastPointermoveCursor = { | ||
/** | ||
* Coordinates of last diagram position. | ||
*/ | ||
private lastDiagramPosition = { | ||
x: 0, | ||
y: 0, | ||
}; | ||
|
@@ -106,13 +141,20 @@ export class DefaultDiagramNode implements DiagramNode { | |
this.parentNode = null; | ||
} | ||
|
||
/** | ||
* Pointermove handler. All parameters comes from default pointermove listener. | ||
* @param cellView joint.dia.CellView. | ||
* @param evt event. | ||
* @param x x position of event. | ||
* @param y y position of event. | ||
*/ | ||
pointermove(cellView, evt, x, y): void { | ||
console.log("Default diagram node pointer move with x : " + x + " and y : " + y); | ||
cellView.options.interactive = true; | ||
var diffX = x - this.lastMousePosition.x; | ||
var diffY = y - this.lastMousePosition.y; | ||
this.lastPointermoveCursor.x = this.getX(); | ||
this.lastPointermoveCursor.y = this.getY(); | ||
this.lastDiagramPosition.x = this.getX(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Position of the whole diagram? Maybe lastCursorPosition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Position of the whole diagram? -- Yes. Coordinates of underlying joint object. |
||
this.lastDiagramPosition.y = this.getY(); | ||
console.log("Diagram pos in pointermove : " + this.getX() + ", " + this.getY()); | ||
|
||
if (this.resizeParameters.isBottomResizing || this.resizeParameters.isRightResizing) { | ||
|
@@ -203,13 +245,16 @@ export class DefaultDiagramNode implements DiagramNode { | |
return String(this.boundingBox.width) + ", " + String(this.boundingBox.height); | ||
} | ||
|
||
/** | ||
* Changes text position according to new diagram coordinates. | ||
*/ | ||
changeTextPosition() : void { | ||
var dx = this.getX() - this.lastPointermoveCursor.x; | ||
var dy = this.getY() - this.lastPointermoveCursor.y; | ||
var dx = this.getX() - this.lastDiagramPosition.x; | ||
var dy = this.getY() - this.lastDiagramPosition.y; | ||
console.log("Diagram pos in changeTextPosition : " + this.getX() + ", " + this.getY()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not use log levels, so it's better to remove unnecessary logs before merge to master. |
||
//console.log("Last cursor was at " + this.lastPointermoveCursor.x + ", " + this.lastPointermoveCursor.y); | ||
console.log("Change position of text. diffX : " + dx + " diffY : " + dy); | ||
|
||
// no need to call it every time. | ||
if (dx !== 0 || dy !== 0) { | ||
for (var propertyKey in this.propertyEditElements) { | ||
this.propertyEditElements[propertyKey].setRelativePosition(dx, dy); | ||
|
@@ -248,7 +293,12 @@ export class DefaultDiagramNode implements DiagramNode { | |
return this.constPropertiesPack; | ||
} | ||
|
||
setProperty(key: string, property: Property ): void { | ||
/** | ||
* Sets new property and shows it on the screen. | ||
* @param key property key | ||
* @param property property to set | ||
*/ | ||
setProperty(key: string, property: Property): void { | ||
this.changeableProperties[key] = property; | ||
console.log("Set new text property : " + property.name + " : " + property.value); | ||
this.propertyEditElements[key].setProperty(property, this.graph); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write one doc per one field.