Kind of funny, as I just went through a class last weekend, taught by an attorney who works on gun cases here primarily. I live in a pretty red state but she left no doubt, you do not show your gun to try and induce someone to leave you alone. She was categorical in this, it is brandishing and if the police are called, you will be arrested. She used a number of examples of pulling a garment back to reveal a holstered gun, to unholstering and raising it up, again to "warn". In each example, she said, "if you do this and the people you were warning off go to the police and there is a witness, you will go to jail and almost certainly lose your carry rights if convicted".
I really liked the tutorial in the link, one thing that differed in what was taught in my class to what the linked tutorial taught was what could be called "escalation". The advice to use profanity to speak the language of thugs went against what she taught. She focused on non-escalation, especially verbally. Shouting to stop, go no further, back up, hands up in a stop sign, that you don't want trouble, etc. were all positive. She explained profanity would be escalating and she was emphatic that escalation took your rights to a self defense argument away pretty quickly. She was very firm, anything that looked like you made the first escalating move was very bad in a courtroom.
The real problem is defining the threat and in the terms outside witnesses could relate to when the worst case happened and you found yourself in court. I think in the tutorial linked, with two possible assailants moving in, unheeding your command to stop and not identifying themselves as police or store security, you have a pretty good case to draw and present, demanding they leave you be. Not sure it is as cut and dried if it were a single assailant, at least until they made a more specific threatening jesture. At least that is the way the attorney explained it here in my red state.
In any case, if it is undercover cops or armed security, you are probably going to have a pretty bad day.
PS - one thing she did emphasize is be the first to call 911 as soon as the threat leaves the immediate area. If they call first and report some nut waving a gun around in the store parking lot, bad juju.