mxcad 1.0.310 → 1.0.311

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mxcad.d.ts CHANGED
@@ -12662,6 +12662,12 @@ export declare class McObject {
12662
12662
  *在当前设置一个回退标记.
12663
12663
  */
12664
12664
  undoMark(): void;
12665
+ /**
12666
+ *回退标记索引加1.
12667
+ *在非命令函数里面修改数据据对象,需要回退标记索引加1,这样会记录修改,不然可能会认为上一次的命令修改,跳过当前修改回退记录.
12668
+ *在命令里面会自动回退标记索引加1
12669
+ */
12670
+ undoIndexIncrease(): void;
12665
12671
  }
12666
12672
  /**
12667
12673
  * McAppType 类,提供了 MxCAD 的一些基本操作。
@@ -14222,7 +14228,6 @@ declare function convertSlatePointToCadPoint(this: MxCADMText, point: IMxEditorP
14222
14228
  lineIndex: number;
14223
14229
  } | null;
14224
14230
  declare function transformBy(this: MxCADMText, mat: McGeMatrix3d): boolean;
14225
- declare function worldDraw(this: MxCADMText, draw: MxCADWorldDraw): void;
14226
14231
  /**
14227
14232
  * 自定义编辑器实体类
14228
14233
  * 用于在CAD中渲染和管理富文本编辑器
@@ -14262,7 +14267,7 @@ export declare class MxCADMText extends McDbCustomEntity {
14262
14267
  dwgOutFields(filter: IMcDbDwgFiler): boolean;
14263
14268
  moveGripPointsAt(iIndex: number, dXOffset: number, dYOffset: number, dZOffset: number): void;
14264
14269
  getGripPoints(): McGePoint3dArray;
14265
- worldDraw: typeof worldDraw;
14270
+ worldDraw(draw: MxCADWorldDraw): void;
14266
14271
  /** CAD坐标转换为Slate的Point位置 */
14267
14272
  convertCadPointToSlatePoint: typeof convertCadPointToSlatePoint;
14268
14273
  /** Slate的Point位置转换为CAD坐标 */
package/dist/mxcad.es.js CHANGED
@@ -14373,7 +14373,7 @@ win.McDrawObjectEvent_asciiToUTF8 = function (hexstr) {
14373
14373
  return MxG2312Obj.decodeFromGb2312Imp(hexstr);
14374
14374
  };
14375
14375
 
14376
- const version$1 = "1.0.310";
14376
+ const version$1 = "1.0.311";
14377
14377
 
14378
14378
  var isSharedArrayBuffer = ("SharedArrayBuffer" in window);
14379
14379
  var isCdn = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src);
@@ -21223,7 +21223,9 @@ var McObject = /*#__PURE__*/function () {
21223
21223
  value: function newFile() {
21224
21224
  this.currentFileName = "";
21225
21225
  this.currentOriginalFileName = "";
21226
- this.getMxDrawObject().clearAllObject();
21226
+ var mxobj = this.getMxDrawObject();
21227
+ mxobj.clearAllObject();
21228
+ mxobj.clearMxCurrentSelect();
21227
21229
  return this.imp.newFile();
21228
21230
  }
21229
21231
  }, {
@@ -21911,6 +21913,11 @@ var McObject = /*#__PURE__*/function () {
21911
21913
  value: function undoMark() {
21912
21914
  this.imp.undoMark();
21913
21915
  }
21916
+ }, {
21917
+ key: "undoIndexIncrease",
21918
+ value: function undoIndexIncrease() {
21919
+ this.imp.undoIndexIncrease();
21920
+ }
21914
21921
  }]);
21915
21922
  return McObject;
21916
21923
  }();
@@ -27007,58 +27014,12 @@ function transformBy(mat) {
27007
27014
  return true;
27008
27015
  }
27009
27016
 
