1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { SPoint, SSize } from "@saga-web/draw/lib";
- import { SGraphyItem } from "@saga-web/graphy/lib";
- /**
- * 对象item
- *
- * @author 郝建龙(1061851420@qq.com)
- */
- export abstract class SObjectItem extends SGraphyItem {
- /** 宽度 */
- private _width: number = 64;
- get width(): number {
- return this._width;
- }
- set width(v: number) {
- if (v > 0) {
- if (v != this._width) {
- let w = this._width;
- this._width = v;
- this.onResize(
- new SSize(w, this._height),
- new SSize(this._width, this._height)
- );
- }
- }
- }
- /** 高度 */
- private _height: number = 64;
- get height(): number {
- return this._height;
- }
- set height(v: number) {
- if (v > 0) {
- if (v != this._height) {
- let h = this._height;
- this._height = v;
- this.onResize(
- new SSize(this._width, h),
- new SSize(this._width, this._height)
- );
- }
- }
- }
- /** 原点 */
- origin = new SPoint();
- /**
- * 宽高发发生变化
- *
- * @param oldSize 改之前的大小
- * @param newSize 改之后大小
- * */
- protected onResize(oldSize: SSize, newSize: SSize) {} // Function onResize()
- } // Class SObjectItem
|