File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -296,26 +296,32 @@ export default class Shape {
296296
297297 /**
298298 * Creates new Shape instance from Object representation.
299+ * You can ignore cursor param and create only Shape representation.
300+ * Though, you can add cursor in the runtime via {@link setCursor} method.
299301 *
300302 * @static
301303 * @param {Object } obj Object that you got from {@link toObject} method
304+ * @param {Cursor } [cursor] Cursor instance
302305 * @returns {Shape }
303306 */
304- static fromObject ( obj ) {
307+ static fromObject ( obj , cursor ) {
305308 if ( ! obj . type || ! obj . options ) throw new Error ( 'It looks like it is not an Object representation of the shape' ) ;
306309 if ( obj . type !== this . name ) throw new Error ( `${ obj . type } is not an Object representation of the ${ this . name } ` ) ;
307310
308- return this . create ( obj . options ) ;
311+ return this . create ( cursor , obj . options ) ;
309312 }
310313
311314 /**
312315 * Creates new Shape instance from JSON representation.
316+ * You can ignore cursor param and create only Shape representation.
317+ * Though, you can add cursor in the runtime via {@link setCursor} method.
313318 *
314319 * @static
315320 * @param {String } json JSON string that you got from {@link Shape.toJSON}
321+ * @param {Cursor } [cursor] Cursor instance
316322 * @returns {Shape }
317323 */
318- static fromJSON ( json ) {
319- return this . fromObject ( JSON . parse ( json ) ) ;
324+ static fromJSON ( json , cursor ) {
325+ return this . fromObject ( JSON . parse ( json ) , cursor ) ;
320326 }
321327}
You can’t perform that action at this time.
0 commit comments