27010
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27011
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27012
- function worldDraw(draw) {
27013
- var _this = this;
27014
- clearCalculateData();
27015
- clearTextCalculateData();
27016
- var imp = this.getMTextImp();
27017
- imp.__PARAGRAPH_INFOS__ = [];
27018
- var totalHeight = 0;
27019
- var maxWidth = 0;
27020
- imp.actualWidth = imp.maxWidth;
27021
- imp.actualHeight = imp.maxHeight;
27022
- var paragraphCalcResults = imp.data.map(function (node, index) {
27023
- if (!isElement(node)) return;
27024
- var element = MxCADMText.elementTextManager.get(node.type);
27025
- if (!element) return;
27026
- var result = element === null || element === void 0 ? void 0 : element.calculate(_this, node, index);
27027
- if (result) {
27028
- totalHeight += result.height;
27029
- maxWidth = Math.max(maxWidth, result.width);
27030
- }
27031
- return result;
27032
- });
27033
- var alignmentWidth = Math.max(imp.maxWidth, maxWidth);
27034
- var startPoint = imp.getActualRenderStartPosition(totalHeight, alignmentWidth);
27035
- var offsetHeight = 0;
27036
- imp.data.forEach(function (node, index) {
27037
- if (!isElement(node)) return;
27038
- var element = MxCADMText.elementTextManager.get(node.type);
27039
- if (!element) return;
27040
- var calcResult = paragraphCalcResults[index];
27041
- if (!calcResult) return;
27042
- var position = startPoint.clone().subvec(McGeVector3d.kYAxis.clone().mult(offsetHeight));
27043
- var info = element.render(_this, draw, node, calcResult, {
27044
- position: position,
27045
- index: index,
27046
- alignmentWidth: alignmentWidth
27047
- });
27048
- if (info) {
27049
- offsetHeight += calcResult.height;
27050
- imp.__PARAGRAPH_INFOS__[index] = _objectSpread$2(_objectSpread$2({}, calcResult), info);
27051
- }
27052
- });
27053
- imp.actualWidth = Math.max(imp.maxWidth, maxWidth);
27054
- imp.actualHeight = Math.max(imp.maxHeight, totalHeight);
27055
- imp.emit("changed");
27056
- }
27057
-
27058
27017
  var MxCADBaseCustomText = /*#__PURE__*/_createClass$1(function MxCADBaseCustomText() {
27059
27018
  _classCallCheck$1(this, MxCADBaseCustomText);
27060
27019
  });
27061
27020
 
27021
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27022
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27062
27023
  function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
27063
27024
  function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27064
27025
  var MxCADMText = /*#__PURE__*/function (_McDbCustomEntity) {
@@ -27069,7 +27030,6 @@ var MxCADMText = /*#__PURE__*/function (_McDbCustomEntity) {
27069
27030
  _classCallCheck$1(this, MxCADMText);
27070
27031
  _this = _super.call(this, imp);
27071
27032
  _defineProperty(_assertThisInitialized$1(_this), "impMText", void 0);
27072
- _defineProperty(_assertThisInitialized$1(_this), "worldDraw", worldDraw);
27073
27033
  _defineProperty(_assertThisInitialized$1(_this), "convertCadPointToSlatePoint", convertCadPointToSlatePoint);
27074
27034
  _defineProperty(_assertThisInitialized$1(_this), "convertSlatePointToCadPoint", convertSlatePointToCadPoint);
27075
27035
  _defineProperty(_assertThisInitialized$1(_this), "transformBy", transformBy);
@@ -27216,6 +27176,53 @@ var MxCADMText = /*#__PURE__*/function (_McDbCustomEntity) {
27216
27176
  value: function getGripPoints() {
27217
27177
  return this.impMText.getGripPoints();
27218
27178
  }
27179
+ }, {
27180
+ key: "worldDraw",
27181
+ value: function worldDraw(draw) {
27182
+ var _this2 = this;
27183
+ clearCalculateData();
27184
+ clearTextCalculateData();
27185
+ var imp = this.getMTextImp();
27186
+ imp.__PARAGRAPH_INFOS__ = [];
27187
+ var totalHeight = 0;
27188
+ var maxWidth = 0;
27189
+ imp.actualWidth = imp.maxWidth;
27190
+ imp.actualHeight = imp.maxHeight;
27191
+ var paragraphCalcResults = imp.data.map(function (node, index) {
27192
+ if (!isElement(node)) return;
27193
+ var element = MxCADMText.elementTextManager.get(node.type);
27194
+ if (!element) return;
27195
+ var result = element === null || element === void 0 ? void 0 : element.calculate(_this2, node, index);
27196
+ if (result) {
27197
+ totalHeight += result.height;
27198
+ maxWidth = Math.max(maxWidth, result.width);
27199
+ }
27200
+ return result;
27201
+ });
27202
+ var alignmentWidth = Math.max(imp.maxWidth, maxWidth);
27203
+ var startPoint = imp.getActualRenderStartPosition(totalHeight, alignmentWidth);
27204
+ var offsetHeight = 0;
27205
+ imp.data.forEach(function (node, index) {
27206
+ if (!isElement(node)) return;
27207
+ var element = MxCADMText.elementTextManager.get(node.type);
27208
+ if (!element) return;
27209
+ var calcResult = paragraphCalcResults[index];
27210
+ if (!calcResult) return;
27211
+ var position = startPoint.clone().subvec(McGeVector3d.kYAxis.clone().mult(offsetHeight));
27212
+ var info = element.render(_this2, draw, node, calcResult, {
27213
+ position: position,
27214
+ index: index,
27215
+ alignmentWidth: alignmentWidth
27216
+ });
27217
+ if (info) {
27218
+ offsetHeight += calcResult.height;
27219
+ imp.__PARAGRAPH_INFOS__[index] = _objectSpread$2(_objectSpread$2({}, calcResult), info);
27220
+ }
27221
+ });
27222
+ imp.actualWidth = Math.max(imp.maxWidth, maxWidth);
27223
+ imp.actualHeight = Math.max(imp.maxHeight, totalHeight);
27224
+ imp.emit("changed");
27225
+ }
27219
27226
  }]);
27220
27227
  return MxCADMText;
27221
27228
  }(McDbCustomEntity);