const fabricjs = typeof fabric === "undefined" ? require ( "fabric" ) . fabric : fabric ; class PSPoint extends fabricjs . Point { type = "PSPoint" ; pressure : number ; constructor ( x , y , pressure ) { super ( x , y ) ; this . pressure = pressure ; } midPointFrom ( p ) { const mid = super . midPointFrom ( p ) ; return new PSPoint ( mid . x , mid . y , ( this . pressure + p . pressure ) / 2 ) ; } clone ( ) { return new PSPoint ( this . x , this . y , this . pressure ) ; } } PSPoint [ "fromObject" ] = function ( object , callback ) { callback && callback ( new PSPoint ( object . x , object . y , object . pressure ) ) ; } ; fabricjs [ "PSPoint" ] = PSPoint ; export default PSPoint ;